sway-bar(5)
π NAME π
sway-bar(5) β bar configuration file and commands. This cutie comes from the File Formats Manual, and bestie, it's literally your guide to making swaybar behave. π
β¨ DESCRIPTION β¨
Sway lets you configure swaybar right inside the sway configuration file. No cap, that's the whole vibe. π«Ά
πΈ COMMANDS πΈ
π config-file-only commands π
The following commands may only be used in the configuration file.
id <bar_id>β sets the ID of the bar. Every bar needs its little name tag. πswaybar_command <command>β runs a custom bar command. Default isswaybar. Slay.
π¦ config-file-or-runtime commands π¦
The following commands may be used either in the configuration file or at runtime.
bindcode [--release] <event-code> <command>β runscommandwhen the mouse button has been pressed, or if--releaseis given, when the button has been released. Buttons can be given as an event code, which you can obtain fromlibinput debug-events. To disable the default behavior for a button, use the commandnop.bindsym [--release] button[1-9]|<event-name> <command>β runscommandwhen the mouse button has been pressed, or if--releaseis given, when the button has been released. Buttons can be given as a x11 button number or an event name, which can be obtained fromlibinput debug-events. To disable the default behavior for a button, use the commandnop.binding_mode_indicator yes|noβ enables or disables the binding mode indicator. Default isyes.font <font>β specifies the font to be used in the bar.fontshould be specified as a pango font description. For more info on pango font descriptions, seehttps://docs.gtk.org/Pango/type_func.FontDescription.from_string.html#description.gaps <all> | <horizontal> <vertical> | <top> <right> <bottom> <left>β sets the gaps from the edge of the screen for the bar. Gaps can either be set all at once, per direction, or per side. Note that only sides that touch an edge of the screen can have gaps. For the side that does not touch an edge of the screen, per-side outer gaps for workspaces may be of use.height <height>β sets the height of the bar. Default height (0) will match the font size.hidden_state hide|show [<bar-id>]β specifies the behaviour of the bar when it is in hide mode. When the hidden state ishide, then it is normally hidden, and only unhidden by pressing the modifier key or in case of urgency hints. When the hidden state isshow, then it is permanently visible, drawn on top of the currently visible workspace. Default ishide.
For compatibility with i3, bar hidden_state hide|show [<bar-id>] is supported along with the sway only bar <bar-id> hidden_state hide|show syntax. When using the i3 syntax, if bar-id is omitted, the hidden_state will be changed for all bars. Attempting to use bar <bar-id1> hidden_state hide|show <bar-id2> will result in an error due to conflicting bar ids.
mode dock|hide|invisible|overlay [<bar-id>]β specifies the visibility of the bar. Indockmode, it is permanently visible at one edge of the screen. Inhidemode, it is hidden unless the modifier key is pressed, though this behaviour depends on the hidden state. Ininvisiblemode, it is permanently hidden. Inoverlaymode, it is permanently visible on top of other windows. (Inoverlaymode the bar is transparent to input events.) Default isdock.
For compatibility with i3, bar mode <mode> [<bar-id>] syntax is supported along with the sway only bar <bar-id> mode <mode> syntax. When using the i3 syntax, if bar-id is omitted, the mode will be changed for all bars. Attempting to use bar <bar-id1> mode <mode> <bar-id2> will result in an error due to conflicting bar ids.
modifier <Modifier>|noneβ specifies the modifier key that shows a hidden bar. Default isMod4.output <output>|*β restricts the bar to a certain output, and can be specified multiple times. If theoutputcommand is omitted, the bar will be displayed on all outputs.*can be given at any point to reset it back to all outputs.pango_markup enabled|disabledβ enables or disables pango markup for status lines. This has no effect on status lines using the i3bar JSON protocol.position top|bottomβ sets position of the bar. Default isbottom.separator_symbol <symbol>β specifies the separator symbol to separate blocks on the bar.status_command <status command>β executes the bar status command withsh -c. Each line of text printed to stdout from this command will be displayed in the status area of the bar. You may also use swaybar's JSON status line protocol. Seeswaybar-protocol(7)for more information on the protocol.
If running this command via IPC, you can disable a running status command by setting the command to a single dash: swaybar bar bar-0 status_command -
status_edge_padding <padding>β sets the padding that is used when the status line is at the right edge of the bar. This value will be multiplied by the output scale. The default is3.status_padding <padding>β sets the vertical padding that is used for the status line. The default is1. Ifpaddingis0, blocks will be able to take up the full height of the bar. This value will be multiplied by the output scale.strip_workspace_name yes|noβ if set toyes, then workspace names will be omitted from the workspace button and only the custom number will be shown. Default isno.strip_workspace_numbers yes|noβ if set toyes, then workspace numbers will be omitted from the workspace button and only the custom name will be shown. Default isno.unbindcode [--release] <event-code>β removes the binding with the given<event-code>.unbindsym [--release] button[1-9]|<event-name>β removes the binding with the given<button>or<event-name>.wrap_scroll yes|noβ enables or disables wrapping when scrolling through workspaces with the scroll wheel. Default isno.workspace_buttons yes|noβ enables or disables workspace buttons on the bar. Default isyes.workspace_min_width <px> [px]β specifies the minimum width for the workspace buttons on the bar. Default is0.
This setting also applies to the current binding mode indicator.
β runtime-only commands β
The following commands may only be used at runtime.
mode toggle [<bar_id>]β toggles the current mode betweenhideanddock. Any other mode is treated ashide.
π TRAY π
Swaybar provides a system tray where third-party applications may place icons. The following commands configure the tray. π§
tray_bindcode <event-code>β executes the action when the mouse button has been pressed. The buttons can be given as an event code, which can be obtained fromlibinput debug-events. To disable the default behavior for a button, use the commandnop. The action is one of:
ContextMenu|Activate|SecondaryActivate|ScrollDown|ScrollLeft|ScrollRight|ScrollUp|nop
tray_bindsym button[1-9]|<event-name>β executes the action when the mouse button has been pressed. The buttons can be given as a x11 button number or an event name, which can be obtained fromlibinput debug-events. Use the commandnopto disable the default action (Activateforbutton1,ContextMenuforbutton2andSecondaryActivateforbutton3). The action is one of:
ContextMenu|Activate|SecondaryActivate|ScrollDown|ScrollLeft|ScrollRight|ScrollUp|nop
tray_padding <px> [px]β sets the pixel padding of the system tray. This padding will surround the tray on all sides and between each item. The default value forpxis2.tray_output none|<output>|*β restricts the tray to a certain output, and can be specified multiple times. If omitted, the tray will be displayed on all outputs. Unlike i3bar, swaybar can show icons on any number of bars and outputs without races.*can be given at any point to reset it to display on all outputs.icon_theme <name>β sets the icon theme that sway will look for item icons in. This option has no default value, because sway will always default to the fallback theme,hicolor.
π COLORS π
Colors are defined within a colors { } block inside a bar { } block. Colors must be defined in hex: #RRGGBB or #RRGGBBAA. It's giving palette moment. π¨
background <color>β background color of the bar.statusline <color>β text color to be used for the statusline.separator <color>β text color to be used for the separator.focused_background <color>β background color of the bar on the currently focused monitor output. If not used, the color will be taken frombackground.focused_statusline <color>β text color to be used for the statusline on the currently focused monitor output. If not used, the color will be taken fromstatusline.focused_separator <color>β text color to be used for the separator on the currently focused monitor output. If not used, the color will be taken fromseparator.focused_workspace <border> <background> <text>β border, background and text color for a workspace button when the workspace has focus.active_workspace <border> <background> <text>β border, background and text color for a workspace button when the workspace is active (visible) on some output, but the focus is on another one. You can only tell this apart from the focused workspace when you are using multiple monitors.inactive_workspace <border> <background> <text>β border, background and text color for a workspace button when the workspace does not have focus and is not active (visible) on any output. This will be the case for most workspaces.urgent_workspace <border> <background> <text>β border, background and text color for a workspace button when the workspace contains a window with the urgency hint set.binding_mode <border> <background> <text>β border, background and text color for the binding mode indicator. If not used, the colors will be taken fromurgent_workspace.
β SEE ALSO β
sway(5) and swaybar-protocol(7) β go read those too, bestie. iykyk. π¦
xoxo, your sway-bar(5) bestie from the File Formats Manual, date-stamped 2026-04-26. πβ¨
π¦ where this page comes from
- alpine 3.24: sway-doc 1.12_rc3-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms