From ad56fb9e35d6192270ba6cbb9ac17228bd9466e3 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 29 Dec 2022 00:03:19 -0300 Subject: Fix: xrandr: switch to a pure xdotool approach --- kvmx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'kvmx') diff --git a/kvmx b/kvmx index 455f5b6..fb0faec 100755 --- a/kvmx +++ b/kvmx @@ -2253,8 +2253,16 @@ function kvmx_xrandr { # Set screen resolution depending on which screen the spice session is currently located local id="`xdotool search --name $VM`" - local screen="`xdotool getwindowgeometry $id | grep screen: | cut -d '(' -f 2 | cut -d : -f 2 | cut -d ')' -f 1 | sed -e 's/ //'`" - local mode="`xrandr | grep "Screen ${screen}:" | cut -d , -f 2 | sed -e 's/ current //' -e 's/ //g' | tr 'x' ' '`" + + # XrandR approach, matches the full screen size, not ideal when using + # multiple monitors/outputs or if the window size is smaller than the + # current screen size + #local screen="`xdotool getwindowgeometry $id | grep screen: | cut -d '(' -f 2 | cut -d : -f 2 | cut -d ')' -f 1 | sed -e 's/ //'`" + #local mode="`xrandr | grep "Screen ${screen}:" | cut -d , -f 2 | sed -e 's/ current //' -e 's/ //g' | tr 'x' ' '`" + + # Pure xdotool approach, matches the current window size + # Better support for multiple monitors/outputs and for windows of arbitrary sizes + local mode="`xdotool getwindowgeometry $id | grep -i geometry: | cut -d : -f 2 | tr 'x' ' '`" if [ ! -z "$resolution_y_offset" ]; then local x="`echo $mode | awk '{ print $1 }'`" -- cgit v1.2.3