Add Waybar workspace module with per-workspace window count#6136
Add Waybar workspace module with per-workspace window count#6136sullivan-assie wants to merge 1 commit into
Conversation
Replace the default hyprland/workspaces module with a custom module that shows each workspace number followed by a superscript badge of its window count, highlights the active workspace, and updates live via the Hyprland IPC socket (socat). Empty/persistent workspaces render without a badge. Both jq and socat are already in install/omarchy-base.packages, and streaming .socket2.sock via socat mirrors the existing pattern in bin/omarchy-hyprland-monitor-watch, so no new dependencies are introduced.
There was a problem hiding this comment.
Pull request overview
This PR replaces Waybar’s built-in hyprland/workspaces module with a custom script-backed module that renders workspace numbers with a superscript window-count badge, and refreshes on Hyprland .socket2.sock events (no polling).
Changes:
- Add
default/waybar/workspace-windows.shto render workspaces + per-workspace window counts and repaint on relevant Hyprland IPC events. - Update
config/waybar/config.jsoncto swaphyprland/workspacesforcustom/workspace-windows, including scroll-to-switch workspace bindings.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| default/waybar/workspace-windows.sh | New Waybar custom-module script that formats workspace labels with superscript window-count badges and listens to Hyprland socket events for live updates. |
| config/waybar/config.jsonc | Switches Waybar’s left modules to use the new custom/workspace-windows module and configures execution/scroll behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Map "id -> window count" for normal (id >= 1) workspaces. | ||
| declare -A counts=() | ||
| while read -r id win; do | ||
| [[ "$id" =~ ^[0-9]+$ ]] && (( id >= 1 )) && counts[$id]=$win |
|
|
||
| # Show up to the highest populated/active workspace, but at least MIN_WS. | ||
| for id in "${!counts[@]}"; do (( id > max )) && max=$id; done | ||
| [[ "$active" =~ ^[0-9]+$ ]] && (( active > max )) && max=$active |
| c=${counts[$ws]:-0} | ||
| label="$ws" | ||
| (( c > 0 )) && label+="$(to_super "$c")" | ||
| if [[ "$ws" == "$active" ]]; then |
|
I was thinking about this yesterday when I lost track of my windows. Definitely needs a theming approach though, since hard coding those styles will not appeal to everyone. |
|
A kind heads-up :) The upcoming Omarchy 4 release moves away from Waybar in favour of a new quickshell based solution. |

What
Replaces the default
hyprland/workspacesmodule with a custom Waybar modulethat shows each workspace number followed by a superscript badge of its window
count, highlights the active workspace, and updates instantly via the Hyprland
IPC socket.
MIN_WS=5workspaces are always shown, matching the currentpersistent-workspacesdefault..socket2.sockevents (workspace/window/monitorchanges) — no polling.
Why
The number badge gives an at-a-glance sense of where your windows are without
opening each workspace, while keeping the bar compact.
Dependencies
None added. Both
jqandsocatare already declared ininstall/omarchy-base.packages, and streaming.socket2.sockthroughsocatmirrors the existing pattern in
bin/omarchy-hyprland-monitor-watch.Trade-offs / open questions (happy to adjust)
custommodule renders a single label, soindividual workspace numbers are not clickable. Mouse-wheel scroll over the
module switches workspaces (
workspace e-1/e+1); the native module'sclick-to-activate-a-specific-workspace is not preserved. If keeping per-WS
click is a requirement, the alternative is the native module with
window-rewrite(shows per-window app icons instead of a count).#ff3b30). Since a custommodule can't reference theme CSS colors per-segment via Pango, I kept it
inline — open to a better theme-aware approach if you have a preferred one.
Testing
Tested on Hyprland (Waybar v0.15.0): badge counts track window open/close/move
across workspaces, the active workspace highlight follows focus, and scroll
switches workspaces.
🤖 Generated with Claude Code