summaryrefslogtreecommitdiff
path: root/app/xlockmore/etc/xwinlock.sh
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-26 11:09:41 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-26 11:09:41 +0000
commit95c2d1cbda23a41cdf6e63520c7f0b825e63dd5b (patch)
tree06d3ffa4312e568c4157f69fe1bddaddec9bc497 /app/xlockmore/etc/xwinlock.sh
parent3928433848e2d6a9356f3d438a14b32a4f87f660 (diff)
Importing xlockmore 5.22
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}'` "$@"