Skip to main content

Sway Window Manager Configuration

Config-Sway uses Sway as the primary Wayland compositor and window manager. The configuration provides a comprehensive setup with keybindings, window management, and theme integration.

Configuration Files

The Sway configuration is split into two main files:
  • ~/.config/sway/config - Main configuration file with keybindings and settings
  • ~/.config/sway/theme.conf - Theme-specific colors, borders, and gaps (dynamically updated)

Core Settings

Modifier Key

set $mod Mod4
The Super (Windows) key is used as the primary modifier for all Sway keybindings.

Vim-style Navigation

set $left h
set $down j
set $up k
set $right l
Movement keys follow Vim conventions for consistency across the system.

Keybindings

KeybindingActionDescription
Super + EnterkittyLaunch terminal emulator
Super + FfirefoxLaunch Firefox browser
Super + Zflameshot guiTake screenshot
~/.config/sway/config
bindsym $mod+Return exec kitty
bindsym $mod+f exec firefox
bindsym $mod+z exec flameshot gui

Basic Window Operations

KeybindingAction
Super + CKill focused window
Super + OToggle split layout
Super + Shift + RReload Sway configuration

Focus Movement

~/.config/sway/config
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right

Moving Floating Windows

Small movements (50px):
bindsym $mod+Shift+h move left 50px
bindsym $mod+Shift+j move down 50px
bindsym $mod+Shift+k move up 50px
bindsym $mod+Shift+l move right 50px
Large movements (150px) - Super + Alt + HJKL:
bindsym $mod+Mod1+h move left 150px
bindsym $mod+Mod1+j move down 150px
bindsym $mod+Mod1+k move up 150px
bindsym $mod+Mod1+l move right 150px

Resizing Windows

Super + Ctrl + HJKL:
bindsym $mod+Control+h resize shrink width 50px
bindsym $mod+Control+l resize grow width 50px
bindsym $mod+Control+j resize shrink height 50px
bindsym $mod+Control+k resize grow height 50px
All Rofi menus are accessible through Super key combinations:
KeybindingScriptPurpose
Super + Dselector-app.shApplication launcher
Super + Qpower-menu.shPower management menu
Super + Atheme-switcher.shTheme switcher
Super + Wwallpaper-switcher.shWallpaper picker
Super + Emenu-iconos.shIcon menu
Super + Shift + Entermode-hacker.shHacker mode toggle
~/.config/sway/config
bindsym $mod+d exec ~/.config/rofi/scripts/selector-app.sh
bindsym $mod+q exec ~/.config/rofi/scripts/power-menu.sh
bindsym $mod+a exec ~/.config/rofi/scripts/theme-switcher.sh
bindsym $mod+w exec ~/.config/rofi/scripts/wallpaper-switcher.sh

Standard Workspaces (1-10)

Switch to workspace:
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
# ... up to $mod+0 for workspace 10
Move container to workspace:
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
# ... up to $mod+Shift+0

Special “Magic” Workspace

bindsym $mod+s workspace magic
bindsym $mod+Shift+s move container to workspace magic
Use the magic workspace as a scratchpad for temporary windows or tasks you want to keep separate from your main workflow.

Mouse Wheel Navigation

bindsym $mod+button4 workspace next
bindsym $mod+button5 workspace prev
Scroll while holding Super to cycle through workspaces.
Mouse ButtonWith Super KeyAction
Left ClickSuper + LMBMove window
Middle ClickSuper + MMBResize window
Right ClickSuper + RMBToggle floating
~/.config/sway/config
bindsym $mod+button1 move window
bindsym $mod+button2 resize
bindsym $mod+button3 floating toggle

Audio Control (WirePlumber)

bindsym XF86AudioRaiseVolume exec wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
bindsym XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindsym XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindsym XF86AudioMicMute exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle

Brightness Control

bindsym XF86MonBrightnessUp exec brightnessctl -e 4 -n 2 set 5%+
bindsym XF86MonBrightnessDown exec brightnessctl -e 4 -n 2 set 5%-

Media Playback (Playerctl)

bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPause exec playerctl play-pause
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioPrev exec playerctl previous
bindsym $mod+n exec makoctl dismiss -a
bindsym $mod+Shift+n exec makoctl mode -a dnd
  • Super + N - Dismiss all notifications
  • Super + Shift + N - Toggle Do Not Disturb mode

Input Configuration

Keyboard Layout

~/.config/sway/config
input type:keyboard {
    xkb_layout us,latam
    xkb_options grp:alt_shift_toggle
}
The configuration supports both US and Latin American keyboard layouts. Switch between them using Alt + Shift.

Touchpad

input type:touchpad {
    tap enabled
    natural_scroll disabled
}

Theme System

Theme File Structure

~/.config/sway/theme.conf
set $bg #1e1e2e
set $fg #cdd6f4
set $active #89b4fa
set $inactive #45475a

default_border pixel 2
default_floating_border pixel 2

gaps inner 5
gaps outer 10

client.focused          $active   $active   $fg      $active   $active
client.focused_inactive $inactive $inactive $fg      $inactive $inactive
client.unfocused        $inactive $inactive $fg      $inactive $inactive

Color Variables

VariablePurposeDefault Value
$bgBackground color#1e1e2e
$fgForeground/text color#cdd6f4
$activeActive window border#89b4fa
$inactiveInactive window border#45475a

Window Decoration

  • Border width: 2px for both regular and floating windows
  • Inner gaps: 5px between windows
  • Outer gaps: 10px from screen edges
The theme.conf file is automatically updated when you switch themes using Super + A. Each theme in ~/.config/themes/ contains its own sway/theme.conf file.

Wayland Portal Integration

~/.config/sway/config
exec_always systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
exec_always sh -c 'hash dbus-update-activation-environment 2>/dev/null && \
    dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK'
This ensures proper integration with:
  • Screen capture (xdg-desktop-portal-wlr)
  • Screenshot tools (Flameshot)
  • DBus-based applications

Flameshot Configuration

for_window [app_id="flameshot"] border pixel 0, floating enable, fullscreen disable, move absolute position 0 0
Special window rules ensure Flameshot overlays work correctly in multi-monitor setups.

Autostart Applications

~/.config/sway/config
exec_always ~/.config/scripts/setwallpaper.sh
exec nm-applet
exec sh -c 'CFG="$HOME/.config/waybar/config-sway.jsonc"; \
    [ -f "$CFG" ] || CFG="$HOME/.config/waybar/config.jsonc"; \
    exec waybar -c "$CFG"'
exec mako
exec bash ~/.config/scripts/autostart.sh

Startup Services

  1. Wallpaper setter - Applies saved wallpaper on startup
  2. nm-applet - NetworkManager system tray icon
  3. Waybar - Status bar with Sway-specific config
  4. Mako - Notification daemon
  5. Custom autostart - User-defined startup applications

Advanced Configuration

hide_edge_borders none
Window borders are shown on all edges. Change to smart to hide borders when only one window is visible.
include ~/.config/sway/theme.conf
The main config file includes the theme configuration, which allows dynamic theme switching without editing the main config.

Waybar Configuration

Configure the status bar appearance and modules

Theme System

Learn how theme switching works across all components

Rofi Configuration

Customize application launchers and menus

Kitty Terminal

Terminal emulator configuration and styling

Configuration Tips

Reload after changes: Press Super + Shift + R to reload Sway configuration without restarting your session.
Backup your config: Before making changes, create a backup:
cp ~/.config/sway/config ~/.config/sway/config.backup
Be careful when modifying the portal integration settings. Incorrect configuration may break screenshot functionality and other Wayland features.

Build docs developers (and LLMs) love