diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2018-11-15 11:18:15 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2018-11-15 11:18:15 -0200 |
commit | c3daff6a47ff0a64acc704003807fef21fd43413 (patch) | |
tree | 1ea34021b8282a694acceccd06b435d730befcbe | |
parent | 5d7ed814bc47dcf8aa81451a46b4356bdc337994 (diff) | |
download | kvmx-c3daff6a47ff0a64acc704003807fef21fd43413.tar.gz kvmx-c3daff6a47ff0a64acc704003807fef21fd43413.tar.bz2 |
XrandR: honor resolution and cli param
-rwxr-xr-x | kvmx | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1998,6 +1998,8 @@ function kvmx_shell { # Xrandr integration function kvmx_xrandr { + local size="$1" + if ! kvmx_running; then echo "$BASENAME: guest $VM is not running" exit 1 @@ -2009,13 +2011,20 @@ function kvmx_xrandr { fi if echo which xrandr | kvmx_ssh &> /dev/null; then - local mode="`xrandr | grep '*+' | awk '{ print $1 }' | tr 'x' ' '`" + # Check for resolution configuration or explicit param + if [ ! -z "$size" ]; then + mode="`echo $size | tr 'x' ' '`" + elif [ ! -z "$resolution" ]; then + mode="`echo $resolution | tr 'x' ' '`" + else + local mode="`xrandr | grep '*+' | awk '{ print $1 }' | tr 'x' ' '`" - if [ ! -z "$resolution_y_offset" ]; then - local x="`echo $mode | awk '{ print $1 }'`" - local y="`echo $mode | awk '{ print $2 }'`" + if [ ! -z "$resolution_y_offset" ]; then + local x="`echo $mode | awk '{ print $1 }'`" + local y="`echo $mode | awk '{ print $2 }'`" - mode="$x $(($y $resolution_y_offset))" + mode="$x $(($y $resolution_y_offset))" + fi fi if [ -z "$xrandr_device" ]; then |