]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Set screen resolution depending on which screen the spice session is currently located
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 13 May 2019 02:31:10 +0000 (23:31 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 13 May 2019 02:31:10 +0000 (23:31 -0300)
IDEAS.md
kvmx

index d79f69d9b9f86370ea1435e995d77a1814e5f50e..bf9f47aa8b24efab78c8d0283d119be7296f3adf 100644 (file)
--- a/IDEAS.md
+++ b/IDEAS.md
@@ -1,6 +1,5 @@
 # Ideas
 
-* Set screen resolution depending on which display the spice session is at `xrandr` action.
 * LVM support at `kvmx-create`, with optional LUKS support for the whole volume.
 * Additional way to handle missing image on `kvmx up` by spawning `kvmx_install` instead of `kvmx-create`.
 * Fix isolinux support:
diff --git a/kvmx b/kvmx
index 2134e82c542d5710ab9bbf1fe08eda6815ce4326..f86add827276923aeb5db71c78f43610a67c06f8 100755 (executable)
--- 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 }'`"