Skip to content
Robin edited this page Nov 12, 2018 · 5 revisions

Battery

The battery module displays the current capacity and state (eg. charging) of your battery.

Config

Addressed by battery

option typeof optional default description
bat string ✔️ The battery to monitor, as in /sys/class/power_supply/ instead of auto detect.
interval integer ✔️ 60 The interval in which the information gets polled.
states array ✔️ A number of battery states which get activated on certain capacity levels.
See States
format string ✔️ {capacity}% The format, how the time should be displayed.
format-icons array ✔️ Based on the current capacity, the corresponding icon gets selected.
The order is low to high.
max-length integer ✔️ The maximum length in character the module should display.
on-click string ✔️ Command to execute when 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.

Format replacements:

string replacement
{capacity} Capacity in percentage
{icon} Icon, as defined in format-icons.

Custom Formats:

The battery module allows to define custom formats based on up to two factors. The best fitting format will be selected.

format description
format-<state> With states, a custom format can be set depending on the capacity of your battery.
format-<status> With the status, a custom format can be set depending on the status in /sys/class/power_supply/<bat>/status (in lowercase).
format-<status>-<state> You can also set a custom format depending on both vaules.

States:

  • Every entry (state) consits of a <name> (typeof: string) and a <value> (typeof: integer).
    • The state can be adressed as a CSS class in the style.css. The name of the CSS class is the <name> of the state. Each class gets activated when the current capacity is equal or below the configured <value>.
    • Also each state can have its own format. Those con be configured via format-<name>. Or if you want to differntiate a bit more even as format-<status>-<state>. For more information see custom formats.

Example:

"battery": {
    "bat": "BAT2",
    "interval": 60,
    "states": {
        "warning": 30,
        "critical": 15
    },
    "format": "{capacity}% {icon}",
    "format-icons": ["", "", "", "", ""],
    "max-length": 25
}

Style

  • #battery
  • #battery.<status>
    • <status> is the value of /sys/class/power_supply/<bat>/status in lowercase.
  • #battery.<state>
    • <state> can be defined in the config. For more information see states
  • #battery.<status>.<state>
    • Combination of both <status> and <state>.

Clock

The clock module displays the current date and time.

Config

Addressed by clock

option typeof optional default description
interval integer ✔️ 60 The interval in which the information gets polled.
format string ✔️ {:%H:%M} The format, how the date and time should be 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-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.

For valid format options have a look here.

Example:

"cpu": {
    "interval": 60,
    "format": "{:%H:%M}",
    "max-length": 25
}

Style

  • #clock

CPU

The cpu module displays the current cpu utilization.

Config

Addressed by cpu

option typeof optional default description
interval integer ✔️ 10 The interval in which the information gets polled.
format string ✔️ {} The format, how information should be displayed. On {} data gets inserted.
max-length integer ✔️ The maximum length in character the module should display.
on-click string ✔️ Command to execute when 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.

Example:

"cpu": {
    "interval": 10,
    "format": "{}% ",
    "max-length": 10
}

Style

  • #cpu

Custom

The custom module displays the output of a script.

Config

Addressed by custom/<name>

option typeof optional default description
exec string The path to the script, which should be executed.
exec-if string ✔️ TThe path to an script, which determines if the script in exec should be executed.
exec will be executed if the exit code of exec-if equals 0.
return-type string ✔️ See return-type
interval integer ✔️ The interval in which the information gets polled.
If no interval is defined, it is assumed that the out script loops it self.
format string ✔️ {} The format, how information should be displayed. On {} data gets inserted.
max-length integer ✔️ The maximum length in character the module should display.
on-click string ✔️ Command to execute when 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.

Return-Type:

  • When return-type is set to json, Waybar expects the exec-script to output its data in JSON format. This should look like this: {"text": "$text", "tooltip": "$tooltip", "class": "$class"}
  • If nothing or an invalid option is specified Waybar expects i3blocks style output, where values are newline separated. This should look like this: $text\n$tooltip\n$class

class is an CSS-class, to apply different styles in style.css

Example:

"custom/spotify": {
    "format": " {}",
    "max-length": 40,
    "interval": 30, // Remove this if your script is endless and write in loop
    "exec": "$HOME/.config/waybar/mediaplayer.sh 2> /dev/null", // Script in resources folder
    "exec-if": "pgrep spotify"
}

Style

  • #custom-<name>
  • #custom-<name>.<class>
    • <class> can be set by the script. For more information see return-type

Memory

The memory module displays the current memory utilization.

Config

Addressed by memory

option typeof optional default description
interval integer ✔️ 30 The interval in which the information gets polled.
format string ✔️ {} The format, how information should be displayed. On {} data gets inserted.
max-length integer ✔️ The maximum length in character the module should display.
on-click string ✔️ Command to execute when 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.

Example:

"memory": {
    "interval": 30,
    "format": "{}% ",
    "max-length": 10
}

Style

  • #memory

Network

The network module displays information about the current network connections.

Config

Addressed by network

option typeof optional default description
interface string ✔️ Use the defined interface instead of auto detection.
format string ✔️ {ifname} The format, how information should be displayed.
This format is used when other formats aren't specified.
format-ethernet string ✔️ This format is used when a ethernet interface is displayed.
format-wifi string ✔️ This format is used when a wireless interface is displayed.
format-disconnected string ✔️ This format is used when the displayed interface is disconnected.
max-length integer ✔️ The maximum length in character the module should display.
on-click string ✔️ Command to execute when 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.

Format replacements:

string replacement
{ifname} Name of the network interface.
{essid} Name (SSID) of the wireless network.
{signalStrength} Signal strenth of the wireless network.

Example:

"network" {
    "interface": "wlp2s0",
    "format": "{ifname}",
    "format-wifi": "{essid} ({signalStrength}%) ",
    "format-ethernet": "{ifname} ",
    "format-disconnected": "", //An empty format will hide the module.
    "max-length": 50
}

Style

  • #network
  • #network.disconnected

PulseAudio

The pulseaudio module displays the current volume reported by PulseAudio.

Additionally you can control the volume by scrolling up or down while the cursor ist over the module.

Config

option typeof optional default description
interface string ✔️ Use the defined interface instead of auto detection.
format string ✔️ {volume}% The format, how information should be displayed.
This format is used when other formats aren't specified.
format-bluetooth string ✔️ This format is used when using bluetooth speakers.
format-muted string ✔️ This format is used when the sound is muted.
format-icons array ✔️ Based on the current port-name and volume, the corresponding icon gets selected.
The order is low to high. See Icons
max-length integer ✔️ The maximum length in character the module should display.
scroll-step integer ✔️ 1 The speed in which to change the volume when scrolling.
on-click string ✔️ Command to execute when clicked on the module.
on-scroll-up string ✔️ Command to execute when scrolling up on the module.
This replaces the default beaviour of volume control.
on-scroll-down string ✔️ Command to execute when scrolling down on the module.
This replaces the default beaviour of volume control.

Format replacements:

string replacement
{volume} Volume in percentage
{icon} Icon, as defined in format-icons.

Icons:

The folowing strings for format-icons are supported. If they are found in the current PulseAudio port name, the corresponding icons will be selected.

string note
default Will be shown, when no other port is found.
headphones
speaker
hdmi
headset
handsfree
portable
car
hifi
phone

Example:

"pulseaudio": {
    "format": "{volume}% {icon}",
    "format-bluetooth": "{volume}% {icon}",
    "format-muted": "",
    "format-icons": {
        "headphones": "",
        "handsfree": "",
        "headset": "",
        "phone": "",
        "portable": "",
        "car": "",
        "default": ["", ""]
    },
    "scroll-step": 1,
    "on-click": "pavucontrol"
}

Style

  • #pulseaudio
  • #pulseaudio.bluetooth
  • #pulseaudio.muted

Mode

The mode module displays the current binding mode of sway.

Config

Addressed by sway/mode

option typeof optional default description
format string ✔️ {} The format, how information should be displayed. On {} data gets inserted.
max-length integer ✔️ The maximum length in character the module should display.
on-click string ✔️ Command to execute when 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.

Example:

"sway/window" {
    "format": " {}",
    "max-length": 50
}

Style

  • #mode

Window

The window module displays the title of the currently focused window in sway.

Config

Addressed by sway/window

option typeof optional default description
format string ✔️ {} The format, how information should be displayed. On {} data gets inserted.
max-length integer ✔️ The maximum length in character the module should display.
on-click string ✔️ Command to execute when 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.

Example:

"sway/window" {
    "format": "{}",
    "max-length": 50
}

Style

  • #window

Workspaces

The workspaces module displays the currently used workspaces in sway.

Config

Addressed by sway/workspaces

option typeof optional default description
all-outputs bool ✔️ false If set to false, workspaces will only be shown on the output they are on.
If set to true all workspaces will be shown on every outout.
format string ✔️ {name} The format, how information should be displayed.
format-icons array ✔️ Based on the workspace name and staate, the corresponding icon gets selected.
See Icons
disable-scroll bool ✔️ false If set to false, you can scroll to cycle through workspaces.
If set to true this behaviour is disabled.

Format replacements:

string replacement
{name} Name of the workspace, as defined by sway
{icon} Icon, as defined in format-icons.
{index} Index of the workspace

Icons:

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

port name note
default Will be shown, when no string matches is found.
urgent Will be shown, when workspace is flaged as urgent
focused Will be shown, when workspace is focused

Example:

"sway/workspaces": {
    "disable-scroll": true,
    "all-outputs": true,
    "format": "{name}: {icon}",
    "format-icons": {
        "1": "",
        "2": "",
        "3": "",
        "4": "",
        "5": "",
        "urgent": "",
        "focused": "",
        "default": ""
    }
}

Style

  • #workspaces button
  • #workspaces button.visible
  • #workspaces button.focused
  • #workspaces button.urgent

Tray

⚠️ tray is still in beta. There may me bugs. Breaking changes may occur

Config

Addressed by sway/window

option typeof optional default description
icon-size integer ✔️ Defines the size of the tray icons.
spacing integer ✔️ Defines the spaacing between the tray icons.

Example:

"tray": {
    "icon-size": 21,
    "spacing": 10
}

Style

  • #tray

Clone this wiki locally