summaryrefslogtreecommitdiff
path: root/machi_status
blob: 72a9cc8fe9bfb6340d812de8af413c26a68a9f7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env sh
MODE=$1

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'