waybar-sway-window(5)

πŸ’– waybar-sway-window(5) πŸ’–

okay bestie, sit down, hydrate, and let me tell you about the sway window module for waybar β€” this is section 5 of the file formats manual, so it's the config lore, not a command you run. no cap.


✨ NAME ✨

waybar β€” the sway window module. that's it, that's the name, she's simple and she's iconic πŸ’…


🌸 DESCRIPTION 🌸

The window module displays the title of the currently focused window in Sway. literally just that. your whole "what am i even looking at right now" problem? solved. main character energy for your bar πŸͺŸβœ¨


πŸŽ€ CONFIGURATION πŸŽ€

You address this one by its config key:

sway/window

and here's everything you can throw at her, one by one, no skipping, we don't do that here 🫢

  • format β€” typeof: string, default: {title}. This is the format, like… how the information should be displayed. the outfit the module wears.
  • rotate β€” typeof: integer. A positive value to rotate the text label, and it's in 90 degree increments. so it's giving "sideways era".
  • max-length β€” typeof: integer. The maximum length in character the module should display. yes, "character", singular, that's what it says, i'm not fixing the manpage's grammar, i'm just passing the message along 😭
  • min-length β€” typeof: integer. The minimum length in characters the module should accept.
  • align β€” typeof: float. The alignment of the label within the module, where 0 is left-aligned and 1 is right-aligned. if the module is rotated, it will follow the flow of the text. (she's adaptable, we love that)
  • justify β€” typeof: string. The alignment of the text within the module's label β€” you can pass 'left', 'right', or 'center' to define the positioning.
  • on-click β€” typeof: string. Command to execute when clicked on the module.
  • on-click-middle β€” typeof: string. Command to execute when middle-clicked on the module using mousewheel.
  • on-click-right β€” typeof: string. Command to execute when you right-click on the module.
  • on-update β€” typeof: string. Command to execute when the module is updated.
  • on-scroll-up β€” typeof: string. Command to execute when scrolling up on the module.
  • on-scroll-down β€” typeof: string. Command to execute when scrolling down on the module.
  • smooth-scrolling-threshold β€” typeof: double. Threshold to be used when scrolling. for the ✨smooth✨ girlies.
  • tooltip β€” typeof: bool, default: true. Option to disable tooltip on hover. (default is ON, so if you want it gone you gotta say so, bestie)
  • all-outputs β€” typeof: bool, default: false. Option to show the focused window along with its workspace styles on all outputs.
  • offscreen-css β€” typeof: bool, default: false. Only effective when all-outputs is true. Adds style according to present windows on unfocused outputs instead of showing the focused window and style.
  • offscreen-css-text β€” typeof: string. Only effective when both all-outputs and offscreen-style are true. On screens currently not focused, show the given text along with that workspace styles.
  • show-focused-workspace-name β€” typeof: bool, default: false. If the workspace itself is focused and the workspace contains nodes or floating_nodes, show the workspace name. If not set, text remains empty β€” but styles according to nodes in the workspace are still applied. so like, silent but still slaying πŸ’…
  • show-hidden-marks β€” typeof: bool, default: false. For the {marks} format replacement, include hidden marks that start with an underscore. the sneaky ones. the undercover marks. πŸ™ˆ
  • rewrite β€” typeof: object. Rules to rewrite the module format output. see rewrite rules down below ⬇️
  • icon β€” typeof: bool, default: false. Option to hide the application icon.
  • icon-size β€” typeof: integer, default: 24. Option to change the size of the application icon.
  • expand β€” typeof: bool, default: false. Enables this module to consume all left over space dynamically. she's hungry for pixels, let her eat πŸ”₯

πŸ¦‹ FORMAT REPLACEMENTS πŸ¦‹

these are the little {} guys you can drop into your format string, and each one gets swapped for real info:

  • {title} β€” The title of the focused window.
  • {app_id} β€” The app_id of the focused window.
  • {shell} β€” The shell of the focused window. It's 'xwayland' when the window is running through xwayland, otherwise, it's 'xdg-shell'.
  • {marks} β€” Marks of the window.

🌈 REWRITE RULES 🌈

rewrite is an object where keys are regular expressions and values are rewrite rules if the expression matches. Rules may contain references to captures of the expression. it's giving find-and-replace but make it fashion.

Regular expression and replacement follow ECMA-script rules. periodt.

If no expression matches, the format output is left unchanged.

Invalid expressions (e.g., mismatched parentheses) are skipped. she just… ignores them. no drama, no crash, silent treatment πŸ’€


⭐ EXAMPLES ⭐

here's the vibe, copy-paste ready, character for character:

"sway/window": {
     "format": "{}",
     "max-length": 50,
     "rewrite": {
          "(.*) - Mozilla Firefox": "🌎 $1",
          "(.*) - zsh": "> [$1]"
     }
}

look at that. $1 said "i'll hold your capture group". iconic behavior. 🌎


πŸ‘‘ STYLE πŸ‘‘

  • #window

The following classes are applied to the entire Waybar rather than just the window widget β€” so yeah, she's affecting the whole bar, global queen energy:

  • window#waybar.empty β€” When no windows are in the workspace, or screen is not focused and offscreen-css option is not set
  • window#waybar.solo β€” When one tiled window is in the workspace
  • window#waybar.floating β€” When there are only floating windows in the workspace
  • window#waybar.stacked β€” When there is more than one window in the workspace and the workspace layout is stacked
  • window#waybar.tabbed β€” When there is more than one window in the workspace and the workspace layout is tabbed
  • window#waybar.tiled β€” When there is more than one window in the workspace and the workspace layout is splith or splitv
  • window#waybar.<app_id> β€” Where app_id is the app_id or instance name like (chromium) of the only window in the workspace

ngl this page is from waybar-sway-window(5), dated 2026-02-08. that's the source, that's the version, that's the whole footer, and i folded it in here so you'd still have it. bye bestie, go style your bar, you're gonna eat πŸ’œπŸŒΈπŸ«Ά
πŸ“¦ where this page comes from