#!/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/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g'