# Mod1 for Alt.
set $mod Mod4
set $mod1 Mod1

# like vim
set $left h
set $down j
set $up k
set $right l

set $term kitty
set $term-float kitty --title 'term-float'
set $menu wofi -c ~/.config/wofi/config -I
set $windows ~/.config/wofi/windows.py
set $power ~/.config/waybar/scripts/power.sh
set $lock ~/.config/sway/scripts/lock.sh
set $screenshot ~/.config/sway/scripts/screenshot.sh

floating_modifier $mod normal

bindsym --to-code $mod+Shift+r reload
bindsym --to-code $mod+z kill
bindsym --to-code $mod+Shift+b exec pkill -SIGUSR1 '^waybar$'

bindsym --to-code $mod+Return exec $term
bindsym --to-code $mod+Shift+Return exec $term-float
bindsym --to-code $mod+d exec $menu
bindsym --to-code $mod1+Tab exec $windows
bindsym --to-code $mod+delete exec $lock
bindsym --to-code $mod+$mod1+delete exec $power

bindsym --to-code $mod1+t exec thunar
bindsym --to-code $mod1+w exec firefox

bindsym --to-code print exec /usr/share/sway/scripts/grimshot --notify save output
bindsym --to-code $mod+print exec $screenshot

bindsym --to-code $mod+$left focus left
bindsym --to-code $mod+$down focus down
bindsym --to-code $mod+$up focus up
bindsym --to-code $mod+$right focus right
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

bindsym --to-code $mod+Shift+$left move left
bindsym --to-code $mod+Shift+$down move down
bindsym --to-code $mod+Shift+$up move up
bindsym --to-code $mod+Shift+$right move 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 --to-code $mod+b splith
bindsym --to-code $mod+v splitv

bindsym --to-code $mod+s layout stacking
bindsym --to-code $mod+w layout tabbed
bindsym --to-code $mod+e layout toggle split

bindsym --to-code $mod+f fullscreen
bindsym --to-code $mod+Shift+space floating toggle
bindsym --to-code $mod+space focus mode_toggle
bindsym --to-code $mod+a focus parent

bindsym --to-code $mod+Shift+minus move scratchpad
bindsym --to-code $mod+minus scratchpad show

mode "resize" {
    bindsym --to-code $left resize shrink width 10px
    bindsym --to-code $right resize grow width 10px
    bindsym --to-code $up resize grow height 10px
    bindsym --to-code $down resize shrink height 10px

    bindsym Left resize shrink width 10px
    bindsym Right resize grow width 10px
    bindsym Up resize grow height 10px
    bindsym Down resize shrink height 10px

    bindsym Return mode "default"
    bindsym Escape mode "default"
}
bindsym --to-code $mod+r mode "resize"

bindsym --whole-window --border $mod+button4 resize shrink height 5 px or 5 ppt
bindsym --whole-window --border $mod+button5 resize grow height 5 px or 5 ppt
bindsym --whole-window --border $mod+shift+button4 resize shrink width 5 px or 5 ppt
bindsym --whole-window --border $mod+shift+button5 resize grow width 5 px or 5 ppt

bindsym --locked XF86AudioRaiseVolume exec pamixer -ui 2
bindsym --locked XF86AudioLowerVolume exec pamixer -ud 2
bindsym --locked XF86AudioMute exec pamixer -t

bindsym XF86AudioPlay exec playerctl play
bindsym XF86AudioPause exec playerctl pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

bindsym XF86MonBrightnessUp exec brightnessctl -c backlight set +5%
bindsym XF86MonBrightnessDown exec brightnessctl -c backlight set 5%-
