summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-03-29 20:17:53 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-03-29 20:26:08 +0200
commita78fb9a3f64de0c4495dcbfb7498ca5bdf4f6b40 (patch)
treea13dcf1f680af44e0bad84cc9b0ab43cf17d2b68
parent5334fe011840002bbd5ec86b3e361c73e73a3a50 (diff)
downloadimpressive-display-a78fb9a3f64de0c4495dcbfb7498ca5bdf4f6b40.tar.gz
impressive-display-a78fb9a3f64de0c4495dcbfb7498ca5bdf4f6b40.tar.bz2
impressive-display-a78fb9a3f64de0c4495dcbfb7498ca5bdf4f6b40.zip
Support existing impressive-display via exiting impressive (Q hotkey). Furthermore, make sure to kill impressive only, if it its PID still exists.
-rw-r--r--debian/changelog3
-rwxr-xr-ximpressive-display/bin/impressive-display10
2 files changed, 10 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index 50c3021..1ff3763 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -5,6 +5,9 @@ impressive-display (0.2.1) UNRELEASED; urgency=medium
* Disable debugging option (set -x).
* Use $HOME/.impressive-display as temporary data directory.
* Check downloaded PDF for actually being a PDF file.
+ * Support existing impressive-display via exiting impressive (Q hotkey).
+ Furthermore, make sure to kill impressive only, if it its PID still
+ exists.
-- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Tue, 29 Mar 2016 20:14:17 +0200
diff --git a/impressive-display/bin/impressive-display b/impressive-display/bin/impressive-display
index 4ba691d..c14b5f5 100755
--- a/impressive-display/bin/impressive-display
+++ b/impressive-display/bin/impressive-display
@@ -294,13 +294,17 @@ function reloadable_impressive {
impressive ${IMPRESSIVE_OPTIONS} --fake-fullscreen --wrap -a ${SLIDE_DURATION} --nologo "${pdffile}" 1>/dev/null &
impressive_pid=$!
- echo -n $impressive_pid > "$impressive_lock"
+ echo -n "$impressive_pid" > "$impressive_lock"
- while [ "$(cat $impressive_lock)" != "RELOAD" ] && [ -e "$session_lock" ]; do
+ while [ -r $impressive_lock ] && [ "$(cat $impressive_lock)" != "RELOAD" ] && [ -e "$session_lock" ]; do
sleep 1
+ if ! kill -0 "$impressive_pid"; then
+ rm "$session_lock"
+ break
+ fi
done
- kill $impressive_pid
+ kill -0 "$impressive_pid" && kill "$impressive_pid"
done