aboutsummaryrefslogtreecommitdiffstats
path: root/bin/udt-steps
diff options
context:
space:
mode:
Diffstat (limited to 'bin/udt-steps')
-rwxr-xr-xbin/udt-steps36
1 files changed, 36 insertions, 0 deletions
diff --git a/bin/udt-steps b/bin/udt-steps
new file mode 100755
index 0000000..da4aca0
--- /dev/null
+++ b/bin/udt-steps
@@ -0,0 +1,36 @@
+#!/bin/bash
+# udt-steps: hand a consumer's pending manual steps to the steps window.
+# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+# Licensed under the GNU General Public License v2 only.
+#
+# Usage: <producer> | udt-steps NAME
+#
+# stdin becomes the NAME tab of quickshell's steps window, one file per
+# consumer under ~/.cache/udt/steps/. Empty stdin clears the tab: a consumer
+# that is up to date has nothing to ask for. Either way the running shell is
+# poked over IPC, which reloads the tabs and opens the window when any remain.
+#
+# Format: a line indented two spaces is a command, and a run of them is one
+# block with its own copy button. Everything else is prose. So the root
+# commands producers already printed for a terminal read the same here.
+
+name="${1:?usage: udt-steps NAME}"
+case "$name" in
+ *[!a-z0-9-]*) echo "udt-steps: bad name '$name'" >&2; exit 2 ;;
+esac
+
+dir="$HOME/.cache/udt/steps"
+mkdir -p "$dir"
+text="$(cat)"
+if [ -z "$text" ]; then
+ rm -f "$dir/$name"
+else
+ # Atomic, so the shell never reads half a file.
+ printf '%s\n' "$text" > "$dir/.$name.tmp" && mv "$dir/.$name.tmp" "$dir/$name"
+fi
+
+repo="$(dirname "$(readlink -f "$0")")/.."
+qs_dir="$(realpath -m "$repo/../quickshell/appearance")"
+[ -f "$qs_dir/shell.qml" ] && command -v qs >/dev/null 2>&1 &&
+ timeout 5 qs -p "$qs_dir" ipc call appearance steps >/dev/null 2>&1
+exit 0