dotfiles/.config/sway/config
surtur ef2e74ed8d
sway: start a session with systemd
* bind waybar to sway.session
* edit zprofile and sway config play nice with systemd
2021-06-11 23:35:09 +02:00

479 lines
14 KiB
Plaintext

# vim: ft=sway
set
{
$mod Mod4
$left h
$down j
$up k
$right l
$lock exec swaylock
$lockt exec ~/utils/bin/sway-locker -t
$keyring "/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh"
$term KITTY_ENABLE_WAYLAND=1 kitty # qterminal alacritty
$menu wofi --show drun
$nutermmenu kitty --class 'launcher' bash -c 'compgen -c | sort -u | fzf | xargs -r kitty'
$bemenu bemenu-run --fork -n --fn 'FiraCode-Retina 17'
$dashpls nwggrid
# $bg "~/Pictures/apod/2019-January-2-The-Orion-Nebula-in-Infrared-from-WISE.jpg fit #000000"
# $bg "~/Pictures/apod/2020-April-29-The-Ion-Tail-of-New-Comet-SWAN.jpg fit #000000"
$bg "~/Pictures/apod/2020-August-11-Churning-Clouds-on-Jupiter.jpg"
$bg2 "~/Pictures/apod/2019-October-20-Pluto-at-Night.jpg"
$gtk_theme "Mint-Y-Dark-Blue"
$icon_theme "Flat-Remix-Blue-Dark"
$laptop_screen "eDP-1"
$ext_screen "DP-2"
$pri $laptop_screen
$sec $ext_screen
}
default_border pixel 1
default_floating_border normal
hide_edge_borders smart
# works also for non-floating windows
# inverse for $mod+left click to resize, $mod+right click to drag
floating_modifier $mod inverse
#smart_gaps on
smart_borders on
gaps outer 8
gaps inner 5
font pango:Cantarell 14px
exec_always --no-startup-id
{
swaymsg output $pri bg $bg fill #000000
swaymsg output $sec bg $bg2 fill #000000
#swaymsg output $ter bg $bg
gsettings set org.gnome.desktop.interface gtk-theme '$gtk_theme'
gsettings set org.gnome.desktop.interface icon-theme '$icon_theme'
# TODO add ~/.asdf/shims to PATH
pkill fusuma; ~/.asdf/shims/fusuma -d -c ~/.config/fusuma/config-wl.yml
pkill autotiling; autotiling
pkill batsignal; batsignal '-d -w 15 -c 9 -d 5'
pkill swayidle; swayidle -w timeout 3600 "$lock" \
timeout 60 'pgrep swaylock && swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
before-sleep "pgrep swaylock || $lockt"
}
exec --no-startup-id {
nm-applet --indicator
lxpolkit
dbus-update-activation-environment DISPLAY XAUTHORITY
$keyring
mako
# TODO add ~/.asdf/shims to PATH
~/.asdf/shims/fusuma -d -c ~/.config/fusuma/config-wl.yml
autotiling
batsignal '-d -w 15 -c 9 -d 5'
}
bindsym ctrl+alt+l exec --no-startup-id $lock
bindsym $mod+grave exec $lock
output $laptop_screen pos 0 0 res 1920x1080
output $ext_screen pos 1920 0 res 1920x1200
# output $ext_screen toggle
bindswitch --reload --locked lid:on exec --no-startup-id '$(swaymsg set $med $pri ; swaymsg set $pri $sec; swaymsg set $sec $med ; swaymsg output $laptop_screen disable)'
bindswitch --reload --locked lid:off exec --no-startup-id '$(swaymsg set $med $sec ; swaymsg set $sec $pri ; swaymsg set $pri $med; swaymsg output $laptop_screen enable)'
exec --no-startup-id swaymsg focus output $pri
output "*" bg $bg fill #000000
#--- Window Decorations
set
{
$nofocus #202020
$focus #202020
$titletxt #FFFFE8
$titlepad 10 center #000000
$gaps_change 20
}
#--- Notifications
set
{
$n_anchor top-center
$n_layer overlay
$n_dim 600
$n_margin 20
$n_padding 10
$n_border 3
$n_bg #202020
$n_fg #FFFFE8
}
bindsym
{
$mod+Return exec $term
$mod+t exec $term
$mod+ctrl+Shift+t exec qterminal
$mod+Shift+q kill
alt+F1 exec $menu
alt+Shift+F1 exec $dashpls
alt+F2 exec $bemenu
alt+Shift+F2 exec $nutermmenu
$mod+ctrl+k exec QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_QPA_PLATFORMTHEME=wayland keepassxc
$mod+ctrl+t exec QT_QPA_PLATFORMTHEME=wayland telegram-desktop
$mod+ctrl+v exec QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_QPA_PLATFORMTHEME=wayland VirtualBox
$mod+shift+m exec swaymsg output $(swaymsg -p -t get_outputs | grep Output | head -n2 | tail -n1 | sed -e 's/Output //g' -e 's/ ''.*$//g') toggle
}
for_window [app_id="^launcher$"] floating enable, border none, resize set width 25 ppt height 100 ppt, move position 0 px 0 px
input *
{
xkb_layout gb,sk
xkb_options grp:win_space_toggle,compose:ralt
xkb_variant ",qwerty"
repeat_delay 280
repeat_rate 55
tap enabled
natural_scroll enabled
scroll_method two_finger
tap_button_map lrm
}
input 1102:4619:DLL07A7:01_044E:120B
{
accel_profile adaptive
}
focus_follows_mouse yes
focus_wrapping false
popup_during_fullscreen leave_fullscreen
#--- Floating Windows ------------------------------------------------------
for_window [class="pop-up"] floating enable; border normal $border
for_window [window_role="pop-up"] floating enable; border normal $border
for_window [window_role="task_dialog"] floating enable; border normal $border
for_window [class="MEGAsync"] floating enable; border pixel 0
for_window [title=".*JetBrains.*"] floating enable; border pixel 1
for_window [class="matplotlib"] floating enable; border normal $border
for_window [class="dosbox"] floating enable; border normal $border
for_window [title="ImageMagick.*"]
{
floating enable;
border normal $border
title_format " %title"
}
for_window [app_id="nm-connection-editor"]
{
floating enable
resize set width 882px
resize set height 600px
}
for_window [app_id="pavucontrol"]
{
floating enable
resize set width 882px
resize set height 600px
}
#--- Applications with CSD -------------------------------------------------
for_window [app_id="glade"] border pixel 2
for_window [app_id="baobab"] border pixel 2
for_window [title=".*eston.*"] border pixel 0
for_window [app_id="wdisplays"] border pixel 0
for_window [app_id="gnome-.*"] border pixel 1
for_window [app_id="qterminal"] border pixel 2
for_window [app_id="xterm"] border pixel 2
for_window [title=".*Brave.*"] border pixel 1 inhibit_idle fullscreen
for_window [title=".*Firefox.*"] border pixel 2 inhibit_idle fullscreen
for_window [class="vlc"] border pixel 2 inhibit_idle fullscreen
for_window [app_id="vlc"] border pixel 2 inhibit_idle fullscreen
for_window [app_id="nautilus"] border pixel 1
#--- Xtk Applications ------------------------------------------------------
for_window [title="xclock"] floating enable
for_window [title="Calculator"] floating enable
assign [app_id="telegram"] C
assign [title="Ferdi"] C
assign [title="Discord"] C
assign [class="Discord"] C
assign [class="vlc"] M
bindsym
{
# screenshot of all outputs
print exec grim $(xdg-user-dir PICTURES)/screenshots/grim-$(date +'%Y-%m-%dT%H-%M-%S').png
# screenshot of an area
Shift+print exec grim -g "$(slurp)" - | wl-copy
# screenshot of a window
Control+print exec winprint.sh
# colour picker
Control+Shift+print exec grim -g "$(slurp -p)" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt: | wl-copy
$mod+c exec gnome-calculator
$mod+n exec nemo
$mod+m exec QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_QPA_PLATFORMTHEME=wayland vlc
$mod+Shift+b exec brave-browser-beta --incognito
$mod+Shift+w exec MOZ_USE_XINPUT2=1 MOZ_ENABLE_WAYLAND=1 ~/Downloads/firefox-dev/firefox --private-window
$mod+Shift+g exec MOZ_USE_XINPUT2=1 MOZ_ENABLE_WAYLAND=1 firefox --private-window
$mod+Shift+v exec ferdi
$mod+Shift+a exec chromium-freeworld --incognito --enable-features=UseOzonePlatform --ozone-platform=wayland
--locked $mod+Escape exec systemctl suspend -i
$mod+Shift+o exec kitty bash -c 'sudo cpupower frequency-set -g powersave;figlet powersave;sleep 2'
$mod+Shift+p exec kitty bash -c 'sudo cpupower frequency-set -g performance;figlet performance;sleep 2'
--locked $mod+ctrl+Shift+s exec kitty bash -c 'sudo dell-bios-fan-control 0;sudo i8kfan 0 0'
--locked $mod+ctrl+Shift+d exec kitty bash -c 'sudo dell-bios-fan-control 0;sudo i8kfan 0 1'
--locked $mod+ctrl+Shift+f exec kitty bash -c 'sudo dell-bios-fan-control 0;sudo i8kfan 0 2'
--locked $mod+ctrl+Shift+b exec kitty bash -c 'sudo dell-bios-fan-control 1'
$mod+ctrl+Shift+a exec ~/.local/bin/keepmenu
$mod+Ctrl+r exec alacritty --class ranger -e ranger
}
# Notifications
bindsym Control+Space exec makoctl dismiss
bindsym Control+Shift+Space exec makoctl dismiss --all
#
# Moving around:
#
bindsym
{
# Move your focus around
$mod+$left focus left
$mod+$down focus down
$mod+$up focus up
$mod+$right focus right
# Or use $mod+[up|down|left|right]
$mod+Left focus left
$mod+Down focus down
$mod+Up focus up
$mod+Right focus right
# Move the focused window with the same, but add Shift
$mod+Shift+$left move left
$mod+Shift+$down move down
$mod+Shift+$up move up
$mod+Shift+$right move right
# Ditto, with arrow keys
$mod+Shift+Left move left
$mod+Shift+Down move down
$mod+Shift+Up move up
$mod+Shift+Right move right
$mod+Shift+c move position center
}
#
# Workspaces:
#
# Switch to workspace
bindsym --to-code
{
$mod+Shift+comma workspace prev_on_output
$mod+Shift+period workspace next_on_output
$mod+Shift+tab workspace back_and_forth
$mod+comma focus output right
$mod+period focus output left
$mod+0 exec ~/.local/bin/swws.py 0
$mod+1 exec ~/.local/bin/swws.py 1
$mod+2 exec ~/.local/bin/swws.py 2
$mod+3 exec ~/.local/bin/swws.py 3
$mod+4 exec ~/.local/bin/swws.py 4
$mod+5 exec ~/.local/bin/swws.py 5
$mod+6 exec ~/.local/bin/swws.py 6
$mod+7 exec ~/.local/bin/swws.py 7
$mod+8 exec ~/.local/bin/swws.py 8
$mod+9 exec ~/.local/bin/swws.py 9
$mod+F2 workspace C
$mod+F3 workspace M
}
# Switch directly to workspace of another monitor
bindsym --to-code
{
$mod+ctrl+0 exec "~/.local/bin/swws.py 0 -c"
$mod+ctrl+1 exec "~/.local/bin/swws.py 1 -c"
$mod+ctrl+2 exec "~/.local/bin/swws.py 2 -c"
$mod+ctrl+3 exec "~/.local/bin/swws.py 3 -c"
$mod+ctrl+4 exec "~/.local/bin/swws.py 4 -c"
$mod+ctrl+5 exec "~/.local/bin/swws.py 5 -c"
$mod+ctrl+6 exec "~/.local/bin/swws.py 6 -c"
$mod+ctrl+7 exec "~/.local/bin/swws.py 7 -c"
$mod+ctrl+8 exec "~/.local/bin/swws.py 8 -c"
$mod+ctrl+9 exec "~/.local/bin/swws.py 9 -c"
}
# Move focused container to workspace
bindsym --to-code
{
$mod+Shift+0 exec "~/.local/bin/swws.py 0 -s"
$mod+Shift+1 exec "~/.local/bin/swws.py 1 -s"
$mod+Shift+2 exec "~/.local/bin/swws.py 2 -s"
$mod+Shift+3 exec "~/.local/bin/swws.py 3 -s"
$mod+Shift+4 exec "~/.local/bin/swws.py 4 -s"
$mod+Shift+5 exec "~/.local/bin/swws.py 5 -s"
$mod+Shift+6 exec "~/.local/bin/swws.py 6 -s"
$mod+Shift+7 exec "~/.local/bin/swws.py 7 -s"
$mod+Shift+8 exec "~/.local/bin/swws.py 8 -s"
$mod+Shift+9 exec "~/.local/bin/swws.py 9 -s"
$mod+Shift+F2 move container to workspace C
$mod+Shift+F3 move container to workspace M
}
# Move focused container to workspace of another monitor
bindsym --to-code
{
ctrl+$mod+Shift+0 exec "~/.local/bin/swws.py 0 -t"
ctrl+$mod+Shift+1 exec "~/.local/bin/swws.py 1 -t"
ctrl+$mod+Shift+2 exec "~/.local/bin/swws.py 2 -t"
ctrl+$mod+Shift+3 exec "~/.local/bin/swws.py 3 -t"
ctrl+$mod+Shift+4 exec "~/.local/bin/swws.py 4 -t"
ctrl+$mod+Shift+5 exec "~/.local/bin/swws.py 5 -t"
ctrl+$mod+Shift+6 exec "~/.local/bin/swws.py 6 -t"
ctrl+$mod+Shift+7 exec "~/.local/bin/swws.py 7 -t"
ctrl+$mod+Shift+8 exec "~/.local/bin/swws.py 8 -t"
ctrl+$mod+Shift+9 exec "~/.local/bin/swws.py 9 -t"
}
#
# Workspace-monitor assignments
#
workspace 0 output $pri
workspace 1 output $pri
workspace 2 output $pri
workspace 3 output $pri
workspace 4 output $pri
workspace 5 output $pri
workspace 6 output $pri
workspace 7 output $pri
workspace 8 output $pri
workspace 9 output $pri
workspace C output $pri
workspace M output $pri
workspace 10 output $sec
workspace 11 output $sec
workspace 12 output $sec
workspace 13 output $sec
workspace 14 output $sec
workspace 15 output $sec
workspace 16 output $sec
workspace 17 output $sec
workspace 18 output $sec
workspace 19 output $sec
workspace 20 output $ter
workspace 21 output $ter
workspace 22 output $ter
workspace 23 output $ter
workspace 24 output $ter
workspace 25 output $ter
workspace 26 output $ter
workspace 27 output $ter
workspace 28 output $ter
workspace 29 output $ter
#
# Layout stuff:
#
bindsym
{
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
$mod+b splith
$mod+v splitv
# Switch the current container between different layout styles
$mod+s layout stacking
$mod+w layout tabbed
$mod+e layout toggle split
# Make the current focus fullscreen
$mod+f fullscreen
# Toggle the current focus between tiling and floating mode
#bindsym $mod+Shift+space floating toggle
$mod+Shift+d floating toggle
# Swap focus between the tiling area and the floating area
#bindsym $mod+space focus mode_toggle
$mod+d focus mode_toggle
# Move focus to the parent container
$mod+a focus parent
}
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
bindsym --to-code
{
# Move the currently focused window to the scratchpad
$mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
$mod+minus scratchpad show
}
#
# Resizing containers:
#
mode "resize"
{
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym
{
$left resize shrink width 10px
$down resize grow height 10px
$up resize shrink height 10px
$right resize grow width 10px
# Ditto, with arrow keys
Left resize shrink width 10px
Down resize grow height 10px
Up resize shrink height 10px
Right resize grow width 10px
# Return to default mode
Return mode "default"
Escape mode "default"
$mod+r mode "default"
}
}
bindsym $mod+r mode "resize"
bindsym $mod+Shift+r reload
# kudos to github.com/rbnis for the following menu-like section inspiration
# https://github.com/rbnis/dotfiles/blob/dfd6f956f6d00a1012a3a167d947773095dac7fd/.config/sway/config#L228-L235
set $mode_sys System: (l) lock, (e) logout, (s) suspend, (r) reboot, (S) shutdown
mode "$mode_sys" {
bindsym {
l exec $lock, mode "default"
e exit
s exec --no-startup-id systemctl suspend -i, mode "default"
r exec --no-startup-id systemctl reboot, mode "default"
Shift+s exec --no-startup-id systemctl poweroff -i, mode "default"
# return to default mode
Return mode "default"
Escape mode "default"
$mod+Shift+e mode "default"
}
}
bindsym $mod+Shift+e mode "$mode_sys"
#
# media keys
#
bindsym
{
--locked XF86AudioRaiseVolume exec pactl set-sink-volume @DEFAULT_SINK@ +5%
--locked XF86AudioLowerVolume exec pactl set-sink-volume @DEFAULT_SINK@ -5%
--locked XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle
--locked XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
--locked XF86MonBrightnessUp exec light -A 5
--locked XF86MonBrightnessDown exec light -U 5
--locked XF86AudioPlay exec playerctl play-pause
--locked XF86AudioNext exec playerctl next
--locked XF86AudioPrev exec playerctl previous
}
include /etc/sway/config.d/*
# Export environment to systemd and start services.
exec "systemctl --user import-environment; systemctl --user start sway-session.target"