aboutsummaryrefslogtreecommitdiff
path: root/kvmx
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-10-03 11:26:46 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-10-03 11:26:46 -0300
commit33a23a1cb3b9dffdbf6592089a17dafaabb7f5a6 (patch)
tree278b2ebad1e2732752fd4ef8ed0cde8a864866f3 /kvmx
parent46187fe284aebe3926ea85049d872353edc97b56 (diff)
downloadkvmx-33a23a1cb3b9dffdbf6592089a17dafaabb7f5a6.tar.gz
kvmx-33a23a1cb3b9dffdbf6592089a17dafaabb7f5a6.tar.bz2
Detect resolution dynamically at kvmx_xephyr
Diffstat (limited to 'kvmx')
-rwxr-xr-xkvmx15
1 files changed, 15 insertions, 0 deletions
diff --git a/kvmx b/kvmx
index 256bccb..1776d58 100755
--- a/kvmx
+++ b/kvmx
@@ -1075,8 +1075,23 @@ function kvmx_xephyr {
GUEST_DISPLAY="`cat $DISPLAYFILE`"
XDMCP_PORT="`cat $XDMCPPORTFILE`"
+ # Check for resolution configuration
if [ ! -z "$resolution" ]; then
resolution="-screen $resolution"
+ else
+ # Detect resolution dynamically
+ if which xwininfo &> /dev/null; then
+ resolution="`xwininfo -root | grep -- '-geometry' | cut -d '+' -f 1 | sed -e 's/-geometry//'`"
+
+ # Check for resolution_x_offset and resolution_y_offset configuration
+ if [ ! -z "$resolution_x_offset" ] || [ ! -z "$resolution_y_offset" ]; then
+ local width="`echo $resolution | cut -d 'x' -f 1`"
+ local height="`echo $resolution | cut -d 'x' -f 2`"
+ resolution="$(($width $resolution_x_offset))x$(($height $resolution_y_offset))"
+ fi
+
+ resolution="-screen $resolution"
+ fi
fi
if ! which Xephyr &> /dev/null; then