[X2Go-Commits] [live-build-x2go] 10/14: fixed logic, added comments, added default size and /proc/cmdline parameter
git-admin at x2go.org
git-admin at x2go.org
Mon Jan 29 22:51:40 CET 2024
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch heuler/mate-minidesktop-bookworm
in repository live-build-x2go.
commit 132c5961aacb023cccffc3bd304207d327e9942a
Author: Stefan Baur (BAUR-ITCS) <kontakt at baur-itcs.de>
Date: Fri Jan 26 19:09:16 2024 +0100
fixed logic, added comments, added default size and /proc/cmdline parameter
---
.../940_x2gothinclient-align-right | 79 +++++++++++++---------
1 file changed, 46 insertions(+), 33 deletions(-)
diff --git a/config/includes.chroot/etc/x2go/x2gothinclient_init.d/940_x2gothinclient-align-right b/config/includes.chroot/etc/x2go/x2gothinclient_init.d/940_x2gothinclient-align-right
index 9b240c8..7e4b460 100755
--- a/config/includes.chroot/etc/x2go/x2gothinclient_init.d/940_x2gothinclient-align-right
+++ b/config/includes.chroot/etc/x2go/x2gothinclient_init.d/940_x2gothinclient-align-right
@@ -1,36 +1,49 @@
#!/bin/bash
-# move X2GoClient window to right screen border and resize - but only
-# when in minidesktop mode
+# move X2GoClient window to right screen border and resize - but only when in minidesktop mode
+
+WINDOWWIDTH=$(cat /proc/cmdline | tr ' ' '\n' | awk -F'=' '"windowwidth"==$1 {print $2}' | tr -dc '0-9')
+
+# default to 50(%) if unset
+if [ -z "$WINDOWWIDTH" ]; then
+ WINDOWWIDTH=50"
+fi
+
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
- ) &
+ # we need to background this so it doesn't block the startup
+ (
+ # wait for window ids to show up
+ X2GOCLIENTWINDOWIDS=""
+ while [ -z "$X2GOCLIENTWINDOWIDS" ] ; do
+ # if this var is of nonzero length, we have at least one matching window id:
+ # the actual client window and possibly the taskbar icon
+ X2GOCLIENTWINDOWIDS=$(xdotool search --onlyvisible --name X2GoClient)
+ # make sure we terminate if X11 terminates
+ ps -C Xorg || exit 0
+ done
+
+ while [ $(echo -n "$X2GOCLIENTWINDOWIDS" | wc -l) -gt 2 ] ; do
+ # now wait until there is only one window id left that's visible and
+ # which matches our expected window name
+ X2GOCLIENTWINDOWIDS=$(xdotool search --onlyvisible --name X2GoClient)
+ # make sure we terminate if X11 terminates
+ ps -C Xorg || exit 0
+ 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 ${WINDOWWIDTH}% 100% # resize it
+ xdotool windowmove $WINDOW $((100-WINDOWWIDTH))% 0 # move it to the right
+ fi
+ # make sure we terminate if X11 terminates
+ ps -C Xorg || exit 0
+ 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