diff options
-rwxr-xr-x | kvmx | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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 |