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