2019-08-26 13:42:59 +01:00
waybar-custom(5)
# NAME
waybar - custom module
# DESCRIPTION
The * custom * module displays either the output of a script or static text.
To display static text, specify only the * format * field.
# CONFIGURATION
Addressed by * custom/<name> *
* exec * : ++
typeof: string ++
The path to the script, which should be executed.
* exec-if * : ++
typeof: string ++
2023-07-30 17:33:02 +02:00
The path to a script, which determines if the script in *exec* should be executed. ++
2019-08-26 13:42:59 +01:00
*exec* will be executed if the exit code of *exec-if* equals 0.
2024-06-30 21:23:54 +02:00
* hide-empty-text * : ++
typeof: bool ++
Disables the module when output is empty, but format might contain additional static content.
2020-09-06 22:47:34 +03:00
* exec-on-event * : ++
typeof: bool ++
default: true ++
2023-07-30 17:33:02 +02:00
If an event command is set (e.g. *on-click* or *on-scroll-up*) then re-execute the script after executing the event command.
2020-09-06 22:47:34 +03:00
2019-08-26 13:42:59 +01:00
* return-type * : ++
typeof: string ++
See *return-type*
* interval * : ++
2025-08-16 15:29:59 -07:00
typeof: integer or float ++
2023-07-30 17:33:02 +02:00
The interval (in seconds) in which the information gets polled. ++
Use *once* if you want to execute the module only on startup. ++
2023-10-21 21:15:25 +05:30
You can update it manually with a signal. If no *interval* or *signal* is defined, it is assumed that the out script loops itself. ++
If a *signal* is defined then the script will run once on startup and will only update with a signal.
2019-08-26 13:42:59 +01:00
2020-03-25 22:30:22 +01:00
* restart-interval * : ++
2025-08-16 15:29:59 -07:00
typeof: integer or float ++
2023-07-30 17:33:02 +02:00
The restart interval (in seconds). ++
Can't be used with the *interval* option, so only with continuous scripts. ++
2023-10-21 21:15:25 +05:30
Once the script exits, it'll be re-executed after the *restart-interval*.
2020-03-25 22:25:27 +01:00
2019-08-26 13:42:59 +01:00
* signal * : ++
typeof: integer ++
2023-07-30 17:33:02 +02:00
The signal number used to update the module. ++
2023-09-19 14:52:48 -07:00
The number is valid between 1 and N, where *SIGRTMIN+N* = *SIGRTMAX*. ++
If no interval is defined then a signal will be the only way to update the module.
2019-08-26 13:42:59 +01:00
* format * : ++
typeof: string ++
2024-09-17 02:56:38 +02:00
default: {text} ++
The format, how information should be displayed. On {text} data gets inserted.
2019-08-26 13:42:59 +01:00
* format-icons * : ++
typeof: array ++
Based on the set percentage, the corresponding icon gets selected. The order is *low* to *high*.
* rotate * : ++
typeof: integer ++
2024-09-08 13:33:52 +02:00
Positive value to rotate the text label (in 90 degree increments).
2019-08-26 13:42:59 +01:00
* max-length * : ++
typeof: integer ++
The maximum length in character the module should display.
2021-02-01 08:34:51 -08:00
* min-length * : ++
2023-07-30 17:33:02 +02:00
typeof: integer ++
2023-10-21 21:15:25 +05:30
The minimum length in characters the module should accept.
2021-02-01 08:34:51 -08:00
* align * : ++
2023-07-30 17:33:02 +02:00
typeof: float ++
2024-03-04 20:00:57 +01:00
The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. If the module is rotated, it will follow the flow of the text.
* justify * : ++
typeof: string ++
The alignment of the text within the module's label, allowing options 'left', 'right', or 'center' to define the positioning.
2021-02-01 08:34:51 -08:00
2019-08-26 13:42:59 +01:00
* on-click * : ++
typeof: string ++
Command to execute when clicked on the module.
2019-12-28 20:21:03 -08:00
* on-click-middle * : ++
typeof: string ++
Command to execute when middle-clicked on the module using mousewheel.
2019-08-26 13:42:59 +01:00
* on-click-right * : ++
typeof: string ++
2023-10-21 21:15:25 +05:30
Command to execute when you right-click on the module.
2019-08-26 13:42:59 +01:00
2020-04-12 18:35:41 +02:00
* on-update * : ++
typeof: string ++
Command to execute when the module is updated.
2019-08-26 13:42:59 +01:00
* on-scroll-up * : ++
typeof: string ++
Command to execute when scrolling up on the module.
* on-scroll-down * : ++
typeof: string ++
Command to execute when scrolling down on the module.
* smooth-scrolling-threshold * : ++
typeof: double ++
Threshold to be used when scrolling.
* tooltip * : ++
typeof: bool ++
default: true ++
Option to disable tooltip on hover.
2024-02-16 15:26:36 +01:00
* tooltip-format * : ++
typeof: string ++
The tooltip format. If specified, overrides any tooltip output from the script in *exec*. ++
Uses the same format replacements as *format*.
2019-08-26 13:42:59 +01:00
* escape * : ++
typeof: bool ++
default: false ++
Option to enable escaping of script output.
2024-05-28 20:42:12 +02:00
* menu * : ++
typeof: string ++
Action that popups the menu.
* menu-file * : ++
typeof: string ++
Location of the menu descriptor file. There need to be an element of type
GtkMenu with id *menu*
* menu-actions * : ++
typeof: array ++
The actions corresponding to the buttons of the menu.
2024-10-30 17:04:13 +01:00
* expand * : ++
typeof: bool ++
default: false ++
Enables this module to consume all left over space dynamically.
2019-08-26 13:42:59 +01:00
# 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", "percentage": $percentage }
```
The * class * parameter also accepts an array of strings.
If nothing or an invalid option is specified, Waybar expects i3blocks style output. Values are * newline * separated.
This should look like this:
```
$text\\n$tooltip\\n$class*
```
* class * is a CSS class, to apply different styles in * style.css *
# FORMAT REPLACEMENTS
2024-09-17 02:56:38 +02:00
* {text} * : Output of the script.
2019-08-26 13:42:59 +01:00
2023-10-21 21:15:25 +05:30
* {percentage} * Percentage which can be set via a json return type.
2019-08-26 13:42:59 +01:00
* {icon} * : An icon from 'format-icons' according to percentage.
# EXAMPLES
## Spotify:
```
"custom/spotify": {
2024-09-17 02:56:38 +02:00
"format": " {text}",
2019-08-26 13:42:59 +01:00
"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
2022-02-02 00:01:18 -05:00
"exec-if": "pgrep spotify",
"return-type": "json"
2019-08-26 13:42:59 +01:00
}
```
## mpd:
```
"custom/mpd": {
2024-09-17 02:56:38 +02:00
"format": "♪ {text}",
2019-08-26 13:42:59 +01:00
//"max-length": 15,
"interval": 10,
"exec": "mpc current",
"exec-if": "pgrep mpd",
"on-click": "mpc toggle",
"on-click-right": "sonata"
}
```
## cmus:
```
"custom/cmus": {
2024-09-17 02:56:38 +02:00
"format": "♪ {text}",
2019-08-26 13:42:59 +01:00
//"max-length": 15,
"interval": 10,
"exec": "cmus-remote -C \"format_print '%a - %t'\"", // artist - title
"exec-if": "pgrep cmus",
"on-click": "cmus-remote -u", //toggle pause
"escape": true //handle markup entities
}
```
## Pacman
```
"custom/pacman": {
2024-09-17 02:56:38 +02:00
"format": "{text} ",
2019-08-26 13:42:59 +01:00
"interval": "once",
"exec": "pacman_packages",
"on-click": "update-system",
"signal": 8
}
```
## Alternate Pacman
```
"custom/pacman": {
2024-09-17 02:56:38 +02:00
"format": "{text} ",
2019-08-26 13:42:59 +01:00
"interval": 3600, // every hour
"exec": "checkupdates | wc -l", // # of updates
"exec-if": "exit 0", // always run; consider advanced run conditions
"on-click": "termite -e 'sudo pacman -Syu'; pkill -SIGRTMIN+8 waybar", // update system
"signal": 8
}
```
You can use the signal and update the number of available packages with * pkill -RTMIN+8 waybar * .
# STYLE
- * #custom-<name> *
- * #custom-<name>.<class> *
- * <class> * can be set by the script. For more information see * return-type *