dotfiles/.config/sway/config
Ben Vincent b5dee7e0f2 multiple updates
- update swayrc with 4k monitor
- update popterm
- update nvim lsp config
- add helm-ls
- remove yaml/ansible lsps
2025-12-07 20:50:11 +11:00

342 lines
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
set $mod Mod4
set $term alacritty
set $termalt xfce4-terminal
set $web firefox
set $file ranger
set $lock slock
set $code codium
set $guieditor geany
set $calc /home/ben/.local/bin/bc-launcher
set $music /home/ben/.local/bin/ncmpcpp-launcher
# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
set $menu dmenu_path | dmenu | xargs swaymsg exec --
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg /usr/share/backgrounds/default.png fill
### Idle configuration
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
exec swayidle -w \
timeout 300 'swaylock -f -c 000000' \
timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
before-sleep 'swaylock -f -c 000000'
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:monospace 8
# This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8
# network manager applet: manage wifi, ethernet and vpns
exec --no-startup-id nm-applet
# bluetooth manager applet: manage bluetooth pairing and connections
#exec --no-startup-id blueman-applet
# udiskie: manage usb storage devices
exec --no-startup-id udiskie -a -n -t
# dunst: a notification daemon
exec --no-startup-id dunst
# Audio controls
# Use pamixer to adjust volume in PulseAudio.
bindsym --locked XF86AudioRaiseVolume exec pamixer --increase 5
bindsym --locked XF86AudioLowerVolume exec pamixer --decrease 5
bindsym --locked XF86AudioMute exec pamixer --toggle-mute
bindsym XF86AudioMicMute exec pamixer --toggle-mute --default-source
bindsym --locked $mod+greater exec pamixer --increase 5
bindsym --locked $mod+less exec pamixer --decrease 5
# backlight brightness
bindsym XF86MonBrightnessDown exec brightnessctl set 5%- # decrease screen brightness
bindsym XF86MonBrightnessUp exec brightnessctl set +5% # increase screen brightness
bindsym $mod+F8 exec brightnessctl set 5-% # decrease screen brightness
bindsym $mod+F9 exec brightnessctl set +5% # increase screen brightness
# Use Mouse+$mod to drag floating windows to their wanted position
floating_modifier $mod
# start a terminal
bindsym $mod+Return exec $term
bindsym $mod+Shift+Return exec $termalt
# start a web browser
bindsym $mod+F1 exec $web
# start a file manager
bindsym $mod+F2 exec $file
# start an ide
bindsym $mod+F3 exec $code
# start a gui notepad
bindsym $mod+F4 exec $guieditor
# kill focused window
bindsym $mod+Shift+q kill
# start rofi in drun mode (a program launcher)
bindsym $mod+d exec --no-startup-id "rofi -show drun -font \\"DejaVu 9\\" -run-shell-command '{terminal} -e \\" {cmd}; read -n 1 -s\\"'"
#bindsym $mod+shift+d exec selected=$(ls ~/rdp/ntschools/|rofi -dmenu -p "Run: ")&&zsh ~/rdp/ntschools/$selected
# A more modern dmenu replacement is rofi:
# bindcode $mod+40 exec "rofi -modi drun,run -show drun"
# There also is i3-dmenu-desktop which only displays applications shipping a
# .desktop file. It is a wrapper around dmenu, so you need that installed.
# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop
# change focus
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# move focused window
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
# split in horizontal orientation
bindsym $mod+h split v ;; exec $term
# split in vertical orientation
bindsym $mod+v split h ;; exec $term
# enter fullscreen mode for the focused container
bindsym $mod+f fullscreen toggle
# change container layout (stacked, tabbed, toggle split)
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# toggle tiling / floating
bindsym $mod+Shift+space floating toggle
# change focus between tiling / floating windows
bindsym $mod+space focus mode_toggle
# focus the parent container
bindsym $mod+a focus parent
# focus the child container
bindsym $mod+Shift+a focus child
# calculator scratchpad
bindsym $mod+c [title="calc-launcher"] scratchpad show; [title="calc-launcher"] move position center
for_window [title="calc-launcher"] floating enable
for_window [title="calc-launcher"] resize set 800 600
for_window [title="calc-launcher"] move scratchpad
for_window [title="calc-launcher"] border pixel 5
exec --no-startup-id $term -T "calc-launcher" -e "$calc"
# dropdown scratchpad
bindsym $mod+x [title="dropdown"] scratchpad show; [title="dropdown"] move position center
for_window [title="dropdown"] floating enable
for_window [title="dropdown"] resize set 1280 800
for_window [title="dropdown"] move scratchpad
for_window [title="dropdown"] border pixel 5
exec --no-startup-id $term -T "dropdown"
# music scratchpad
bindsym $mod+m [title="music-launcher"] scratchpad show; [title="music-launcher"] move position center
for_window [title="music-launcher"] floating enable
for_window [title="music-launcher"] resize set 800 600
for_window [title="music-launcher"] move scratchpad
for_window [title="music-launcher"] border pixel 5
exec --no-startup-id $term -T "music-launcher" -e "$music"
# f5vpn scratchpad
bindsym $mod+F10 [title="F5 VPN"] scratchpad show; [title="F5 VPN"] move position center
for_window [title="F5 VPN"] floating enable
for_window [title="F5 VPN"] resize set 800 600
for_window [title="F5 VPN"] move scratchpad
for_window [title="F5 VPN"] border pixel 5
# restore scratchpads
bindsym $mod+F11 exec --no-startup-id $term -T "music-launcher" -e "$music"
bindsym $mod+F12 exec --no-startup-id $term -T "calc-launcher" -e "$calc"
# mpd/mpc commands
bindsym $mod+p exec mpc --host $HOME/.config/mpd/socket toggle
# Define names for default workspaces for which we configure key bindings later on.
# We use variables to avoid repeating the names in multiple places.
set $ws1 "1: shell"
set $ws2 "2: web"
set $ws3 "3: code"
set $ws4 "4: lab"
set $ws5 "5: games"
set $ws6 "6"
set $ws7 "7"
set $ws8 "8"
set $ws9 "9"
set $ws10 "10"
# switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2; layout tabbed
bindsym $mod+3 workspace $ws3; layout tabbed
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9
bindsym $mod+0 workspace $ws10
# move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9
bindsym $mod+Shift+0 move container to workspace $ws10
# move focused workspace between monitors
bindsym $mod+Ctrl+greater move workspace to output right
bindsym $mod+Ctrl+less move workspace to output left
# print screen
bindsym --release Print exec grim
bindsym --release $mod+Print exec grim -g "$(slurp)" $HOME/Pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png
bindsym --release $mod+Shift+Print exec grim -g "$(slurp)" - | wl-copy
bindsym --release $mod+Shift+s exec grim -g "$(slurp)" - | wl-copy
# lock screen
#bindsym $mod+l --release exec $lock
bindsym $mod+l exec swaylock --image Pictures/1920x1200/tux-text-1920x1200.png
# reload the configuration file
bindsym $mod+Shift+c reload
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
bindsym $mod+Shift+r restart
# exit sway (logs you out of your wayland session)
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'
# for_windows settings
for_window [class="urxvt"] border pixel 5
for_window [title="Mozilla Firefox"] move container to workspace $ws2
for_window [title="Chromium"] move container to workspace $ws2
for_window [class="VSCodium"] move container to workspace $ws3
for_window [title="Visual Studio Code"] move container to workspace $ws3
for_window [class="xfreerdp"] floating disable move container to workspace $ws4
for_window [title="Picture-in-Picture"] sticky enable
for_window [title="noVNC"] sticky enable floating enable
for_window [title="Proxmox Console"] sticky enable floating enable
for_window [title="feh"] sticky enable floating enable
for_window [title="(?:Open|Save) (?:File|Folder|As)"] floating enable, resize set width 1030 height 710
# waylan = app_id
for_window [app_id="mpv"] inhibit_idle fullscreen
# https://github.com/ValveSoftware/steam-for-linux/issues/1040
for_window [class="^Steam$"] floating disable move container to workspace $ws5
for_window [instance="steamwebhelper"] floating disable move container to workspace $ws5
for_window [class="^Steam$" title="^Friends$"] floating enable
for_window [class="^Steam$" title="Steam - News"] floating enable
for_window [class="^Steam$" title=".* - Chat"] floating enable
for_window [class="^Steam$" title="^Settings$"] floating enable
for_window [class="^Steam$" title=".* - event started"] floating enable
for_window [class="^Steam$" title=".* CD key"] floating enable
for_window [class="^Steam$" title="^Steam - Self Updater$"] floating enable
for_window [class="^Steam$" title="^Screenshot Uploader$"] floating enable
for_window [class="^Steam$" title="^Steam Guard - Computer Authorization Required$"] floating enable
for_window [title="^Steam Keyboard$"] floating enable
# resize window (you can also use the mouse for that)
mode "resize" {
# These bindings trigger as soon as you enter the resize mode
# Pressing left will shrink the windows width.
# Pressing right will grow the windows width.
# Pressing up will shrink the windows height.
# Pressing down will grow the windows height.
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym semicolon resize grow width 10 px or 10 ppt
# same bindings, but for the arrow keys
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
# back to normal: Enter or Escape or $mod+r
bindsym Return mode "default"
bindsym Escape mode "default"
bindsym $mod+r mode "default"
}
bindsym $mod+r mode "resize"
# monitor-mode settings
# use "swaymsg -t get_outputs" to list outputs
set $laptop eDP-1
set $dell1 'Dell Inc. DELL U4320Q D1QV193'
set $dell2 'Dell Inc. DELL U2713HM GK0KD357413L'
set $tv 'Samsung Electric Company SAMSUNG 0x01000E00'
bindswitch --reload --locked lid:on output $laptop disable
bindswitch --reload --locked lid:off output $laptop enable
output $laptop resolution 1920x1080 position 0,0
output $dell1 resolution 3840x2160@59.997Hz position 0,660 transform normal
output $dell2 resolution 2560x1440@59.951Hz position 3840,530 transform 270
output $tv resolution 1920x1080@59.951Hz position 0,660 transform normal
workspace $ws1 output $dell1
workspace $ws2 output $dell2
workspace $ws3 output $dell1
workspace $ws4 output $dell2
# class border bground text indicator child_border
client.focused #6272A4 #6272A4 #F8F8F2 #6272A4 #6272A4
client.focused_inactive #44475A #44475A #F8F8F2 #44475A #44475A
client.unfocused #282A36 #282A36 #BFBFBF #282A36 #282A36
client.urgent #44475A #FF5555 #F8F8F2 #FF5555 #FF5555
client.placeholder #282A36 #282A36 #F8F8F2 #282A36 #282A36
client.background #F8F8F2
#exec_always --no-startup-id $HOME/.config/polybar/start
bar {
swaybar_command waybar
colors {
background #282A36
statusline #F8F8F2
separator #44475A
focused_workspace #44475A #44475A #F8F8F2
active_workspace #282A36 #44475A #F8F8F2
inactive_workspace #282A36 #282A36 #BFBFBF
urgent_workspace #FF5555 #FF5555 #F8F8F2
binding_mode #FF5555 #FF5555 #F8F8F2
}
}