From 5fb19f10389b70ee2389755106092a9ef6c64598 Mon Sep 17 00:00:00 2001 From: David Moc Date: Sun, 24 May 2026 11:48:07 +0200 Subject: Go --- polybar/scripts/scratchpad-status.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 polybar/scripts/scratchpad-status.sh (limited to 'polybar/scripts/scratchpad-status.sh') 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 -- cgit v1.2.3