Add sway config and other Wayland-related stuff

This commit is contained in:
Lexi / Zoe 2026-05-13 13:49:07 +02:00
parent 2ef36eb976
commit ecd2f63c92
Signed by: binaryDiv
GPG key ID: F8D4956E224DA232
18 changed files with 664 additions and 0 deletions

View file

@ -0,0 +1,16 @@
# Define defaults for variables used throughout the configuration.
# Override variables either in a file like `09_vars_local` or by replacing this file.
# Set default modifier: Mod4 = Super/Win key
set $mod Mod4
# Set default terminal emulator
set $terminal sakura
# Set command to run default terminal emulator in floating mode
# NOTE: When using a different terminal, you might need to define a custom window rule for this.
set $terminal_floating sakura --name=sakura-floating
# Set application launcher
set $app_launcher rofi -show run
set $app_launcher_alt rofi -show drun

View file

@ -0,0 +1,220 @@
# Common settings for most systems.
# GENERAL SETTINGS
# ~~~~~~~~~~~~~~~~
# Use Mouse+$mod to drag and resize windows
floating_modifier $mod
# No auto focussing via mouseover
focus_follows_mouse no
# APPEARANCE
# ~~~~~~~~~~
# Define font
font pango:Liberation Sans 12
# Define colors
client.focused #880044 #bb0066 #ffffff #9933dd #880044
client.focused_inactive #333333 #5f676a #ffffff #484e50 #5f676a
client.unfocused #333333 #222222 #888888 #292d2e #222222
client.urgent #2f343a #c00000 #ffffff #900000 #900000
# Reduce padding in titlebar
titlebar_padding 3
# Hide window borders on workspaces with only one window
hide_edge_borders smart_no_gaps
# XWAYLAND
# ~~~~~~~~
# Add indicator to window title if running on XWayland
for_window [shell="xwayland"] title_format "%title [XWayland]"
# Load X resources
exec "[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources"
exec "[[ -f ~/.Xresources.local ]] && xrdb -merge ~/.Xresources.local"
# GENERAL KEYBINDINGS
# ~~~~~~~~~~~~~~~~~~~
# Start a terminal (in default or in floating mode)
bindsym $mod+Return exec $terminal
bindsym $mod+Shift+Return exec $terminal_floating
# Start application launcher
bindsym $mod+d exec $app_launcher
bindsym $mod+Shift+d exec $app_launcher_alt
# Reload sway config file
bindsym $mod+Shift+c reload
# Exit sway (logs you out of your session)
bindsym $mod+Shift+e exec swaynag -t warning \
-m 'Do you really want to exit sway? This will end your Wayland session.' \
-B 'Yes, exit sway' 'swaymsg exit'
# WINDOW MANAGEMENT
# ~~~~~~~~~~~~~~~~~
# Kill focused window
bindsym $mod+q kill
# Change window focus with [hjkl]
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# Move focused window with [hjkl]
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l move right
# Split container in horizontal or vertical orientation or undo split
bindsym $mod+s split toggle
bindsym $mod+Shift+s split none
# Change container layout (toggle split orientation, tabbed)
bindsym $mod+e layout toggle split
bindsym $mod+t layout toggle tabbed split
# Focus the parent or child container
bindsym $mod+a focus parent
bindsym $mod+shift+a focus child
# Toggle floating mode for focused window
# TODO: Try different bindings?
bindsym $mod+Shift+space floating toggle
#bindsym $mod+Shift+slash floating toggle
# Switch focus between floating / tiling windows
# TODO: Try different bindings?
bindsym $mod+space focus mode_toggle
#bindsym $mod+slash focus mode_toggle
# Toggle fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# Switch back and forth between the current and the previous workspace
bindsym $mod+Tab workspace back_and_forth
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+backslash move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+backslash scratchpad show
# Define resize mode
mode "move & resize" {
# Set move and resize rates
set $MOVE_NORMAL 40 px
set $MOVE_SLOW 10 px
set $MOVE_FAST 120 px
set $RESIZE_NORMAL 40 px or 5 ppt
set $RESIZE_SLOW 10 px or 1 ppt
set $RESIZE_FAST 120 px or 10 ppt
# Exit to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
# Change window focus with mod key (like in regular mode)
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
# Switch focus between floating / tiling windows
bindsym $mod+space focus mode_toggle
# Move focused window with Alt + [hjkl]
bindsym Mod1+h move left $MOVE_NORMAL
bindsym Mod1+j move down $MOVE_NORMAL
bindsym Mod1+k move up $MOVE_NORMAL
bindsym Mod1+l move right $MOVE_NORMAL
# Move focused window faster with Shift + Alt + [hjkl]
bindsym Mod1+Shift+h move left $MOVE_FAST
bindsym Mod1+Shift+j move down $MOVE_FAST
bindsym Mod1+Shift+k move up $MOVE_FAST
bindsym Mod1+Shift+l move right $MOVE_FAST
# Move focused window slower with Ctrl + Alt + [hjkl]
bindsym Mod1+Ctrl+h move left $MOVE_SLOW
bindsym Mod1+Ctrl+j move down $MOVE_SLOW
bindsym Mod1+Ctrl+k move up $MOVE_SLOW
bindsym Mod1+Ctrl+l move right $MOVE_SLOW
# Resize window with [hjkl]
bindsym h resize shrink width $RESIZE_NORMAL
bindsym j resize grow height $RESIZE_NORMAL
bindsym k resize shrink height $RESIZE_NORMAL
bindsym l resize grow width $RESIZE_NORMAL
# Resize window faster with Shift + [hjkl]
bindsym Shift+h resize shrink width $RESIZE_FAST
bindsym Shift+j resize grow height $RESIZE_FAST
bindsym Shift+k resize shrink height $RESIZE_FAST
bindsym Shift+l resize grow width $RESIZE_FAST
# Resize window more precisely with Ctrl + [hjkl]
bindsym Ctrl+h resize shrink width $RESIZE_SLOW
bindsym Ctrl+j resize grow height $RESIZE_SLOW
bindsym Ctrl+k resize shrink height $RESIZE_SLOW
bindsym Ctrl+l resize grow width $RESIZE_SLOW
# Set defined sizes for windows
bindsym 1 resize set width 25 ppt
bindsym 2 resize set width 33 ppt
bindsym 3 resize set width 50 ppt
bindsym 4 resize set width 67 ppt
bindsym 5 resize set width 75 ppt
bindsym 6 resize set width 100 ppt
bindsym Shift+1 resize set height 25 ppt
bindsym Shift+2 resize set height 33 ppt
bindsym Shift+3 resize set height 50 ppt
bindsym Shift+4 resize set height 67 ppt
bindsym Shift+5 resize set height 75 ppt
bindsym Shift+6 resize set height 100 ppt
bindsym $mod+1 resize set 25 ppt 25 ppt; move position center
bindsym $mod+2 resize set 33 ppt 33 ppt; move position center
bindsym $mod+3 resize set 50 ppt 50 ppt; move position center
bindsym $mod+4 resize set 67 ppt 67 ppt; move position center
bindsym $mod+5 resize set 75 ppt 75 ppt; move position center
bindsym $mod+6 resize set 95 ppt 95 ppt; move position center
# Center floating window with c
bindsym c move position center
bindsym $mod+c move position center
}
# Switch to resize mode
bindsym $mod+r mode "move & resize"
# KEYBINDINGS FOR SYSTEM CONTROL
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Lock screen
bindsym $mod+Delete exec "swaylock"
bindsym $mod+Shift+Pause exec "swaylock"
# Suspend system
bindsym --locked $mod+Pause exec "systemctl suspend"
# Volume keys (allow on lock screen)
bindsym --locked XF86AudioRaiseVolume exec "volctl up"
bindsym --locked XF86AudioLowerVolume exec "volctl down"
bindsym --locked XF86AudioMute exec "volctl mute toggle"

View file

@ -0,0 +1,19 @@
# Configure input devices.
# (These should be sensible defaults for our devices; replace file with local file if needed.)
# Set keyboard layout
input type:keyboard {
xkb_layout "us"
xkb_variant "altgr-intl"
# Replace caps lock key with return, use menu key for compose
xkb_options "caps:return,compose:menu"
}
# Configure touchpad
input type:touchpad {
tap enabled
drag_lock disabled
scroll_factor 0.5
}

View file

@ -0,0 +1,75 @@
# Configures output devices.
# (This file is rather device-specific; it was made for roxy but can be used as a base for other devices.)
# OUTPUT VARIABLES
# ~~~~~~~~~~~~~~~~
# Define short names for screens.
set $OUTPUT_INTERNAL eDP-1
set $OUTPUT_OFFICE_PRIMARY "LG Electronics LG ULTRAWIDE 0x0008F23D"
set $OUTPUT_OFFICE_SECONDARY "Dell Inc. DELL U2422HE 5KTPNM3"
# Define which outputs are the primary, secondary and tertiary screens. Used to assign workspaces.
# Can be a list of output names, in which case the first valid (connected) output in the list will be used.
# (Don't specify internal display as fallback, otherwise workspaces might be assigned to it while in docked mode.)
set $OUTPUT_PRIMARY $OUTPUT_OFFICE_PRIMARY
set $OUTPUT_SECONDARY $OUTPUT_OFFICE_SECONDARY
set $OUTPUT_TERTIARY $OUTPUT_INTERNAL
# Define spatial orientation of screens.
# Used for keybindings to switch between outputs (comma, period, slash).
# (Only single names allowed, "focus output" sadly doesn't work with fallback output names.)
set $OUTPUT_LEFT $OUTPUT_OFFICE_PRIMARY
set $OUTPUT_CENTER $OUTPUT_OFFICE_SECONDARY
set $OUTPUT_RIGHT $OUTPUT_INTERNAL
# OUTPUT SETTINGS
# ~~~~~~~~~~~~~~~
# Set the wallpaper for all outputs
output "*" background ~/.wallpapers/desktop fill #000000
# Office: Primary screen (LG ultra-wide, 2560x1080)
output $OUTPUT_OFFICE_PRIMARY {
# Place left-most
position 0 0
scale 1
}
# Office: Secondary screen (Dell, 1920x1080)
output $OUTPUT_OFFICE_SECONDARY {
# Place right of primary screen
position 2560 0
scale 1
}
# Internal laptop screen (1920x1080)
# (Standalone if not docked, or tertiary screen when docked in office)
output $OUTPUT_INTERNAL {
scale 1.25
}
# Switch focus to primary screen on start
# (Note: "focus output" sadly doesn't work with fallback outputs (like the workspace assignment),
# but that's okay: If we're docked, this works. Otherwise, there's only one screen anyway.)
exec swaymsg focus output $OUTPUT_OFFICE_PRIMARY
# OUTPUT KEYBINDINGS
# ~~~~~~~~~~~~~~~~~~
# Keybindings to switch focus between screens
bindsym $mod+comma focus output $OUTPUT_LEFT
bindsym $mod+period focus output $OUTPUT_CENTER
bindsym $mod+slash focus output $OUTPUT_RIGHT
# Keybindings to move focused window/container between screens
bindsym $mod+Shift+comma move container to output $OUTPUT_LEFT; focus output $OUTPUT_LEFT
bindsym $mod+Shift+period move container to output $OUTPUT_CENTER; focus output $OUTPUT_CENTER
bindsym $mod+Shift+slash move container to output $OUTPUT_RIGHT; focus output $OUTPUT_RIGHT
# Keybindings to move entire workspace between screens
bindsym $mod+Control+comma move workspace to output $OUTPUT_LEFT
bindsym $mod+Control+period move workspace to output $OUTPUT_CENTER
bindsym $mod+Control+slash move workspace to output $OUTPUT_RIGHT

View file

@ -0,0 +1,153 @@
# Define workspaces and keybindings to switch or move windows between them.
# WORKSPACE VARIABLES
# ~~~~~~~~~~~~~~~~~~~
# Define primary set of workspaces, accessed with the number key row (including [`] for WS0,
# [-] for WS11 and [=] for WS12). Will be assigned to primary output (with exceptions).
set $WS0 0
set $WS1 "1: www"
set $WS2 "2: code"
set $WS3 3
set $WS4 4
set $WS5 5
set $WS6 6
set $WS7 7
set $WS8 8
set $WS9 9
set $WS10 "10: mail"
set $WS11 "11: music"
set $WS12 "12: chat"
# Define secondary set of workspaces, accessed with the F1-F12 keys.
# Will be assigned to secondary and tertiary output if present.
set $WSf1 "F1"
set $WSf2 "F2"
set $WSf3 "F3"
set $WSf4 "F4"
set $WSf5 "F5"
set $WSf6 "F6"
set $WSf7 "F7"
set $WSf8 "F8"
set $WSf9 "F9"
set $WSf10 "F10"
set $WSf11 "F11"
set $WSf12 "F12"
# WORKSPACE ASSIGNMENTS
# ~~~~~~~~~~~~~~~~~~~~~
# (Uses output variables as defined in 30_output.)
# Define primary workspaces and assign them to screens.
workspace $WS0 output $OUTPUT_PRIMARY
workspace $WS1 output $OUTPUT_PRIMARY
workspace $WS2 output $OUTPUT_PRIMARY
workspace $WS3 output $OUTPUT_PRIMARY
workspace $WS4 output $OUTPUT_PRIMARY
workspace $WS5 output $OUTPUT_PRIMARY
workspace $WS6 output $OUTPUT_PRIMARY
workspace $WS7 output $OUTPUT_PRIMARY
workspace $WS8 output $OUTPUT_PRIMARY
workspace $WS9 output $OUTPUT_PRIMARY
workspace $WS10 output $OUTPUT_PRIMARY
workspace $WS11 output $OUTPUT_SECONDARY
workspace $WS12 output $OUTPUT_SECONDARY
# Define secondary workspaces and assign them to screens.
workspace $WSf1 output $OUTPUT_SECONDARY
workspace $WSf2 output $OUTPUT_SECONDARY
workspace $WSf3 output $OUTPUT_SECONDARY
workspace $WSf4 output $OUTPUT_SECONDARY
workspace $WSf5 output $OUTPUT_SECONDARY
workspace $WSf6 output $OUTPUT_SECONDARY
workspace $WSf7 output $OUTPUT_SECONDARY
workspace $WSf8 output $OUTPUT_SECONDARY
workspace $WSf9 output $OUTPUT_TERTIARY
workspace $WSf10 output $OUTPUT_TERTIARY
workspace $WSf11 output $OUTPUT_TERTIARY
workspace $WSf12 output $OUTPUT_TERTIARY
# WORKSPACE KEYBINDINGS
# ~~~~~~~~~~~~~~~~~~~~~
# Switch focus between workspaces
bindsym $mod+grave workspace number $WS0
bindsym $mod+1 workspace number $WS1
bindsym $mod+2 workspace number $WS2
bindsym $mod+3 workspace number $WS3
bindsym $mod+4 workspace number $WS4
bindsym $mod+5 workspace number $WS5
bindsym $mod+6 workspace number $WS6
bindsym $mod+7 workspace number $WS7
bindsym $mod+8 workspace number $WS8
bindsym $mod+9 workspace number $WS9
bindsym $mod+0 workspace number $WS10
bindsym $mod+minus workspace number $WS11
bindsym $mod+equal workspace number $WS12
bindsym $mod+F1 workspace $WSf1
bindsym $mod+F2 workspace $WSf2
bindsym $mod+F3 workspace $WSf3
bindsym $mod+F4 workspace $WSf4
bindsym $mod+F5 workspace $WSf5
bindsym $mod+F6 workspace $WSf6
bindsym $mod+F7 workspace $WSf7
bindsym $mod+F8 workspace $WSf8
bindsym $mod+F9 workspace $WSf9
bindsym $mod+F10 workspace $WSf10
bindsym $mod+F11 workspace $WSf11
bindsym $mod+F12 workspace $WSf12
# Move focused container to workspace (and switch to that workspace)
bindsym $mod+Shift+grave move container to workspace number $WS0; workspace $WS0
bindsym $mod+Shift+1 move container to workspace number $WS1; workspace $WS1
bindsym $mod+Shift+2 move container to workspace number $WS2; workspace $WS2
bindsym $mod+Shift+3 move container to workspace number $WS3; workspace $WS3
bindsym $mod+Shift+4 move container to workspace number $WS4; workspace $WS4
bindsym $mod+Shift+5 move container to workspace number $WS5; workspace $WS5
bindsym $mod+Shift+6 move container to workspace number $WS6; workspace $WS6
bindsym $mod+Shift+7 move container to workspace number $WS7; workspace $WS7
bindsym $mod+Shift+8 move container to workspace number $WS8; workspace $WS8
bindsym $mod+Shift+9 move container to workspace number $WS9; workspace $WS9
bindsym $mod+Shift+0 move container to workspace number $WS10; workspace $WS10
bindsym $mod+Shift+minus move container to workspace number $WS11; workspace $WS11
bindsym $mod+Shift+equal move container to workspace number $WS12; workspace $WS12
bindsym $mod+Shift+F1 move container to workspace $WSf1; workspace $WSf1
bindsym $mod+Shift+F2 move container to workspace $WSf2; workspace $WSf2
bindsym $mod+Shift+F3 move container to workspace $WSf3; workspace $WSf3
bindsym $mod+Shift+F4 move container to workspace $WSf4; workspace $WSf4
bindsym $mod+Shift+F5 move container to workspace $WSf5; workspace $WSf5
bindsym $mod+Shift+F6 move container to workspace $WSf7; workspace $WSf7
bindsym $mod+Shift+F8 move container to workspace $WSf8; workspace $WSf8
bindsym $mod+Shift+F9 move container to workspace $WSf9; workspace $WSf9
bindsym $mod+Shift+F10 move container to workspace $WSf10; workspace $WSf10
bindsym $mod+Shift+F11 move container to workspace $WSf11; workspace $WSf11
bindsym $mod+Shift+F12 move container to workspace $WSf12; workspace $WSf12
# Move focused container to workspace (without switching the workspace)
bindsym $mod+Ctrl+Shift+grave move container to workspace number $WS0
bindsym $mod+Ctrl+Shift+1 move container to workspace number $WS1
bindsym $mod+Ctrl+Shift+2 move container to workspace number $WS2
bindsym $mod+Ctrl+Shift+3 move container to workspace number $WS3
bindsym $mod+Ctrl+Shift+4 move container to workspace number $WS4
bindsym $mod+Ctrl+Shift+5 move container to workspace number $WS5
bindsym $mod+Ctrl+Shift+6 move container to workspace number $WS6
bindsym $mod+Ctrl+Shift+7 move container to workspace number $WS7
bindsym $mod+Ctrl+Shift+8 move container to workspace number $WS8
bindsym $mod+Ctrl+Shift+9 move container to workspace number $WS9
bindsym $mod+Ctrl+Shift+0 move container to workspace number $WS10
bindsym $mod+Ctrl+Shift+minus move container to workspace number $WS11
bindsym $mod+Ctrl+Shift+equal move container to workspace number $WS12
bindsym $mod+Ctrl+Shift+F1 move container to workspace $WSf1
bindsym $mod+Ctrl+Shift+F2 move container to workspace $WSf2
bindsym $mod+Ctrl+Shift+F3 move container to workspace $WSf3
bindsym $mod+Ctrl+Shift+F4 move container to workspace $WSf4
bindsym $mod+Ctrl+Shift+F5 move container to workspace $WSf5
bindsym $mod+Ctrl+Shift+F6 move container to workspace $WSf7
bindsym $mod+Ctrl+Shift+F8 move container to workspace $WSf8
bindsym $mod+Ctrl+Shift+F9 move container to workspace $WSf9
bindsym $mod+Ctrl+Shift+F10 move container to workspace $WSf10
bindsym $mod+Ctrl+Shift+F11 move container to workspace $WSf11
bindsym $mod+Ctrl+Shift+F12 move container to workspace $WSf12

View file

@ -0,0 +1,43 @@
# Define launch keybindings and rules for automatically assigning windows to specific
# workspaces/outputs to make them floating by default, etc.
# LAUNCH KEYBINDINGS
# ~~~~~~~~~~~~~~~~~~
# Password manager
bindsym $mod+p exec passrofi
# Pavucontrol
bindsym $mod+Mod1+p exec pavucontrol
# Screenshot tool (Mod1 is Alt)
# (Uses our custom screenshot tool ~/bin/wlscreenshot.)
bindsym Print exec wlscreenshot screen
bindsym Mod1+Print exec wlscreenshot window
# Quick screenshots (saved directly without editing)
bindsym Ctrl+Print exec wlscreenshot --quick screen
bindsym Ctrl+Mod1+Print exec wlscreenshot --quick window
# Open file browser
# TODO: A keybinding to open a file browser in floating mode would be good. THis doesn't work
# with Nemo because it always runs in a shared process, so using "--name=" only works for the
# first window and is applied to all other windows as well. Maybe a different file browser?)
# TODO: Keybind? n, b, o?
bindsym $mod+n exec nemo
# Emoji selector
bindsym $mod+m exec rofi -show emoji
# WINDOW RULES
# ~~~~~~~~~~~~
# Floating terminal windows (depends on terminal emulator)
for_window [app_id="^(kitty|sakura)-floating$"] floating enable
# Pavucontrol: Always floating
for_window [app_id="^org.pulseaudio.pavucontrol$"] floating enable
# Flameshot: Always floating
for_window [app_id="^flameshot$"] floating enable, fullscreen disable

View file

@ -0,0 +1,15 @@
# Additional keybindings and window rules not necessary on each device (e.g. used on private
# laptop but not on work laptop.)
# LAUNCH KEYBINDINGS
# ~~~~~~~~~~~~~~~~~~
# WINDOW RULES
# ~~~~~~~~~~~~
# Godot debug windows (also applies to our custom engine with "(DEBUG)" in the title)
for_window [title="\(DEBUG\)$"] floating enable
for_window [app_id="^org.godotengine.Editor$"] floating disable
# QEMU
for_window [app_id="^qemu$"] floating enable

View file

@ -0,0 +1,17 @@
# Configure swaybar using i3status.
bar {
status_command i3status
colors {
background #000000
statusline #ffffff
separator #666666
focused_workspace #880044 #bb0066 #ffffff
active_workspace #333333 #5f676a #ffffff
inactive_workspace #333333 #222222 #888888
urgent_workspace #2f343a #900000 #ffffff
binding_mode #2f343a #900000 #ffffff
}
}

View file

@ -0,0 +1,8 @@
# Autostart apps and helpers on startup (used on all devices usually).
# Start swayidle, which will take care of locking the screen before sleep.
# (See config: .config/swayidle/config)
exec swayidle -w
# Persistent clipboard
exec wl-clip-persist --clipboard regular

View file

@ -0,0 +1,7 @@
# Additional apps and helpers to autostart (not used on every device, e.g. not on work laptop).
# Start gammastep (redshift fork) with tray indicator
exec gammastep-indicator
# Start Nextcloud
exec nextcloud

View file

@ -0,0 +1,31 @@
# Configuration when using swayfx (sway fork)
# Align title in the center of the titlebar
title_align center
# Remove border around titlebar
titlebar_border_thickness 0
# Remove separator border between titlebar and content (swayfx only)
titlebar_separator disable
# Set default gaps around/between windows to 4px, except the top of the screen
gaps inner 4
gaps top -4
# Set window corner radius (swayfx only)
corner_radius 6
# Always show corner radius (swayfx only)
smart_corner_radius disable
# Window shadows (swayfx only)
shadows enable
shadows_on_csd enable
shadow_blur_radius 12
# Window blur for transparent windows (swayfx only)
blur enable
blur_xray disable
blur_passes 2
blur_radius 2