#!/bin/bash # 需安裝 jq get_workspaces() { swaymsg -t get_workspaces | jq -c 'sort_by(.num)' } # 初始輸出 get_workspaces # 監聽事件並更新 swaymsg -t subscribe '["workspace"]' -m | while read -r line; do get_workspaces done