From: Silvio Rhatto Date: Tue, 3 Oct 2017 14:26:46 +0000 (-0300) Subject: Detect resolution dynamically at kvmx_xephyr X-Git-Tag: 0.1.0~382 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=33a23a1cb3b9dffdbf6592089a17dafaabb7f5a6;p=kvmx.git Detect resolution dynamically at kvmx_xephyr --- 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