waybar-custom(5)
π waybar-custom(5) β the custom module, bestie edition π
okay so this is the waybar-custom(5) page from the File Formats Manual β yes it's giving official, but I'm gonna walk you through it like we're texting at 2am π¦
β¨ NAME β¨
waybar β the custom module, periodt. π
πΈ DESCRIPTION πΈ
The custom module is the main character that displays either the output of a script or static text. no cap.
Wanna just show static text? iconic, then literally just specify the format field and you're done. π
π§ CONFIGURATION π§
You address this lil guy by custom/<name>. that's the vibe, that's the address, iykyk.
execβ typeof: string. The path to the script, which should be executed. πexec-ifβ typeof: string. The path to a script, which determines if the script inexecshould be executed.execwill be executed if the exit code ofexec-ifequals 0. π«Άhide-empty-textβ typeof: bool. Disables the module when output is empty, butformatmight contain additional static content.exec-on-eventβ typeof: bool, default:true. If an event command is set (e.g.on-clickoron-scroll-up) then re-execute the script after executing the event command. not me re-running everything, it's what it does bestie πreturn-typeβ typeof: string. See return-type. (yes it points you downstairs, go look π)intervalβ typeof: integer or float. The interval (in seconds) in which the information gets polled. Minimum value is0.001(1ms). Values smaller than 1ms will be set to 1ms. Useonceif you want to execute the module only on startup. You can update it manually with a signal. If nointervalorsignalis defined, it is assumed that the out script loops itself. If asignalis defined then the script will run once on startup and will only update with a signal. β°restart-intervalβ typeof: integer or float. The restart interval (in seconds). Minimum value is0.001(1ms). Values smaller than 1ms will be set to 1ms. Can't be used with theintervaloption, so only with continuous scripts. Once the script exits, it'll be re-executed after therestart-interval. πsignalβ typeof: integer. The signal number used to update the module. The number is valid between 1 and N, whereSIGRTMIN+N = SIGRTMAX. If nointervalis defined then a signal will be the only way to update the module. π‘formatβ typeof: string, default:{text}. The format, how information should be displayed. On{text}data gets inserted. π«format-iconsβ typeof: array. Based on the set percentage, the corresponding icon gets selected. The order is low to high. πrotateβ typeof: integer. Positive value to rotate the text label (in 90 degree increments). πmax-lengthβ typeof: integer. The maximum length in character the module should display.min-lengthβ typeof: integer. The minimum length in characters the module should accept.alignβ typeof: float. The alignment of the label within the module, where0is left-aligned and1is 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.on-clickβ typeof: string. Command to execute when clicked on the module. πon-click-middleβ typeof: string. Command to execute when middle-clicked on the module using mousewheel.on-click-rightβ typeof: string. Command to execute when you right-click on the module.on-updateβ typeof: string. Command to execute when the module is updated.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.tooltip-formatβ typeof: string. The tooltip format. If specified, overrides any tooltip output from the script inexec. Uses the same format replacements asformat. π«§escapeβ typeof: bool, default:false. Option to enable escaping of script output.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 typeGtkMenuwith idmenu.menu-actionsβ typeof: array. The actions corresponding to the buttons of the menu.expandβ typeof: bool, default:false. Enables this module to consume all left over space dynamically. it's hungry, let it eat π
π₯ 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 π¦
{text}β Output of the script.{percentage}β Percentage which can be set via a json return type.{icon}β An icon from'format-icons'according to percentage.
π EXAMPLES π
π§ Spotify
"custom/spotify": {
"format": " {text}",
"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",
"return-type": "json"
}
π΅ mpd
"custom/mpd": {
"format": "βͺ {text}",
//"max-length": 15,
"interval": 10,
"exec": "mpc current",
"exec-if": "pgrep mpd",
"on-click": "mpc toggle",
"on-click-right": "sonata"
}
πΆ cmus
"custom/cmus": {
"format": "βͺ {text}",
//"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": {
"format": "{text} ",
"interval": "once",
"exec": "pacman_packages",
"on-click": "update-system",
"signal": 8
}
π¦ Alternate Pacman
"custom/pacman": {
"format": "{text} ",
"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
}
Under the premise that interval is not defined, 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. (back downstairs again, bestie, it's a whole journey π)
reminder: this is the waybar-custom(5) page, dated 2026-02-08, from the File Formats Manual. go off, slay your bar config, and remember: every flag here is real, so don't make stuff up. mwah πβ¨
π¦ where this page comes from
- ubuntu resolute: waybar 0.15.0-1 Β· MIT
- ubuntu stonking: waybar 0.15.0-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms