1waybar-custom(5)              File Formats Manual             waybar-custom(5)
2
3
4

NAME

6       waybar - custom module
7

DESCRIPTION

9       The custom module displays either the output of a script or static
10       text. To display static text, specify only the format field.
11

CONFIGURATION

13       Addressed by custom/<name>
14
15       exec:
16            typeof: string
17            The path to the script, which should be executed.
18
19       exec-if:
20            typeof: string
21            The path to a script, which determines if the script in exec
22       should be executed.
23           exec will be executed if the exit code of exec-if equals 0.
24
25       exec-on-event:
26            typeof: bool
27            default: true
28            If an event command is set (e.g. on-click or on-scroll-up) then
29       re-execute the script after
30           executing the event command.
31
32       return-type:
33            typeof: string
34            See return-type
35
36       interval:
37            typeof: integer
38            The interval (in seconds) in which the information gets polled.
39           Use once if you want to execute the module only on startup. You can
40           update it manually with a signal. If no interval is defined, it is
41           assumed that the out script loops it self.
42
43       restart-interval:
44            typeof: integer
45            The restart interval (in seconds).
46           Can't be used with the interval option, so only with continuous
47           scripts. Once the script exit, it'll be re-executed after the
48           restart-interval.
49
50       signal:
51            typeof: integer
52            The signal number used to update the module.
53           The number is valid between 1 and N, where SIGRTMIN+N = SIGRTMAX.
54
55       format:
56            typeof: string
57            default: {}
58            The format, how information should be displayed. On {} data gets
59       inserted.
60
61       format-icons:
62            typeof: array
63            Based on the set percentage, the corresponding icon gets selected.
64       The order is low to high.
65
66       rotate:
67            typeof: integer
68            Positive value to rotate the text label.
69
70       max-length:
71            typeof: integer
72            The maximum length in character the module should display.
73
74       on-click:
75            typeof: string
76            Command to execute when clicked on the module.
77
78       on-click-middle:
79            typeof: string
80            Command to execute when middle-clicked on the module using mouse‐
81       wheel.
82
83       on-click-right:
84            typeof: string
85            Command to execute when you right clicked on the module.
86
87       on-update:
88            typeof: string
89            Command to execute when the module is updated.
90
91       on-scroll-up:
92            typeof: string
93            Command to execute when scrolling up on the module.
94
95       on-scroll-down:
96            typeof: string
97            Command to execute when scrolling down on the module.
98
99       smooth-scrolling-threshold:
100            typeof: double
101            Threshold to be used when scrolling.
102
103       tooltip:
104            typeof: bool
105            default: true
106            Option to disable tooltip on hover.
107
108       escape:
109            typeof: bool
110            default: false
111            Option to enable escaping of script output.
112

RETURN-TYPE

114       When return-type is set to json, Waybar expects the exec-script  to
115       output its data in JSON format. This should look like this:
116
117           {"text": "$text", "tooltip": "$tooltip", "class": "$class", "percentage": $percentage }
118
119       The class parameter also accepts an array of strings.
120
121       If nothing or an invalid option is specified, Waybar expects i3blocks
122       style output. Values are newline separated. This should look like this:
123
124           $text\n$tooltip\n$class*
125
126       class is a CSS class, to apply different styles in style.css
127

FORMAT REPLACEMENTS

129       {}: Output of the script.
130
131       {percentage} Percentage which can be set via a json return-type.
132
133       {icon}: An icon from 'format-icons' according to percentage.
134

EXAMPLES

136   Spotify:
137           "custom/spotify": {
138                "format": " {}",
139                "max-length": 40,
140                "interval": 30, // Remove this if your script is endless and write in loop
141                "exec": "$HOME/.config/waybar/mediaplayer.sh 2> /dev/null", // Script in resources folder
142                "exec-if": "pgrep spotify"
143           }
144
145   mpd:
146           "custom/mpd": {
147                "format": "♪ {}",
148                //"max-length": 15,
149                "interval": 10,
150                "exec": "mpc current",
151                "exec-if": "pgrep mpd",
152                "on-click": "mpc toggle",
153                "on-click-right": "sonata"
154           }
155
156   cmus:
157           "custom/cmus": {
158                "format": "♪ {}",
159                //"max-length": 15,
160                "interval": 10,
161                "exec": "cmus-remote -C "format_print '%a - %t'"", // artist - title
162                "exec-if": "pgrep cmus",
163                "on-click": "cmus-remote -u",                        //toggle pause
164                "escape": true                                       //handle markup entities
165           }
166
167   Pacman
168           "custom/pacman": {
169                "format": "{}  ",
170                "interval": "once",
171                "exec": "pacman_packages",
172                "on-click": "update-system",
173                "signal": 8
174           }
175
176   Alternate Pacman
177           "custom/pacman": {
178                "format": "{}  ",
179                "interval": 3600,                     // every hour
180                "exec": "checkupdates | wc -l",       // # of updates
181                "exec-if": "exit 0",                  // always run; consider advanced run conditions
182                "on-click": "termite -e 'sudo pacman -Syu'; pkill -SIGRTMIN+8 waybar", // update system
183                "signal": 8
184           }
185
186       You can use the signal and update the number of available packages with
187       pkill -RTMIN+8 waybar.
188

STYLE

190       ·   #custom-<name>
191       ·   #custom-<name>.<class>
192       ·   <class> can be set by the script. For more information see return-
193           type
194
195
196
197                                  2021-02-10                  waybar-custom(5)
Impressum