Waybar

Highly customizable Wayland bar for Sway, hyprland and Wlroots based compositors.

Screenshot

Configuration

The configuration uses the JSON file format and is named config.

Valid directories for this file are:

  • ~/.config/waybar/
  • ~/waybar/
  • /etc/xdg/waybar/

A good starting point is the default config.

Bar Config

optiontypeofdefaultdescription
layerstringbottomDecide if the bar is displayed in front (top) of the windows or behind (bottom) them.
outputstringarray
positionstringtopBar position, can be top,bottom,left,right.
heightintegerHeight to be used by the bar if possible, leave blank for a dynamic value.
widthintegerWidth to be used by the bar if possible, leave blank for a dynamic value.
modules-leftarrayModules that will be displayed on the left.
modules-centerarrayModules that will be displayed in the center.
modules-rightarrayModules that will be displayed on the right.
marginstringMargins value using the css format without units.
margin-<top|left|bottom|right>integerMargins value without units.
spacinginteger4Size of gaps in between of the different modules.
namestringOptional name added as a CSS class, for styling multiple waybars.
modestringSelects one of the preconfigured display modes. This is an equivalent of the sway-bar(5) mode command and supports the same values: dock, hide, invisible, overlay.
Note: hide and invisible modes may be not as useful without Sway IPC.
start_hiddenboolfalseOption to start the bar hidden.
modifier-resetstringpressDefines the timing of modifier key to reset the bar visibility. To reset the visibility of the bar with the press of the modifier key use press. Use release to reset the visibility upon the release of the modifier key and only if no other action happened while the key was pressed. This prevents hiding the bar when the modifier is used to switch a workspace, change binding mode or start a keybinding.
exclusivebooltrueOption to request an exclusive zone from the compositor. Disable this to allow drawing application windows underneath or on top of the bar.
Disabled by default for overlay layer.
fixed-centerbooltruePrefer fixed center position for the modules-center block. The center block will stay in the middle of the bar whenever possible. It can still be pushed around if other blocks need more space.
When false, the center block is centered in the space between the left and right block.
passthroughboolfalseOption to pass any pointer events to the window under the bar.
Intended to be used with either top or overlay layers and without exclusive zone.
Enabled by default for overlay layer.
gtk-layer-shellbooltrueOption to disable the use of gtk-layer-shell for popups. Only functional if compiled with gtk-layer-shell support.
ipcboolfalseOption to subscribe to the Sway IPC bar configuration and visibility events and control waybar with swaymsg bar commands.
Requires bar_id value from sway configuration to be either passed with the -b commandline argument or specified with the id option.
See #1244 for the documentation and configuration examples.
idstringbar_id for the Sway IPC. Use this if you need to override the value passed with the -b bar_id commandline argument for the specific bar instance.
includearrayPaths to additional configuration files.
Each file can contain a single object with any of the bar configuration options. In case of duplicate options, the first defined value takes precedence, i.e. including file first included file etc. Nested includes are permitted, but make sure to avoid circular imports.
For a multi-bar config, the include directive affects only current bar configuration object.

Multiple instances of a module

If you want to have a second instance of a module, you can suffix it by a ’#’ and a custom name.

For example if you want a second battery module, you can add "battery#bat2" to your modules.

To configure the newly added module, you then also add a module configuration with the same name.

This could then look something like this (this is an incomplete example):

"modules-right": ["battery", "battery#bat2"],
"battery": {
    "bat": "BAT1"
},
"battery#bat2": {
    "bat": "BAT2"
}

To style in styles.css use :

battery.bat2 {
    border-bottom: 2px solid #FFFFFF;
}

Styling

Styling is done using the CSS file format and with a file named style.css.

Valid directories for this file are:

  • ~/.config/waybar/
  • ~/waybar/
  • /etc/xdg/waybar/

A good starting point is the default style.

Modules