1sway-bar(5)                   File Formats Manual                  sway-bar(5)
2
3
4

NAME

6       sway-bar - bar configuration file and commands
7

DESCRIPTION

9       Sway allows configuring swaybar in the sway configuration file.
10

COMMANDS

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 re‐
25           leased 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 re‐
32           leased 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 de‐
43           scriptions, see https://docs.gtk.org/Pango/type_func.FontDescrip
44           tion.from_string.html#description
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 ei‐
48           ther be set all at once, per direction, or per side. Note that only
49           sides that touch an edge of the screen can have gaps. For the side
50           that does not touch an edge of the screen, per-side outer gaps for
51           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 un‐
60           hidden 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 de‐
75           pends 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 ef‐
98           fect 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 de‐
123           fault 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       workspace_min_width <px> [px]
151           Specifies the minimum width for the workspace buttons on the bar.
152           Default is 0.
153
154           This setting also applies to the current binding mode indicator.
155
156   TRAY
157       Swaybar provides a system tray where third-party applications may place
158       icons. The following commands configure the tray.
159
160       tray_bindcode <event-code> ContextMenu|Activate|SecondaryActi‐
161       vate|ScrollDown|ScrollLeft|ScrollRight|ScrollUp|nop
162           Executes the action when the mouse button has been pressed. The
163           buttons can be given as an event code, which can be obtained from
164           libinput debug-events. To disable the default behavior for a but‐
165           ton, use the command nop.
166
167       tray_bindsym button[1-9]|<event-name> ContextMenu|Activate|SecondaryAc‐
168       tivate|ScrollDown|ScrollLeft|ScrollRight|ScrollUp|nop
169           Executes the action when the mouse button has been pressed. The
170           buttons can be given as a x11 button number or an event name, which
171           can be obtained from libinput debug-events. Use the command nop to
172           disable the default action (Activate for button1, ContextMenu for
173           button2 and SecondaryActivate for button3).
174
175       tray_padding <px> [px]
176           Sets the pixel padding of the system tray. This padding will sur‐
177           round the tray on all sides and between each item. The default
178           value for px is 2.
179
180       tray_output none|<output>|*
181           Restrict the tray to a certain output, can be specified multiple
182           times. If omitted, the tray will be displayed on all outputs. Un‐
183           like i3bar, swaybar can show icons on any number of bars and out‐
184           puts without races. * can be given at any point to reset it to dis‐
185           play on all outputs.
186
187       icon_theme <name>
188           Sets the icon theme that sway will look for item icons in. This op‐
189           tion has no default value, because sway will always default to the
190           fallback theme, hicolor.
191
192   COLORS
193       Colors are defined within a colors { } block inside a bar { } block.
194       Colors must be defined in hex: #RRGGBB or #RRGGBBAA.
195
196       background <color>
197           Background color of the bar.
198
199       statusline <color>
200           Text color to be used for the statusline.
201
202       separator <color>
203           Text color to be used for the separator.
204
205       focused_background <color>
206           Background color of the bar on the currently focused monitor out‐
207           put. If not used, the color will be taken from background.
208
209       focused_statusline <color>
210           Text color to be used for the statusline on the currently focused
211           monitor output. If not used, the color will be taken from sta‐
212           tusline.
213
214       focused_separator <color>
215           Text color to be used for the separator on the currently focused
216           monitor output. If not used, the color will be taken from separa‐
217           tor.
218
219       focused_workspace <border> <background> <text>
220           Border, background and text color for a workspace button when the
221           workspace has focus.
222
223       active_workspace <border> <background> <text>
224           Border, background and text color for a workspace button when the
225           workspace is active (visible) on some output, but the focus is on
226           another one. You can only tell this apart from the focused
227           workspace when you are using multiple monitors.
228
229       inactive_workspace <border> <background> <text>
230           Border, background and text color for a workspace button when the
231           workspace does not have focus and is not active (visible) on any
232           output. This will be the case for most workspaces.
233
234       urgent_workspace <border> <background> <text>
235           Border, background and text color for a workspace button when the
236           workspace contains a window with the urgency hint set.
237
238       binding_mode <border> <background> <text>
239           Border, background and text color for the binding mode indicator.
240           If not used, the colors will be taken from urgent_workspace.
241

SEE ALSO

243       sway(5) swaybar-protocol(7)
244
245
246
247                                  2022-11-14                       sway-bar(5)
Impressum