aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-11-15 11:18:15 -0200
committerSilvio Rhatto <rhatto@riseup.net>2018-11-15 11:18:15 -0200
commitc3daff6a47ff0a64acc704003807fef21fd43413 (patch)
tree1ea34021b8282a694acceccd06b435d730befcbe
parent5d7ed814bc47dcf8aa81451a46b4356bdc337994 (diff)
downloadkvmx-c3daff6a47ff0a64acc704003807fef21fd43413.tar.gz
kvmx-c3daff6a47ff0a64acc704003807fef21fd43413.tar.bz2
XrandR: honor resolution and cli param
-rwxr-xr-xkvmx19
1 files changed, 14 insertions, 5 deletions
diff --git a/kvmx b/kvmx
index 0420211..8e00fc1 100755
--- a/kvmx
+++ b/kvmx
@@ -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