# docs: # - `man 5 sway` # # xwayland enable|disable|force # - enable: lazily launch xwayland on first client connection # - disable: never launch xwayland # - force: launch xwayland immediately on boot # XWayland exposes a X11 server that translates the protocol to a wayland backend, allowing legacy x11-only GUI apps. # XWayland uses about 35MB RSS even when idle xwayland @xwayland@ set $mod @mod@ # N.B.: volume_up/volume_down are factored out because they're potentially used by `extra_lines` down below # TODO: use native pipewire controls instead of pulsemixer? set $volume_up pulsemixer --change-volume +5 set $volume_down pulsemixer --change-volume -5 set $mute pulsemixer --toggle-mute set $default_workspace_layout @workspace_layout@ ### default font (for e.g. window titles) font @font@ ### tab colors (#border #background #text [#indicator #childBorder]) # focused & unfocused are the main interest # urgent is used when an inactive window wants attention (e.g. terminal rings a bell) # colors are synchronized with waybar and mpv client.focused #1f5e54 #418379 #ffffff client.focused_inactive #1f5e54 #5f676a #ffffff client.unfocused #1f5e54 #1f554c #b4b4b4 client.urgent #ff8080 #ff8080 #ffffff output '*' bg "@background@" fill ### pixel boundary between windows # hide_edge_borders --i3 means that single-window workspaces never show window bar hide_edge_borders --i3 smart default_border pixel 1 titlebar_border_thickness 1 # XX YY distance from edge of window title to edge of text # the YY distance here determines the heigh of the overall title titlebar_padding 12 1 title_align center ### focus_wrapping: behavior when trying to focus past the edge of a container #### no => preserve last focus. helpful mostly when `focus_follows_mouse yes` focus_wrapping no focus_follows_mouse yes workspace_layout $default_workspace_layout ### key bindings floating_modifier $mod #### media keys # --locked means to keep the binding active even when display is locked/off bindsym --locked $mod+Page_Up exec $volume_up bindsym --locked $mod+Page_Down exec $volume_down bindsym --locked XF86AudioMute exec $mute bindsym --locked $mod+Space exec playerctl play-pause bindsym --locked $mod+Shift+Page_Down exec playerctl previous bindsym --locked $mod+Shift+Page_Up exec playerctl next bindsym --locked XF86AudioPlay exec playerctl play-pause bindsym --locked XF86AudioStop exec playerctl stop bindsym --locked XF86AudioNext exec playerctl next bindsym --locked XF86AudioPrev exec playerctl previous bindsym --locked XF86MonBrightnessUp exec brightnessctl set +5% bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%- #### special functions bindsym Print exec sane-open-desktop sane-screenshot.desktop bindsym $mod+Print exec sane-open-desktop sane-screenshot.desktop bindsym $mod+l exec sane-open-desktop swaylock.desktop bindsym $mod+s exec sane-open-desktop rofi-snippets.desktop bindsym $mod+slash exec sane-open-desktop splatmoji.desktop bindsym $mod+d exec sane-open-desktop rofi.desktop bindsym $mod+Return exec sane-open-desktop xdg-terminal-exec.desktop bindsym $mod+Shift+q kill bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' bindsym $mod+Shift+c reload #### layout bindsym $mod+b splith bindsym $mod+v splitv bindsym $mod+f fullscreen toggle bindsym $mod+a focus parent bindsym $mod+w layout tabbed bindsym $mod+e layout toggle split # bindsym $mod+Shift+space floating toggle # bindsym $mod+space focus mode_toggle bindsym $mod+r mode resize #### movement bindsym $mod+Up focus up bindsym $mod+Down focus down bindsym $mod+Left focus left bindsym $mod+Right focus right bindsym $mod+Shift+Up move up bindsym $mod+Shift+Down move down bindsym $mod+Shift+Left move left bindsym $mod+Shift+Right move right #### workspaces bindsym $mod+1 workspace number 1 bindsym $mod+2 workspace number 2 bindsym $mod+3 workspace number 3 bindsym $mod+4 workspace number 4 bindsym $mod+5 workspace number 5 bindsym $mod+6 workspace number 6 bindsym $mod+7 workspace number 7 bindsym $mod+8 workspace number 8 bindsym $mod+9 workspace number 9 bindsym $mod+Shift+1 move container to workspace number 1 bindsym $mod+Shift+2 move container to workspace number 2 bindsym $mod+Shift+3 move container to workspace number 3 bindsym $mod+Shift+4 move container to workspace number 4 bindsym $mod+Shift+5 move container to workspace number 5 bindsym $mod+Shift+6 move container to workspace number 6 bindsym $mod+Shift+7 move container to workspace number 7 bindsym $mod+Shift+8 move container to workspace number 8 bindsym $mod+Shift+9 move container to workspace number 9 #### "scratchpad" = ?? # bindsym $mod+Shift+minus move scratchpad # bindsym $mod+minus scratchpad show mode "resize" { bindsym Down resize grow height 30 px bindsym Escape mode default bindsym Left resize shrink width 30 px bindsym Return mode default bindsym Right resize grow width 30 px bindsym Up resize shrink height 30 px bindsym h resize shrink width 30 px bindsym j resize grow height 30 px bindsym k resize shrink height 30 px bindsym l resize grow width 30 px } ### application-specific settings #### to obtain app-id's run `swaymsg -t get_tree` for_window [title="megapixels"] inhibit_idle open # workspace assignments # mostly, messengers belong on WS 1 for_window [app_id="im.dino.Dino"] move container to workspace number 1 for_window [app_id="org.gnome.Fractal"] move container to workspace number 1 for_window [app_id="geary"] move container to workspace number 1 for_window [app_id="signal"] move container to workspace number 1 for_window [app_id="so.libdb.gtkcord4"] move container to workspace number 1 for_window [app_id="abaddon"] move container to workspace number 1 # window display settings # force KOReader to always display a titlebar, even when the only window being rendered. # desirable primarily to avoid slooow reflows when another app is opened. but also nice to have the book title rendered. for_window [app_id="KOReader"] border normal ### displays ## DESKTOP output "LG Electronics LG ULTRAWIDE 0x00004E94" { pos 0,0 res 3440x1440 } output "Samsung Electric Company S22C300 0x00007F35" { pos 3440,0 res 1920x1080 } # projector output "MS Telematica TV 0x00000001" { pos 5360,0 res 1920x1080 } ## LAPTOP # sh/en TV output "Pioneer Electronic Corporation VSX-524 0x00000101" { pos 0,0 res 1920x1080 } # laptop internal display output "Unknown 0x0637 0x00000000" { pos 1920,0 res 1920x1080 } # pinephone internal display (a.k.a. "Unknown Unknown Unknown") # output "DSI-1" { # scale 1.6 # } # manually export PATH here, since all my user services need that, and sane-sandboxed implementation depends on it. # also, manually export XDG_DATA_DIRS. glib fails in weird ways (e.g. thinks everything is application/x-octet-stream mime type) without it. # for more, see: # # XXX: dbus-update-activation-environment --systemd is ASYNCHRONOUS. it returns before the systemd environment is actually updated. # hence, call `systemctl import-environment` ourselves. i could probably remove the dbus stuff and be safe, but at least for now it's an OK backup. exec --no-startup-id systemctl --user import-environment PATH XDG_DATA_DIRS DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP exec --no-startup-id dbus-update-activation-environment --systemd PATH XDG_DATA_DIRS DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP # previously: `include /etc/sway/config.d/*` was needed for xdg-desktop-portal-* to work. # stock nixos `programs.sway` would setup /etc/sway/config.d with additional variables to import to the dbus env. # but now i'm doing that manually: # - DISPLAY # - WAYLAND_DISPLAY # - SWAYSOCK # - XDG_CURRENT_DESKTOP # include /etc/sway/config.d/* # signal to systemd that sway is active, # and therefore let it start any downstream services (e.g. apps that would like to auto-start) # see `systemctl --user cat sway-session` for links to docs exec --no-startup-id systemctl start --user sway-session.service @extra_lines@