### Variables
set $mod Mod4
set $left h
set $down j
set $up   k
set $right l

set $term alacritty
set $menu bemenu-run -b -i --fn "Hack Nerd Font 10" --prompt "Run:" --list "8 up"

set $b00 #141415
set $b01 #1c1c24
set $b02 #2f2f3d
set $b03 #333738
set $b04 #c3c3d5
set $b05 #cdcdcd

set $red    #d8647e
set $yellow #f3be7c
set $hint   #7e98e8
set $float  #878787

font Hack Nerd Font 10
default_border pixel 3
default_floating_border pixel 3
smart_borders no_gaps
gaps inner 0
gaps outer 0

client.focused          $hint $b02 $b05 $hint
client.focused_inactive $b01  $b01 $b04 $b01
client.unfocused        $b01  $b01 $b03 $b01
client.urgent           $red  $red $b05 $red
client.placeholder      $b01  $b01 $b04 $b01
client.background       $b00

for_window [floating] border pixel 2

# Prefer native Sway background handling over repeatedly spawning swaybg.
output * bg #000000 solid_color

bar {
  swaybar_command waybar
}

### Input/output
input type:keyboard {
  xkb_layout us
}

output HDMI-A-1 resolution 2560x1440 pos 0 0
output * adaptive_sync on

workspace 1 output HDMI-A-1

workspace_auto_back_and_forth yes

### Key bindings
bindsym $mod+Return exec $term
bindsym $mod+q kill
bindsym $mod+Space exec $menu
bindsym $mod+Shift+c reload
bindsym $mod+Shift+e exec swaymsg exit

bindsym $mod+Tab workspace back_and_forth

bindsym $mod+$left  focus left
bindsym $mod+$down  focus down
bindsym $mod+$up    focus up
bindsym $mod+$right focus right

bindsym $mod+Shift+$left  move left
bindsym $mod+Shift+$down  move down
bindsym $mod+Shift+$up    move up
bindsym $mod+Shift+$right move right

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+0 workspace number 10

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
bindsym $mod+Shift+0 move container to workspace number 10

bindsym $mod+b splith
bindsym $mod+v splitv

bindsym $mod+equal fullscreen
bindsym $mod+Shift+f floating toggle
bindsym $mod+f focus mode_toggle

bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show

### Media keys
bindsym --locked XF86AudioMute         exec pactl set-sink-mute @DEFAULT_SINK@ toggle
bindsym --locked XF86AudioLowerVolume  exec pactl set-sink-volume @DEFAULT_SINK@ -5%
bindsym --locked XF86AudioRaiseVolume  exec pactl set-sink-volume @DEFAULT_SINK@ +5%
bindsym --locked XF86AudioMicMute      exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
bindsym --locked XF86MonBrightnessUp   exec brightnessctl set 5%+

### Screenshots
bindsym $mod+Shift+p exec grim -g "$(slurp)" - | wl-copy
bindsym $mod+p exec grim - | wl-copy

### Autostart
#
# If Steam behaves weirdly under forced Wayland env vars, the Fish config below
# should fix that by not forcing SDL/QT globally.
exec steam
exec spotify-launcher

exec dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
exec systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
