summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs')
-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
+''