summaryrefslogtreecommitdiff
path: root/app/xlockmore/etc/xwinlock.sh
diff options
context:
space:
mode:
Diffstat (limited to 'app/xlockmore/etc/xwinlock.sh')
-rw-r--r--app/xlockmore/etc/xwinlock.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/app/xlockmore/etc/xwinlock.sh b/app/xlockmore/etc/xwinlock.sh
new file mode 100644
index 000000000..aee774404
--- /dev/null
+++ b/app/xlockmore/etc/xwinlock.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# Runs xlock displaying in another X client's window.
+# use -me to use current terminal emulator window (works in ddterm).
+# use -id <windowid> to display to a specific window.
+# Otherwise select the target window with the cross-hair cursor.
+#
+# All other arguments are passed to xlock.
+
+case $1 in
+-me)if [ "$WINDOWID" ]; then id="-id $WINDOWID"; shift
+ else echo >&2 "WINDOWID not set"; exit 1; fi;;
+-id)if [ $# -gt 1 ]; then id="-id $2"; shift; shift
+ else echo >&2 "ID not specified"; exit 1; fi;;
+esac
+exec xlock +install -inwindow -parent `xwininfo $id -int |
+ awk '/Window id/{printf "%d", $4};
+ /Width/{printf " -geometry %d", $2};
+ /Height/{printf "x%d", $2}'` "$@"