aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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