Waybar

From Gentoo Wiki
Jump to:navigation Jump to:search
This article is a stub. Please help out by expanding it - how to get started.

Waybar is a status bar for Wayland compositors.

Installation

USE flags

USE flags for gui-apps/waybar Highly customizable Wayland bar for Sway and Wlroots based compositors

evdev Enable libevdev support for evdev related features
experimental Enable experimental features, such as Bluetooth battery reporting
jack Add support for the JACK Audio Connection Kit
libinput Enable libinput support for libinput related features
logind Enable support for logind (bluetooth and idle inhibit)
mpd Enable support for the Music Player Daemon
mpris Enable support for mpris
network Enable libnl support for network related features
pipewire Enable support for pipewire
popups Enable popup support with gtk-layer-shell
pulseaudio Enable support for volume control via PulseAudio
sndio Enable support for volume control via sndio
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
tray Enable support for tray
udev Enable virtual/udev integration (device discovery, power and storage device support, etc)
upower Enable power management support
wifi Enable support for wifi/rfkill

Emerge

root #emerge --ask gui-apps/waybar

Configuration

To view all available configuration options:

user $man 5 waybar

Files

Example config and style.css files are provided in the /etc/xdg/waybar/ directory:

user $mkdir -p ~/.config/waybar/
user $cp /etc/xdg/waybar/config ~/.config/waybar/
user $cp /etc/xdg/waybar/style.css ~/.config/waybar/

Icons

To utilise Font Awesome icons, install the media-fonts/fontawesome package.

The simplest way to use the icons is to set the font-family property in style.css, specifying "Font Awesome 6 Free" after the preferred font for text, e.g.:

FILE ~/.config/waybar/style.cssAdd support for Font Awesome icons
* {
    font-family: "Gentium Plus", "Font Awesome 6 Free", serif;
}

However, this will not always result in the desired behaviour for all Waybar modules. In particular, it will result in icons not displaying properly in some modules: the icons can be made to display by reversing the order of values of the font-family property for a module, but that will result in Font Awesome being used for non-icon text as well.

An approach to address these issues via fontconfig was described in this comment on the relevant Waybar issue. Firstly, if ~/.config/fontconfig/fonts.conf does not already exist, create it with the following contents:

FILE ~/.config/fontconfig/fonts.confAdd font family alias for Font Awesome icons
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <alias>
    <family>icon</family>
    <prefer>
      <family>Font Awesome 6 Free</family>
    </prefer>
  </alias>
</fontconfig>

Otherwise, add the above alias element subtree within the fontconfig element in the existing file.

Then, each icon in the config file should be wrapped in span font='icon' tags, e.g.:

"format": "<span font='icon'></span> {usage:2}%"

or

"format": "<span font='icon'>{icon}</span> {capacity}%"

Finally, the font-family property in style.css should be set to only the font(s) for non-icon text, e.g.:

* {
    font-family: "Gentium Plus";
}

After restarting Waybar, both icons and non-icon text should now be displayed appropriately.

Applying configuration changes

Modifications to the style.css file, once saved, can be applied by sending the Waybar process a SIGUSR2 signal, e.g. pkill -SIGUSR2 waybar. However, modifications to the config file can only be applied by restarting the Waybar process.

See also