[X2Go-Commits] [live-build-x2go] 01/02: added backgrounded task to grab X2GoClient on Startup and move it to the right

git-admin at x2go.org git-admin at x2go.org
Mon Jan 29 22:53:18 CET 2024


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch heuler/mate-minidesktop-bullseye
in repository live-build-x2go.

commit cebafd618899082dc13a79db24f3c338b65f1f99
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date:   Fri Jan 26 15:38:40 2024 +0100

    added backgrounded task to grab X2GoClient on Startup and move it to the
    right
---
 .../999_x2gothinclient-align-right                 | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/config/includes.chroot/etc/x2go/x2gothinclient_init.d/999_x2gothinclient-align-right b/config/includes.chroot/etc/x2go/x2gothinclient_init.d/999_x2gothinclient-align-right
new file mode 100644
index 0000000..9b240c8
--- /dev/null
+++ b/config/includes.chroot/etc/x2go/x2gothinclient_init.d/999_x2gothinclient-align-right
@@ -0,0 +1,36 @@
+#!/bin/bash
+# move X2GoClient window to right screen border and resize - but only
+# when in minidesktop mode
+if [ -z "$X2GO_HANDLE_DAEMON" ] ; then
+	# we need to background this so it doesn't block the startup
+	(
+		# we have at least two matching window ids:
+		# actual client window and taskbar icon
+		# so let's wait until we have them both
+		X2GOCLIENTWINDOWIDS=""
+		while [ $(echo -e "$X2GOCLIENTWINDOWIDS" | wc -l) -lt 2 ] ; do
+			X2GOCLIENTWINDOWIDS=$(xdotool search --onlyvisible --name X2GoClient)
+		done
+		
+		# now wait until there is only one window id left that's visible and
+		# which matches our expected window name
+		while [ $(echo -e "$X2GOCLIENTWINDOWIDS" | wc -l) -gt 1 ] ; do
+			X2GOCLIENTWINDOWIDS=$(xdotool search --onlyvisible --name X2GoClient)
+		done
+		
+		# while there SHOULD be only one ID left by now ...
+		# let's handle this in a safe manner - as a list
+		for WINDOW in $X2GOCLIENTWINDOWIDS; do
+			# the id belonging to the taskbar icon cannot be activated
+			# xdotool does not return a non-zero error code when windowactivate
+			# fails, so we need to check for the presence of an error message
+			if xdotool windowactivate $WINDOW 2>/dev/null; then
+				# if we succeeded in activating the window,
+				# it's the actual client window
+				sleep 0.5s
+				xdotool windowsize $WINDOW 30% 100% # resize it
+				xdotool windowmove $WINDOW 70% 0 # move it to the right
+			fi
+		done
+	) &
+fi

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/live-build-x2go.git


More information about the x2go-commits mailing list