diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2022-12-29 00:03:19 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2022-12-29 00:03:19 -0300 |
commit | ad56fb9e35d6192270ba6cbb9ac17228bd9466e3 (patch) | |
tree | b0c991f1df8e5392dc8f790a9c325883b4b76b5d | |
parent | 850c18621f5ca28ec62815db61abc8afd86a9d2f (diff) | |
download | kvmx-ad56fb9e35d6192270ba6cbb9ac17228bd9466e3.tar.gz kvmx-ad56fb9e35d6192270ba6cbb9ac17228bd9466e3.tar.bz2 |
Fix: xrandr: switch to a pure xdotool approach
-rwxr-xr-x | kvmx | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -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 }'`" |