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

RETURN-TYPE

103       When return-type is set to json, Waybar expects the exec-script  to
104       output its data in JSON format.  This should look like this:
105
106           {"text": "$text", "tooltip": "$tooltip", "class": "$class", "percentage": $percentage }
107
108       The class parameter also accepts an array of strings.
109
110       If nothing or an invalid option is specified, Waybar expects i3blocks
111       style output. Values are newline separated.  This should look like
112       this:
113
114           $text\n$tooltip\n$class*
115
116       class is a CSS class, to apply different styles in style.css
117

FORMAT REPLACEMENTS

119       {}: Output of the script.
120
121       {percentage} Percentage which can be set via a json return-type.
122
123       {icon}: An icon from 'format-icons' according to percentage.
124

EXAMPLES

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

STYLE

180       ·   #custom-<name>
181       ·   #custom-<name>.<class>
182       ·   <class> can be set by the script. For more information see return-
183           type
184
185
186
187                                  2020-04-11                  waybar-custom(5)
Impressum