aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkvmx12
1 files changed, 10 insertions, 2 deletions
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 }'`"