From 33a23a1cb3b9dffdbf6592089a17dafaabb7f5a6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Tue, 3 Oct 2017 11:26:46 -0300 Subject: Detect resolution dynamically at kvmx_xephyr --- kvmx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- cgit v1.2.3