SwayWM Tools and Settings

How do I temporarily rename a window?

Add to sway config:


# In sway config:
# Press mod+n to rename the current workspace
bindsym $mod+n exec swaymsg "rename workspace to $(swaymsg -t get_workspaces | jq -r '.[] | select(.focused).num'): $(echo "" | wmenu -p 'New name:')"
        

swaymsg -t get_workspaces spits out a ton of JSON when piped into something that isn't STDOUT. jq -r '.[]' unpacks the resulting array into individual objects, and then we use jq select function to grab the number for that window. This is all to preserve the number so that $MOD+number window selection works after we rename it.

Once we have the window number, we can do a wmenu prompt $(echo "" | wmenu -p 'New name:')(or replace with a dmenu-like prompt of your choosing) to query for a new window name.

And once we have something like "3: NewWindowName", we can run the swaymsg command exec swaymsg 'rename workspace to "3: NewWindowName"' to rename the current workspace to that.

Note: If you renamed your workspaces with variables in sway config, ensure that sway config includes 'number' before the target variable, so that sway will search for the number eg "2" instead of literally looking for "2:Web"


# In sway config:
### Workspace Names
set $ws1 "1:Notes"
set $ws2 "2:Web"

# Switch to workspace
bindsym $mod+1 workspace number $ws1
bindsym $mod+2 workspace number $ws2
        
How do I adjust volume using keyboard special keys?

# In sway config:
# Special keys to adjust volume via PulseAudio
bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5%
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5%
bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
        
How do I display audio status in waybar?

Use waybar's pulseaudio module


#in waybar config:
(...)
"modules-right": ["pulseaudio", "clock"],
"pulseaudio": {
    "format": "{volume}% {icon}",
    "format-muted": "Muted 🔇",
    "format-icons": {
        "default": ["🔈", "🔉", "🔊"]
    },
    "scroll-step": 1,
    "on-click": "pavucontrol"
},
(...)
        
How do I type special characters (like accents)

It's 2026, we're not using Windows anymore, we don't need to memorize (or discover) arcane code page numbers with alt codes. We have the compose key.


# In sway config:
input "type:keyboard" {
    xkb_options compose:ralt
}
        

Now when writing in Spanish, we can do (Right Alt) + n + ~ and voila: ñ. Or (Right Alt) + "+" + "-" and we have ±! (I wish this worked on Windows, I wouldn't need to have symbl.cc up constantly).

Back through ieve's Garden 🌱