diff options
| author | David Moc <personal@cdatgoose.org> | 2026-05-24 11:48:07 +0200 |
|---|---|---|
| committer | David Moc <personal@cdatgoose.org> | 2026-05-24 11:48:07 +0200 |
| commit | 5fb19f10389b70ee2389755106092a9ef6c64598 (patch) | |
| tree | 969eb0466de581cb14aa09f751a95138620fc720 /polybar/scripts/scratchpad-status.sh | |
Go
Diffstat (limited to 'polybar/scripts/scratchpad-status.sh')
| -rwxr-xr-x | polybar/scripts/scratchpad-status.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/polybar/scripts/scratchpad-status.sh b/polybar/scripts/scratchpad-status.sh new file mode 100755 index 0000000..426d3b2 --- /dev/null +++ b/polybar/scripts/scratchpad-status.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +if ! command -v i3-msg >/dev/null 2>&1 || ! command -v jq >/dev/null 2>&1; then + echo "n/a" + exit 0 +fi + +count="$( + i3-msg -t get_tree 2>/dev/null | + jq '[.. | objects | select(.name == "__i3_scratch") | .floating_nodes[]?] | length' 2>/dev/null || printf '0' +)" + +if [ "$count" -gt 0 ] 2>/dev/null; then + echo "%{F#d79921}$count%{F-}" +else + echo "0" +fi |
