Waybar
Waybar copied to clipboard
add Hyprland/windowcount module
Hyprland module to display the count of windows in the current workspace. E.g. if the current workspace (in this example, workspace 2) has 4 windows/clients opened:
This was requested in the following Reddit post, and also issue #672 (albeit for sway).
The windowcount module supports separate-outputs (i.e. "window count per monitor"), and was written based on the existing hyprland/window module. I'm not well-versed in c++ so there may be various rooms for improvements. Wiki documentation below.
Window Count
The windowcount module displays the number of windows in the current Hyprland workspace.
Configuration
Addressed by hyprland/windowcount.
| option | typeof | default | description |
|---|---|---|---|
format |
string | {} |
The format for how information should be displayed. On {}, the current workspace window count is displayed. |
format-empty |
string | Override the format when the workspace contains no windows. | |
format-windowed |
string | Override the format when the workspace contains no fullscreen windows. | |
format-fullscreen |
string | Override the format when the workspace contains a fullscreen window. | |
separate-outputs |
bool | true |
Show the active workspace window count of the monitor the bar belongs to, instead of the focused workspace. |
Example:
"hyprland/windowcount": {
"format": "[{}]",
"format-empty": "[X]",
"format-windowed": "[T]",
// "format-fullscreen": "[{}]",
"separate-outputs": true
}
Style
#windowcountwindow#waybar.empty #windowcountWhen no windows are in the workspacewindow#waybar.fullscreen #windowcountWhen there is a fullscreen window in the workspace; useful with Hyprland'sfullscreen, 1mode
Example:
/* Adding margin and padding */
#windowcount {
margin-left: 0px;
padding: 0px 5px;
}
/* Different background when empty */
window#waybar.empty #windowcount {
background: darkred;
}
/* Hide the windowcount module when not in windowed mode (i.e. not fullscreen) */
window#waybar:not(.fullscreen) #windowcount {
opacity: 0;
}