aboutsummaryrefslogtreecommitdiff
path: root/kvmx
diff options
context:
space:
mode:
Diffstat (limited to 'kvmx')
-rwxr-xr-xkvmx8
1 files changed, 7 insertions, 1 deletions
diff --git a/kvmx b/kvmx
index 2134e82..f86add8 100755
--- a/kvmx
+++ b/kvmx
@@ -2026,7 +2026,13 @@ function kvmx_xrandr {
elif [ ! -z "$resolution" ]; then
mode="`echo $resolution | tr 'x' ' '`"
else
- local mode="`xrandr | grep '*+' | awk '{ print $1 }' | tr 'x' ' '`"
+ # Set resolution according to the current active screen
+ #local mode="`xrandr | grep '*+' | awk '{ print $1 }' | tr 'x' ' '`"
+
+ # 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' ' '`"
if [ ! -z "$resolution_y_offset" ]; then
local x="`echo $mode | awk '{ print $1 }'`"