summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-05-01 10:24:18 +0200
committertv <tv@krebsco.de>2020-05-01 10:24:18 +0200
commit7603f9e568ffb5025027a0a433ba5bccb2951767 (patch)
tree35f17bef75f773938ada9c69012676fb80b066ad /krebs/5pkgs/simple
parent1feb294a75d4572d7772533e29ae9a28e636d095 (diff)
xwaitforwindow: init
Diffstat (limited to 'krebs/5pkgs/simple')
-rw-r--r--krebs/5pkgs/simple/xwaitforwindow.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/xwaitforwindow.nix b/krebs/5pkgs/simple/xwaitforwindow.nix
new file mode 100644
index 000000000..41ce65022
--- /dev/null
+++ b/krebs/5pkgs/simple/xwaitforwindow.nix
@@ -0,0 +1,15 @@
+{ writeDashBin, xdotool, xorg }:
+writeDashBin "xwaitforwindow" ''
+ # usage: xwaitforwindow ARGS
+ # see xdotool search for possible ARGS
+ # example: xwaitforwindow -name WINDOWNAME
+ set -efu
+
+ if id=$(${xdotool}/bin/xdotool search "$@"); then
+ printf 'waiting for window %#x\n' "$id" >&2
+ exec ${xorg.xprop}/bin/xprop -spy -id "$id" >/dev/null
+ else
+ printf 'no window found with xdotool search %s\n' "$*" >&2
+ exit 1
+ fi
+''