aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-05-01 14:29:51 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-05-01 14:29:51 -0300
commit13babe75745101bf5ba462e694b2d578ced0e2cc (patch)
treee3ef8e95c2782c2b17aedf549b3a0bc242c468d2
parentf3ad4e5c300a5ea9d010ee40554f4a641ec9bb87 (diff)
downloadkvmx-13babe75745101bf5ba462e694b2d578ced0e2cc.tar.gz
kvmx-13babe75745101bf5ba462e694b2d578ced0e2cc.tar.bz2
Adds kvmx_xephyr_stop
-rwxr-xr-xkvmx19
1 files changed, 18 insertions, 1 deletions
diff --git a/kvmx b/kvmx
index 4509a6d..9e5f288 100755
--- a/kvmx
+++ b/kvmx
@@ -161,6 +161,7 @@ function __kvmx_initialize {
SSHFILE="$STATE_DIR/ssh"
DISPLAYFILE="$STATE_DIR/display"
SPICEFILE="$STATE_DIR/spice"
+ XEPHYRFILE="$STATE_DIR/xephyr"
LOGFILE="$LOG_DIR/qemu"
SPICELOG="$LOG_DIR/spice"
XPRALOG="$LOG_DIR/xpra"
@@ -526,6 +527,7 @@ function kvmx_poweroff {
fi
echo /usr/bin/sudo poweroff | kvmx_ssh &> /dev/null
+ kvmx_xephyr_stop
sleep 3
kvmx_status
}
@@ -556,6 +558,7 @@ function kvmx_hibernate {
echo "Unable to hibernate guest: please check guest configuration"
exit 1
else
+ kvmx_xephyr_stop
kvmx_status
fi
}
@@ -747,6 +750,7 @@ function kvmx_stop {
if kvmx_running; then
PID="`cat $PIDFILE`"
kill $PID
+ kvmx_xephyr_stop
fi
}
@@ -755,6 +759,7 @@ function kvmx_kill {
if kvmx_running; then
PID="`cat $PIDFILE`"
kill -9 $PID
+ kvmx_xephyr_stop
fi
}
@@ -957,12 +962,15 @@ function kvmx_xephyr {
Xephyr :$GUEST_DISPLAY -ac -port $XDMCP_PORT -query 127.0.0.1 $resolution &> $XDMCPLOG < /dev/null &
+ XEPHYRPID="$!"
+ echo "$XEPHYRPID" > $XEPHYRFILE
+
# Give time to connect
sleep 1
# Set keyboard layout
# Thanks https://unix.stackexchange.com/questions/304391/xephyr-keyboard-mapping-not-working-properly
- setxkbmap -display :0 -print | xkbcomp - :$GUEST_DISPLAY >> $XDMCPLOG
+ setxkbmap -display :0 -print | xkbcomp - :$GUEST_DISPLAY &> /dev/null
# Fix window titles
if which /usr/bin/xdotool &> /dev/null; then
@@ -970,6 +978,15 @@ function kvmx_xephyr {
fi
}
+# Close Xephyr client
+function kvmx_xephyr_stop {
+ XEPHYRPID="`cat $XEPHYRFILE`"
+
+ if [ ! -z "$XEPHYRPID" ]; then
+ kill $XEPHYRPID &> /dev/null
+ fi
+}
+
# Dispatch
if type kvmx_$ACTION 2> /dev/null | grep -q 'function'; then
__kvmx_initialize