1sway-bar(5) File Formats Manual sway-bar(5)
2
3
4
6 sway-bar - bar configuration file and commands
7
9 Sway allows configuring swaybar in the sway configuration file.
10
12 The following commands may only be used in the configuration file.
13
14 id <bar_id>
15 Sets the ID of the bar.
16
17 swaybar_command <command>
18 Executes custom bar command. Default is swaybar.
19
20 The following commands may be used either in the configuration file or
21 at runtime.
22
23 bindcode [--release] <event-code> <command>
24 Executes command when the mouse button has been pressed (or if
25 released is given, when the button has been released). The buttons
26 can be given as an event code, which can be obtaining from libinput
27 debug-events. To disable the default behavior for a button, use the
28 command nop.
29
30 bindsym [--release] button[1-9]|<event-name> <command>
31 Executes command when the mouse button has been pressed (or if
32 released is given, when the button has been released). The buttons
33 can be given as a x11 button number or an event name, which can be
34 obtained from libinput debug-events. To disable the default behav‐
35 ior for a button, use the command nop.
36
37 binding_mode_indicator yes|no
38 Enable or disable binding mode indicator. Default is yes.
39
40 font <font>
41 Specifies the font to be used in the bar. font should be specified
42 as a pango font description. For more information on pango font
43 descriptions, see https://developer.gnome.org/pango/stable/pango-
44 Fonts.html#pango-font-description-from-string
45
46 gaps <all> | <horizontal> <vertical> | <top> <right> <bottom> <left>
47 Sets the gaps from the edge of the screen for the bar. Gaps can
48 either be set all at once, per direction, or per side. Note that
49 only sides that touch an edge of the screen can have gaps. For the
50 side that does not touch an edge of the screen, per-side outer gaps
51 for workspaces may be of use.
52
53 height <height>
54 Sets the height of the bar. Default height (0) will match the font
55 size.
56
57 hidden_state hide|show [<bar-id>]
58 Specifies the behaviour of the bar when it is in hide mode. When
59 the hidden state is hide, then it is normally hidden, and only
60 unhidden by pressing the modifier key or in case of urgency hints.
61 When the hidden state is show, then it is permanently visible,
62 drawn on top of the currently visible workspace. Default is hide.
63
64 For compatibility with i3, bar hidden_state hide|show [<bar-id>] is
65 supported along with the sway only bar <bar-id> hidden_state
66 hide|show syntax. When using the i3 syntax, if bar-id is omitted,
67 the hidden_state will be changed for all bars. Attempting to use
68 bar <bar-id1> hidden_state hide|show <bar-id2> will result in an
69 error due to conflicting bar ids.
70
71 mode dock|hide|invisible|overlay [<bar-id>]
72 Specifies the visibility of the bar. In dock mode, it is perma‐
73 nently visible at one edge of the screen. In hide mode, it is hid‐
74 den unless the modifier key is pressed, though this behaviour
75 depends on the hidden state. In invisible mode, it is permanently
76 hidden. In overlay mode, it is permanently visible on top of other
77 windows. (In overlay mode the bar is transparent to input events.)
78 Default is dock.
79
80 For compatibility with i3, bar mode <mode> [<bar-id>] syntax is
81 supported along with the sway only bar <bar-id> mode <mode> syntax.
82 When using the i3 syntax, if bar-id is omitted, the mode will be
83 changed for all bars. Attempting to use bar <bar-id1> mode <mode>
84 <bar-id2> will result in an error due to conflicting bar ids.
85
86 modifier <Modifier>|none
87 Specifies the modifier key that shows a hidden bar. Default is
88 Mod4.
89
90 output <output>|*
91 Restrict the bar to a certain output, can be specified multiple
92 times. If the output command is omitted, the bar will be displayed
93 on all outputs. * can be given at any point to reset it back to all
94 outputs.
95
96 pango_markup enabled|disabled
97 Enables or disables pango markup for status lines. This has no
98 effect on status lines using the i3bar JSON protocol.
99
100 position top|bottom
101 Sets position of the bar. Default is bottom.
102
103 separator_symbol <symbol>
104 Specifies the separator symbol to separate blocks on the bar.
105
106 status_command <status command>
107 Executes the bar status command with sh -c. Each line of text
108 printed to stdout from this command will be displayed in the status
109 area of the bar. You may also use swaybar's JSON status line proto‐
110 col. See swaybar-protocol(7) for more information on the protocol
111
112 If running this command via IPC, you can disable a running status
113 command by setting the command to a single dash: swaybar bar bar-0
114 status_command -
115
116 status_edge_padding <padding>
117 Sets the padding that is used when the status line is at the right
118 edge of the bar. This value will be multiplied by the output scale.
119 The default is 3.
120
121 status_padding <padding>
122 Sets the vertical padding that is used for the status line. The
123 default is 1. If padding is 0, blocks will be able to take up the
124 full height of the bar. This value will be multiplied by the output
125 scale.
126
127 strip_workspace_name yes|no
128 If set to yes, then workspace names will be omitted from the
129 workspace button and only the custom number will be shown. Default
130 is no.
131
132 strip_workspace_numbers yes|no
133 If set to yes, then workspace numbers will be omitted from the
134 workspace button and only the custom name will be shown. Default is
135 no.
136
137 unbindcode [--release] <event-code>
138 Removes the binding with the given <event-code>.
139
140 unbindsym [--release] button[1-9]|<event-name>
141 Removes the binding with the given <button> or <event-name>.
142
143 wrap_scroll yes|no
144 Enables or disables wrapping when scrolling through workspaces with
145 the scroll wheel. Default is no.
146
147 workspace_buttons yes|no
148 Enables or disables workspace buttons on the bar. Default is yes.
149
150 TRAY
151 Swaybar provides a system tray where third-party applications may place
152 icons. The following commands configure the tray.
153
154 tray_bindcode <event-code> ContextMenu|Activate|SecondaryActi‐
155 vate|ScrollDown|ScrollLeft|ScrollRight|ScrollUp|nop
156 Executes the action when the mouse button has been pressed. The
157 buttons can be given as an event code, which can be obtained from
158 libinput debug-events. To disable the default behavior for a but‐
159 ton, use the command nop.
160
161 tray_bindsym button[1-9]|<event-name> ContextMenu|Activate|SecondaryAc‐
162 tivate|ScrollDown|ScrollLeft|ScrollRight|ScrollUp|nop
163 Executes the action when the mouse button has been pressed. The
164 buttons can be given as a x11 button number or an event name, which
165 can be obtained from libinput debug-events. Use the command nop to
166 disable the default action (Activate for button1, ContextMenu for
167 button2 and SecondaryActivate for button3).
168
169 tray_padding <px> [px]
170 Sets the pixel padding of the system tray. This padding will sur‐
171 round the tray on all sides and between each item. The default
172 value for px is 2.
173
174 tray_output none|<output>|*
175 Restrict the tray to a certain output, can be specified multiple
176 times. If omitted, the tray will be displayed on all outputs.
177 Unlike i3bar, swaybar can show icons on any number of bars and out‐
178 puts without races. * can be given at any point to reset it to dis‐
179 play on all outputs.
180
181 icon_theme <name>
182 Sets the icon theme that sway will look for item icons in. This
183 option has no default value, because sway will always default to
184 the fallback theme, hicolor.
185
186 COLORS
187 Colors are defined within a colors { } block inside a bar { } block.
188 Colors must be defined in hex: #RRGGBB or #RRGGBBAA.
189
190 background <color>
191 Background color of the bar.
192
193 statusline <color>
194 Text color to be used for the statusline.
195
196 separator <color>
197 Text color to be used for the separator.
198
199 focused_background <color>
200 Background color of the bar on the currently focused monitor out‐
201 put. If not used, the color will be taken from background.
202
203 focused_statusline <color>
204 Text color to be used for the statusline on the currently focused
205 monitor output. If not used, the color will be taken from sta‐
206 tusline.
207
208 focused_separator <color>
209 Text color to be used for the separator on the currently focused
210 monitor output. If not used, the color will be taken from separa‐
211 tor.
212
213 focused_workspace <border> <background> <text>
214 Border, background and text color for a workspace button when the
215 workspace has focus.
216
217 active_workspace <border> <background> <text>
218 Border, background and text color for a workspace button when the
219 workspace is active (visible) on some output, but the focus is on
220 another one. You can only tell this apart from the focused
221 workspace when you are using multiple monitors.
222
223 inactive_workspace <border> <background> <text>
224 Border, background and text color for a workspace button when the
225 workspace does not have focus and is not active (visible) on any
226 output. This will be the case for most workspaces.
227
228 urgent_workspace <border> <background> <text>
229 Border, background and text color for a workspace button when the
230 workspace contains a window with the urgency hint set.
231
232 binding_mode <border> <background> <text>
233 Border, background and text color for the binding mode indicator.
234 If not used, the colors will be taken from urgent_workspace.
235
237 sway(5) swaybar-protocol(7)
238
239
240
241 2020-10-22 sway-bar(5)