2023-12-30 11:57:33 +00:00
# docs:
# - `man 5 sway`
#
2023-09-04 23:49:15 +00:00
# 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@
2024-03-08 09:56:15 +00:00
# N.B.: volume_up/volume_down are factored out because they're potentially used by `extra_lines` down below.
# `@DEFAULT_AUDIO_SINK@` is interpreted by wireplumber; not nix
set $volume_up wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
set $volume_down wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
set $mute wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
2023-09-05 04:25:58 +00:00
set $default_workspace_layout @workspace_layout@
2023-09-04 23:49:15 +00:00
2024-03-08 09:50:35 +00:00
set $out_tv "LG Electronics LG TV 0x01010101"
set $out_projector "MS Telematica TV 0x00000001"
set $out_desko_1 "LG Electronics LG ULTRAWIDE 0x00004E94"
set $out_desko_2 "Samsung Electric Company S22C300 0x00007F35"
set $out_lappy "BOE 0x0637 Unknown"
# DSI-1 a.k.a. "Unknown Unknown Unknown"
set $out_moby "DSI-1"
2023-09-05 01:05:59 +00:00
### default font (for e.g. window titles)
2023-09-05 04:25:58 +00:00
font @font@
2023-09-05 01:05:59 +00:00
### 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
2023-09-04 23:49:15 +00:00
2023-09-05 16:13:23 +00:00
output '*' bg "@background@" fill
2023-09-04 23:49:15 +00:00
### pixel boundary between windows
2023-09-26 20:36:30 +00:00
# hide_edge_borders --i3 means that single-window workspaces never show window bar
hide_edge_borders --i3 smart
2023-09-05 01:05:59 +00:00
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
2023-09-04 23:49:15 +00:00
2023-09-05 01:05:59 +00:00
### focus_wrapping: behavior when trying to focus past the edge of a container
2023-09-04 23:49:15 +00:00
#### no => preserve last focus. helpful mostly when `focus_follows_mouse yes`
focus_wrapping no
focus_follows_mouse yes
2023-09-05 04:25:58 +00:00
workspace_layout $default_workspace_layout
2023-09-04 23:49:15 +00:00
2024-03-08 06:27:16 +00:00
2023-09-04 23:49:15 +00:00
### key bindings
floating_modifier $mod
2023-09-05 04:25:58 +00:00
#### media keys
2023-09-05 04:51:12 +00:00
# --locked means to keep the binding active even when display is locked/off
2024-02-06 23:52:53 +00:00
bindsym --locked $mod+Page_Up exec $volume_up
bindsym --locked $mod+Page_Down exec $volume_down
2024-03-01 03:29:52 +00:00
bindsym --locked XF86AudioMute exec $mute
2024-02-06 23:52:53 +00:00
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
2024-02-06 23:04:44 +00:00
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
2024-03-01 03:29:52 +00:00
bindsym --locked XF86MonBrightnessUp exec brightnessctl set +5%
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
2023-09-05 04:25:58 +00:00
#### special functions
2024-03-02 05:57:24 +00:00
bindsym Print exec sane-open-desktop sane-screenshot.desktop
bindsym $mod+Print exec sane-open-desktop sane-screenshot.desktop
2024-03-01 04:02:32 +00:00
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
2023-09-04 23:49:15 +00:00
bindsym $mod+Shift+q kill
2024-03-11 04:29:39 +00:00
# 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'
2023-09-04 23:49:15 +00:00
bindsym $mod+Shift+c reload
2023-09-05 04:25:58 +00:00
#### layout
2023-09-04 23:49:15 +00:00
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
2024-02-06 23:13:50 +00:00
# bindsym $mod+Shift+space floating toggle
# bindsym $mod+space focus mode_toggle
2023-09-04 23:49:15 +00:00
bindsym $mod+r mode resize
2023-09-05 04:25:58 +00:00
#### movement
2023-09-04 23:49:15 +00:00
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
2023-09-05 04:25:58 +00:00
#### workspaces
2023-09-04 23:49:15 +00:00
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
2024-03-08 09:42:07 +00:00
bindsym $mod+0 workspace TV
2023-09-04 23:49:15 +00:00
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
2024-03-08 09:42:07 +00:00
bindsym $mod+Shift+0 move container to workspace TV
2023-09-05 04:25:58 +00:00
#### "scratchpad" = ??
2024-02-06 23:13:50 +00:00
# bindsym $mod+Shift+minus move scratchpad
# bindsym $mod+minus scratchpad show
2023-09-04 23:49:15 +00:00
mode "resize" {
2024-03-11 04:29:39 +00:00
bindsym $mod+r mode default
2023-09-04 23:49:15 +00:00
bindsym Escape mode default
bindsym Return mode default
2024-03-11 04:29:39 +00:00
bindsym Down resize grow height 30 px
bindsym Left resize shrink width 30 px
2023-09-05 04:25:58 +00:00
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
2023-09-04 23:49:15 +00:00
}
2024-03-08 06:27:16 +00:00
2023-09-05 04:25:58 +00:00
### application-specific settings
2023-09-21 20:03:19 +00:00
#### to obtain app-id's run `swaymsg -t get_tree`
2023-09-05 04:25:58 +00:00
for_window [title="megapixels"] inhibit_idle open
2023-11-17 04:05:59 +00:00
# workspace assignments
2024-03-08 09:50:35 +00:00
workspace TV output $out_tv $out_projector
2024-03-08 09:42:07 +00:00
for_window [workspace="TV"] fullscreen enable
2023-11-17 04:05:59 +00:00
# mostly, messengers belong on WS 1
2024-03-08 09:53:07 +00:00
assign [app_id="im.dino.Dino"] workspace number 1
assign [app_id="org.gnome.Fractal"] workspace number 1
assign [app_id="geary"] workspace number 1
assign [app_id="signal"] workspace number 1
assign [app_id="so.libdb.gtkcord4"] workspace number 1
assign [app_id="abaddon"] workspace number 1
2023-09-05 04:25:58 +00:00
2023-12-30 11:57:33 +00:00
# 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
2024-03-08 04:04:40 +00:00
for_window [app_id="deadd-notification-center"] {
border none
# anchor it to the right edge of the screen
# hardcoding the width here: keep in sync
move position 100 ppt 0 ppt
move left 360
}
2024-03-08 09:50:35 +00:00
# Celeste64: only works if Celeste doesn't itself request fullscreen (else, random chance of which display it gets).
# so enter in-game options and disable "Fullscreen", then we manage it here ourselves
for_window [app_id="Celeste64|mpv"] {
move to output $out_projector
move to output $out_tv
}
2024-03-08 06:27:16 +00:00
2024-03-11 04:29:39 +00:00
### displays & inputs
input type:touchpad {
tap enabled
natural_scroll enabled
}
2024-03-08 09:50:35 +00:00
## SHARED
# TV
output $out_tv {
pos 1920,0
res 1920x1080
# 4k is limited to 30Hz; 1080p is the next-highest resolution (at 120Hz)
# res 3840x2160
}
# projector
output $out_projector {
pos 5360,0
res 1920x1080
}
2023-09-04 23:49:15 +00:00
## DESKTOP
2024-03-08 09:50:35 +00:00
output $out_desko_1 {
2023-09-04 23:49:15 +00:00
pos 0,0
2023-11-21 08:18:35 +00:00
res 3440x1440
}
2024-03-08 09:50:35 +00:00
output $out_desko_2 {
2023-11-21 08:18:35 +00:00
pos 3440,0
2023-09-04 23:49:15 +00:00
res 1920x1080
}
## LAPTOP
2024-03-06 21:18:43 +00:00
# laptop internal display (a.k.a. "eDP-1")
2024-03-08 09:50:35 +00:00
input "1386:20606:Wacom_Pen_and_multitouch_sensor_Pen" map_to_output $out_lappy
input "1386:20606:Wacom_Pen_and_multitouch_sensor_Finger" map_to_output $out_lappy
output $out_lappy {
2024-03-06 19:03:13 +00:00
pos 0,0
2023-09-04 23:49:15 +00:00
res 1920x1080
}
2024-03-06 19:02:23 +00:00
## MOBILE
2024-03-01 04:38:26 +00:00
# pinephone internal display (a.k.a. "Unknown Unknown Unknown")
2024-03-08 09:50:35 +00:00
input "1046:4097:Goodix_Capacitive_TouchScreen" map_to_output $out_moby
output $out_moby {
2024-03-08 02:21:47 +00:00
# scale defaults to 2 in portrait mode, 1 in landscape
scale 2
# scale 1.6
}
2023-09-04 23:49:15 +00:00
2024-03-08 06:27:16 +00:00
2024-02-15 14:22:40 +00:00
# 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: <repo:nixos/nixpkgs:nixos/modules/programs/wayland/sway.nix>
2024-02-19 10:52:51 +00:00
#
# 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
2024-02-15 14:22:40 +00:00
# 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:
2023-09-04 23:49:15 +00:00
# - DISPLAY
# - WAYLAND_DISPLAY
# - SWAYSOCK
# - XDG_CURRENT_DESKTOP
2024-02-15 14:22:40 +00:00
# include /etc/sway/config.d/*
2023-09-05 04:25:58 +00:00
2024-02-02 14:20:30 +00:00
# signal to systemd that sway is active,
2024-02-19 10:52:51 +00:00
# and therefore let it start any downstream services (e.g. apps that would like to auto-start)
2024-02-02 14:20:30 +00:00
# see `systemctl --user cat sway-session` for links to docs
exec --no-startup-id systemctl start --user sway-session.service
2023-09-05 04:25:58 +00:00
@extra_lines@