summaryrefslogtreecommitdiff
path: root/machi_status
diff options
context:
space:
mode:
authortslil <tslil@posteo.de>2026-06-20 13:24:46 +0100
committertslil <tslil@posteo.de>2026-06-20 13:24:49 +0100
commit20f47307c98e60d4adb80a78c732497b3c2df610 (patch)
tree958c0f01a36b494e992b630d5225974e1a424c00 /machi_status
parent69d56b37f5ed1aa6c1a5fd064f7d869bd07876b0 (diff)
machi_status: parameterise
Diffstat (limited to 'machi_status')
-rwxr-xr-xmachi_status15
1 files changed, 14 insertions, 1 deletions
diff --git a/machi_status b/machi_status
index cd962bd..72a9cc8 100755
--- a/machi_status
+++ b/machi_status
@@ -1,3 +1,16 @@
#!/usr/bin/env sh
+MODE=$1
-machictl -watch $WAYBAR_OUTPUT_NAME | jq --unbuffered -r '"W \(.current_workspace_index + 1)/\(.total_workspaces)|P \(.workspace_info.current_panel_index + 1)/\(.workspace_info.total_panels)|F \(.panel_info.total_windows)| \(.window_info.title | if length > 48 then .[0:48] + "..." else . end)"' | sed -u 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g'
+machictl -watch $WAYBAR_OUTPUT_NAME | jq --unbuffered --arg mode "$MODE" -r '
+ if $mode == "W" then
+ "W \(.current_workspace_index + 1)/\(.total_workspaces)"
+ elif $mode == "P" then
+ "P \(.workspace_info.current_panel_index + 1)/\(.workspace_info.total_panels)"
+ elif $mode == "F" then
+ "F \(.panel_info.total_windows)"
+ elif $mode == "T" then
+ (.window_info.title | if length > 48 then .[0:48] + "..." else . end)
+ else
+ "ERR"
+ end
+' | sed -u 's/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g'