# vim: ft=swayconfig

### GENERAL ###

# Start a terminal
bindsym $mod+Return exec $term

# Kill focused container
bindsym $mod+q kill

# Start application launcher
bindsym $mod+d exec $menu

# Clear the clipboard
bindsym $mod+c exec clear-clipboard.sh

# Floating modifier
floating_modifier $mod normal

# Reload Sway
bindsym $mod+Shift+c reload

# Lock the screen
bindsym $mod+l exec swaylock

# Session and power management
bindsym $mod+Shift+e exec swaynag -t warning -m 'Log out?' -b 'Yes' 'swaymsg exit'
bindsym $mod+Shift+r exec swaynag -t error -m 'Reboot?' -b 'Yes' 'doas reboot'
bindsym $mod+Shift+q exec swaynag -t error -m 'Shut down?' -b 'Yes' 'doas poweroff'

# Screenshotting
bindsym Print exec grimshot --notify save output
bindsym Shift+Print exec grimshot --notify save area
bindsym Ctrl+Print exec grimshot --notify copy output
bindsym Shift+Ctrl+Print exec grimshot --notify copy area

# Move focus to different container
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right

# Move focused container
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right

# Switch to workspace
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

# Switch to workspace and bring along focused container
bindsym $mod+Shift+1 move container to workspace number 1; workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2; workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3; workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4; workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5; workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6; workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7; workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8; workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9; workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10; workspace number 10

# Split modes ([B]ertical split?)
bindsym $mod+b splith
bindsym $mod+v splitv
bindsym $mod+e layout toggle split

# Switch window between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed

# Make container fullscreen
bindsym $mod+f fullscreen

# Toggle container between tiling and floating mode
bindsym $mod+Shift+space floating toggle

# Toggle focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle

# Move focus to the parent container
bindsym $mod+a focus parent

# Move window to scratchpad
bindsym $mod+Shift+minus move scratchpad

# Show or cycle through scratchpad
bindsym $mod+minus scratchpad show

# PipeWire controls
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +2%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -2%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute 0 toggle

# Media player controls
bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioStop exec playerctl stop
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous

# Sreen brightness controls
bindsym XF86MonBrightnessUp exec light -A 5
bindsym XF86MonBrightnessDown exec light -U 5


### MODES ###

# Resize mode
mode "resize" {
    bindsym $left resize grow width 10px
    bindsym $down resize shrink height 10px
    bindsym $up resize grow height 10px
    bindsym $right resize shrink width 10px
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

# Keybind for resize mode
bindsym $mod+r mode "resize"
