-
-
Notifications
You must be signed in to change notification settings - Fork 707
Module: Sway
The mode
module displays the current binding mode of sway.
Addressed by sway/mode
option | typeof | default | description |
---|---|---|---|
format |
string | {} |
The format, how information should be displayed. On {} data gets inserted. |
rotate |
integer | Positive value to rotate the text label. | |
max-length |
integer | The maximum length in character the module should display. | |
on-click |
string | Command to execute when clicked on the module. | |
on-click-middle |
string | Command to execute when you middle clicked on the module using mousewheel. | |
on-click-right |
string | Command to execute when you right clicked on the module. | |
on-scroll-up |
string | Command to execute when scrolling up on the module. | |
on-scroll-down |
string | Command to execute when scrolling down on the module. | |
smooth-scrolling-threshold |
double | Threshold to be used when scrolling. | |
tooltip |
bool | true |
Option to enable tooltip on hover. |
"sway/mode": {
"format": " {}",
"max-length": 50
}
#mode
The window
module displays the title of the currently focused window in sway.
Addressed by sway/window
option | typeof | default | description |
---|---|---|---|
format |
string | {title} |
The format, how information should be displayed. |
rotate |
integer | Positive value to rotate the text label. | |
max-length |
integer | The maximum length in character the module should display. | |
on-click |
string | Command to execute when clicked on the module. | |
on-click-right |
string | Command to execute when you right clicked on the module. | |
on-scroll-up |
string | Command to execute when scrolling up on the module. | |
on-scroll-down |
string | Command to execute when scrolling down on the module. | |
smooth-scrolling-threshold |
double | Threshold to be used when scrolling. | |
tooltip |
bool | true |
Option to disable tooltip on hover. |
rewrite |
object | {} |
Rules to rewrite the module format output. See rewrite rules. |
all-outputs |
bool | false |
If set to false, displays only title of the window on the same output as bar |
offscreen-css |
bool | 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 |
bool | Only effective when both all-outputs and offscreen-css are true. On screens currently not focused, show the given text along with that workspaces styles. | |
icon |
bool | false |
Option to disable application icon. |
icon-size |
integer | 24 |
Set the size of application icon. |
string | replacement |
---|---|
{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'. |
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.
Regular expression and replacement follow ECMAScript rules (formal definition).
An expression must match fully to trigger the replacement; if no expression matches, the format output is left unchanged.
Invalid expressions (e.g., mismatched parentheses) are ignored.
"sway/window": {
"format": "{title}",
"max-length": 50,
"rewrite": {
"(.*) - Mozilla Firefox": "🌎 $1",
"(.*) - vim": " $1",
"(.*) - zsh": " [$1]"
}
}
"sway/window": {
"format": "{}",
"max-length": 50,
"all-outputs" : true,
"offscreen-css" : true,
"offscreen-css-text": "(inactive)",
"rewrite": {
"(.*) - Mozilla Firefox": " $1",
"(.*) - fish": "> [$1]"
},
}
#window
-
window#waybar.empty
When no windows are in the workspace, or screen is not focused andoffscreen-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>
Whereapp_id
is the app_id orinstance
name like (chromium
) of the only window in the workspace
Please note that the window module applies the additional css classes listed above to the whole waybar rather than the module widgets. The whole waybar is an element with the name "window" and the id "waybar", whereas the window module itself is an element with the name "box" and the id "window". So in most instances, you probably want to apply formatting to window#waybar.<stylename> #window
. For better insight regarding css hierarchy, consider GTK_DEBUG.
Also, switching layouts does not change the style unless the focus is changed. At this point, sway does not provide events for layout switching and the module does not poll.
window#waybar {
background-color: #990000;
}
window#waybar.empty {
background-color: transparent;
}
window#waybar.empty #window {
padding: 0px;
margin: 0px;
border: 0px;
/* background-color: rgba(66,66,66,0.5); */ /* transparent */
background-color: transparent;
}
window#waybar.solo #window {
padding-left: 5px;
padding-right: 5px;
color: #eee8d5; /* base2 */
background-color: #073642; /*base02*/
}
window#waybar.floating #window {
padding-left: 5px;
padding-right: 5px;
color: #eee8d5; /* base2 */
background-color: #b58900; /*yellow*/
}
window#waybar.tiled #window {
padding-left: 5px;
padding-right: 5px;
color: #eee8d5; /* base2 */
background-color: #cb4b16; /* orange */
}
window#waybar.stacked #window {
padding-left: 5px;
padding-right: 5px;
color: #eee8d5; /* base2 */
background: #2aa196; /*cyan*/
}
window#waybar.tabbed #window {
padding-left: 5px;
padding-right: 5px;
color: #eee8d5; /* base2 */
background: #859900; /*green*/
}
window#waybar.code {
background-color: #007ACC;
}
The workspaces
module displays the currently used workspaces in sway.
Addressed by sway/workspaces
option | typeof | default | description |
---|---|---|---|
all-outputs |
bool | false |
If set to false , workspaces will only be shown on the output they are on.If set to true all workspaces will be shown on every output. |
format |
string | {name} |
The format, how information should be displayed. |
format-icons |
array | Based on the workspace name and state, the corresponding icon gets selected. See Icons
|
|
disable-scroll |
bool | false |
If set to false , you can scroll to cycle through workspaces.If set to true this behaviour is disabled. |
disable-click |
bool | false |
If set to false , you can click to change workspace.If set to true this behaviour is disabled. |
smooth-scrolling-threshold |
double | Threshold to be used when scrolling. | |
disable-scroll-wraparound |
bool | false |
If set to false , scrolling on the workspace indicator will wrap around to the first workspace when reading the end, and vice versa.If set to true this behavior is disabled. |
enable-bar-scroll |
bool | false |
If set to false , you can't scroll to cycle throughout workspaces from the entire bar.If set to true this behaviour is enabled. |
disable-markup |
bool | false |
If set to true , button label will escape pango markup. |
current-only |
bool | false |
If set to true . Only focused workspaces will be shown. |
persistent-workspaces |
json (see below) | empty | Lists workspaces that should always be shown, even when non existant |
numeric-first |
bool | false |
If set to true , workspaces with a name that starts with a number are displayed in front of workspaces that do not start with a number. |
disable-auto-back-and-forth |
bool | false |
Whether to disable workspace_auto_back_and_forth when clicking on workspaces. If this is set to true , clicking on a workspace you are already on won't do anything, even if workspace_auto_back_and_forth is enabled in the Sway configuration. |
warp-on-scroll |
bool | true |
If set to false , waybar will ephemerally disable mouse_warping (see man 5 sway ) while using the scroll wheel to switch workspaces |
window-rewrite |
object | {} |
Regex rules to map window class to an icon or preferred method of representation for a workspace's window. |
window-rewrite-default |
string |
? |
The default method of representation for a workspace's window. This will be used for windows whose classes do not match any of the rules in window-rewrite
|
format-window-separator |
string |
|
The separator to be used between windows in a workspace. |
string | replacement |
---|---|
{value} |
Name of the workspace, as defined by sway |
{name} |
Number stripped from workspace value at colon e.g. "13:NAME" |
{icon} |
Icon, as defined in format-icons . |
{index} |
Index of the workspace |
{output} |
Output where the workspace is located. |
{windows} |
Result from window-rewrite |
Additional to workspace name matching, the following format-icons
can be set.
port name | note |
---|---|
default |
Will be shown, when no string matches is found. |
urgent |
Will be shown, when workspace is flagged as urgent |
focused |
Will be shown, when workspace is focused |
persistent |
Will be shown, when workspace is persistent one. |
If you don't want these additional icons to override your matched workspace icon for some workspaces, then you can list such workspaces in the
high-priority-named
list (like "high-priority-named": ["1", "2", "3"]
)
each entry of persistent_workspace
names a workspace that should always be shown. Associated with that value is a list of outputs indicating where the workspace should be shown, an empty list denoting all outputs
"sway/workspaces": {
"persistent-workspaces": {
"3": [], // Always show a workspace with name '3', on all outputs if it does not exists
"4": ["eDP-1"], // Always show a workspace with name '4', on output 'eDP-1' if it does not exists
"5": ["eDP-1", "DP-2"] // Always show a workspace with name '5', on outputs 'eDP-1' and 'DP-2' if it does not exists
}
}
n.b.: the list of outputs can be obtained from command line using swaymsg -t get_outputs
"sway/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"format": "{name}: {icon}",
"format-icons": {
"1": "",
"2": "",
"3": "",
"4": "",
"5": "",
"urgent": "",
"focused": "",
"default": "",
"high-priority-named": ["1", "2"]
}
}
"sway/workspaces": {
"format": "<span size='larger'>{name}</span> {windows}"
"format-window-separator": " | ",
"window-rewrite-default": "{name}",
"window-format": "<span color='#e0e0e0'>{name}</span>",
"window-rewrite": {
"class<firefox> title<.*chat.gig.tech.*>": "",
"class<kitty>": "",
}
}
#workspaces button
#workspaces button.visible
#workspaces button.focused
#workspaces button.urgent
#workspaces button.persistent
#workspaces button.empty
#workspaces button.current_output
#workspaces button#sway-workspace-${name}
- Home
- Installation
- Configuration
- Styling
- Examples
- FAQ
- Modules:
- Backlight/Slider
- Backlight
- Battery
- Bluetooth
- CPU
- Cava
- Clock
- Custom
- DWL
- Disk
- Gamemode
- Group
- Hyprland
- Idle Inhibitor
- Image
- JACK
- Keyboard State
- Language
- Load
- MPD
- MPRIS
- Memory
- Network
- Niri
- Power Profiles Daemon
- Privacy
- PulseAudio/Slider
- PulseAudio
- River
- Sndio
- Sway
- Systemd failed units
- Taskbar
- Temperature
- Tray
- UPower
- User
- WirePlumber
- Workspaces
- Writing Modules