Skip to content
Wendy Plášková edited this page Nov 9, 2024 · 57 revisions

Workspaces

The workspaces module displays the currently used workspaces in hyprland compositor.

Configuration

Addressed by hyprland/workspaces

option typeof default description
active-only bool false If set to true only active workspace will be shown on bar. Unless a workspace is persistent, visible, or special. Otherwise all workspace groups are shown.
all-outputs bool false If set to false workspaces group will be shown only in assigned output. Otherwise all workspace groups are shown.
format string {id} The format, how information should be displayed.
format-icons object Based on the workspace name and state, the corresponding icon gets selected.
See Icons
persistent-workspaces json (see below) empty Lists workspaces that should always be shown, even when non existant.
show-special bool false If set to true, will display special workspaces alongside regular workspaces
special-visible-only bool false If this and show-special are to true, special workspaces will be shown only if visible.
sort-by string DEFAULT How to sort workspaces
window-rewrite object (see example) empty An object of regexes to match against window classes (and/or titles, see below and map to a new representation. Mapping firefox, for example.
window-rewrite-default string ? The default representation to be used when a window does not match any rules configured in window-rewrite.
format-window-separator string <space> The string used to separate window representations from eachother.
move-to-monitor bool false If set to true, open the workspace on the current monitor when clicking on a workspace button. Otherwise, the workspace will open on the monitor where it was previously assigned. Analog to using focusworkspaceoncurrentmonitor dispatcher instead of workspace in Hyprland.
ignore-workspaces array empty An array of regexes to match against workspace names. If there's a match, the workspace will be ignored and won't be shown in your bar.

Format replacements:

string replacement
{icon} Icon, as defined in format-icons.
{name} Name of workspace assigned by compositor.
{windows} All windows representations (ex. window icons) as configured by the user, separated by whichever separator the user configured.

Window Rewrite Rules

The rules are regexes that may match against class, title, or both in order to fine tune window representation. In order to understand them, let's break the possible rules in 4 categories:

How it appears in config Category
something Vague
class<something> Class-only
title<something> Title-only
class<something1> title<something2> Hybrid

When a user's config only contains "vague" rules, they will be used to match against windows classes. This is both for backwards compatibility and performance reasons: this feature originally supported only classes, since they usually don't change during a program's lifetime. When the title config was introduced, matching previously existing rules to both classes and titles wound cause a whole lot of "wrong" matches, so it's disabled by default. Additionally, matching against the title requires listening to window title changes via Hyprland's IPC, which is not necessary when not in use.

When the config contains at least one "title-only" or "hybrid" rewrite rule, then all of the "vague" rules will match against both class and title. Though confusing at first, this is in place to allow users to define vague rules, where it doesn't matter whether the class or title matched.

Examples that use all 4 categories are available below.

Icons:

Additional to workspace name matching, the following format-icons can be set.

port name note
active Will be shown when workspace is active
default Will be shown when no string matches is found.
empty Will be shown on active empty workspaces
persistent Will be shown on non-active persistent workspaces
special Will be shown on non-active special workspaces
urgent Will be shown on non-active urgent workspaces

Sort:

How to sort workspaces.

name note
default Default hyprland/workspaces sorting algorithm with custom prioritization
id Sort workspaces by id
name Sort workspaces by name
number Sort workspaces by number

Window Rewrite Example

"hyprland/workspaces": {
  "format": "<sub>{icon}</sub>\n{windows}",
  "format-window-separator": "\n",
  "window-rewrite-default": "",
  "window-rewrite": {
    "title<.*youtube.*>": "", // Windows whose titles contain "youtube"
    "class<firefox>": "", // Windows whose classes are "firefox"
    "class<firefox> title<.*github.*>": "", // Windows whose class is "firefox" and title contains "github". Note that "class" always comes first.
    "foot": "", // Windows that contain "foot" in either class or title. For optimization reasons, it will only match against a title if at least one other window explicitly matches against a title.
    "code": "󰨞",
	},
  ...
}
Screenshot

Persistent workspaces:

Each entry of persistent-workspace names a workspace that should always be shown. Associated with that value is a list of outputs indicating where the workspace should be shown, an empty list denoting all outputs

"hyprland/workspaces": {
    "persistent-workspaces": {
             "*": 5, // 5 workspaces by default on every monitor
             "HDMI-A-1": 3 // but only three on HDMI-A-1
       }
}
"hyprland/workspaces": {
    "persistent-workspaces": {
      "1": [
        "DP-3" // workspace 1 shown on DP-3
      ],
      "2": [
        "DP-1" // workspace 2 shown on DP-1
      ],
      "3": [
        "DP-1" // workspace 3 shown on DP-1
      ],
    }
}
"hyprland/workspaces": {
   "persistent-workspaces": {
      "DP-3": [ 1 ], // workspace 1 shown on DP-3
      "DP-1": [ 2, 3 ], // workspaces 2 and 3 shown on DP-1
    }
}

Example:

"hyprland/workspaces": {
	"format": "{name}: {icon}",
	"format-icons": {
		"1": "",
		"2": "",
		"3": "",
		"4": "",
		"5": "",
		"active": "",
		"default": ""
	},
       "persistent-workspaces": {
             "*": 5, // 5 workspaces by default on every monitor
             "HDMI-A-1": 3 // but only three on HDMI-A-1
       }
}

Style

  • #workspaces
  • #workspaces button
  • #workspaces button.active
  • #workspaces button.empty
  • #workspaces button.persistent
  • #workspaces button.special
  • #workspaces button.visible
  • #workspaces button.urgent
  • #workspaces button.hosting-monitor (gets applied if workspace-monitor == waybar-monitor)

The way the CSS is evaluated you need to order it in order of importance with last taking precedent.

Example:

This order makes it so that my priority of styling is special cases override the norm. If you wanted to include persistent in here, I'd throw it in before empty, personally.

image

Active Monitor: Green icon for active workspace. image

Inactive Monitor: Blue icon for visible but not active.


Window

The window module displays the title of the currently focused window of Hyprland, the Wayland compositor.

Configuration

Addressed by hyprland/window

option typeof default description
format string {title} The format, how information should be displayed. On {} the current window title is displayed.
rewrite object {} Rules to rewrite the module format output. The rules are identical to those for sway/window.
separate-outputs bool false Show the active window of the monitor the bar belongs to, instead of the focused window.
icon bool false Option to disable application icon.
icon-size integer 24 Set the size of application icon.

Format Replacements:

See the output of "hyprctl clients" for examples

string replacement
{class} The current class of the focused window.
{initialClass} The initial class of the focused window.
{initialTitle} The initial title of the focused window.
{title} The current title of the focused window.

Example:

"hyprland/window": {
    "format": "👉 {}",
    "rewrite": {
        "(.*) — Mozilla Firefox": "🌎 $1",
        "(.*) - fish": "> [$1]"
    },
    "separate-outputs": true
}

Style

  • #window

The following classes can apply styles to the entire Waybar (see the Sway module's page for more info):

  • window#waybar.empty When no windows are in the workspace
  • window#waybar.solo When one tiled window is visible in the workspace (floating windows may be present)
  • window#waybar.<app_id> Where <app_id> is the class (e.g. chromium) of the solo tiled window in the workspace (use hyprctl clients to see classes)
  • window#waybar.floating When there are only floating windows visible in the workspace
  • window#waybar.fullscreen When there is a fullscreen window in the workspace; useful with Hyprland's fullscreen, 1 mode
  • window#waybar.swallowing When there are hidden windows in the workspace; usually occurs due to window swallowing

Example:

This will change the color of the entire bar when either Chromium or kitty occupy the screen.

#window {
    border-radius: 20px;
    padding-left: 10px;
    padding-right: 10px;
}

window#waybar.kitty {
    background-color: #111111;
    color: #ffffff;
}

window#waybar.chromium {
    background-color: #eeeeee;
    color: #000000;
}

/* make window module transparent when no windows present */
window#waybar.empty #window {
    background-color: transparent;
}

Language

The language module displays the currently selected keyboard language (layout) for Hyprland, the Wayland compositor.

Configuration

Addressed by hyprland/language

option typeof default description
format string {} The format, how information should be displayed. On {} the current layout's full name is displayed.
format-<lang> string Provide an alternative name to display per language where is the language of your choosing. Can be passed multiple times with multiple languages as shown by the example below.
keyboard-name string Which keyboard to use, from the output of hyprctl devices. You should use the option that begins with "at-translated-set..."

Example:

"hyprland/language": {
    "format": "Lang: {}",
    "format-en": "AMERICA, HELL YEAH!",
    "format-tr": "As bayrakları",
    "keyboard-name": "at-translated-set-2-keyboard"
}

Style

  • #language

Example:

#language {
    border-radius: 20px;
    padding-left: 10px;
    padding-right: 10px;
}

Submap

The submap module displays the currently active submap similar to sway/mode for Hyprland, the Wayland compositor.

Configuration

Addressed by hyprland/submap

option typeof default description
format string {} The format, how information should be displayed. On {} the currently active submap is displayed.
max-length integer The maximum length in character the module should display.
on-click string Command to execute when clicked on the module.
on-click-middle string Command to execute when you middle clicked on the module using mousewheel.
on-click-right string Command to execute when you right clicked on the module.
on-scroll-up string Command to execute when scrolling up on the module.
on-scroll-down string Command to execute when scrolling down on the module.
rotate integer Positive value to rotate the text label.
smooth-scrolling-threshold double Threshold to be used when scrolling.
tooltip bool true Option to enable tooltip on hover.
always-on bool false Option to display the widget even when there's no active submap.
default-submap string Default Option to display the widget even when there's no active submap.

Example:

"hyprland/submap": {
    "format": "✌️ {}",
    "max-length": 8,
    "tooltip": false
}

Style

  • #submap
  • #submap.<name>
Clone this wiki locally