# vim: ft=swayconfig
# System Controls
bindsym {
    $mod+Shift+r exec swaymsg reload && notify-send "Reloaded sway config"
    $mod+Shift+e exec --no-startup-id wlogout
    $mod+Escape exec ~/.local/bin/lock.sh
}

# Gestures
bindgesture swipe:right focus right
bindgesture swipe:left focus left
bindgesture swipe:up workspace next
bindgesture swipe:down workspace prev

# Application Launchers
bindsym {
    $mod+Return   exec $term
    $mod+d        exec rofi -show combi -combi-modi "window,drun" -modi combi
    $mod+t        exec ~/.local/bin/code.sh -s ~/.local/bin/fuzzel.lua
    $mod+shift+t  exec ~/.local/bin/present
    $mod+n        exec ~/.local/bin/sdm-ui.sh dmenu
    $mod+o        exec ~/.local/bin/launch-or-focus obsidian "cd /home/forbi/Documents/Vault && $term --class obsidian nvim"
    $mod+e        exec nemo
}

# Window Management
bindsym {
    $mod+c kill
    $mod+f fullscreen toggle
    $mod+space floating toggle

    # Layout
    $mod+s layout stacking
    $mod+w layout toggle tabbed split
    $mod+semicolon split h

    # Focus
    $mod+$left focus left
    $mod+$down focus down
    $mod+$up focus up
    $mod+$right focus right

    $mod+Left focus left
    $mod+Down focus down
    $mod+Up focus up
    $mod+Right focus right

    # Move
    $mod+Shift+$left move left
    $mod+Shift+$down move down
    $mod+Shift+$up move up
    $mod+Shift+$right move right

    $mod+Shift+Left move left
    $mod+Shift+Down move down
    $mod+Shift+Up move up
    $mod+Shift+Right move right
}

# Workspace Management
bindsym {
    $mod+1 workspace $ws1
    $mod+2 workspace $ws2
    $mod+3 workspace $ws3
    $mod+4 workspace $ws4
    $mod+5 workspace $ws5
    $mod+6 workspace $ws6
    $mod+7 workspace $ws7
    $mod+8 workspace $ws8
    $mod+9 workspace $ws9
    $mod+0 workspace $ws10

    $mod+Shift+1 move container to workspace $ws1
    $mod+Shift+2 move container to workspace $ws2
    $mod+Shift+3 move container to workspace $ws3
    $mod+Shift+4 move container to workspace $ws4
    $mod+Shift+5 move container to workspace $ws5
    $mod+Shift+6 move container to workspace $ws6
    $mod+Shift+7 move container to workspace $ws7
    $mod+Shift+8 move container to workspace $ws8
    $mod+Shift+9 move container to workspace $ws9
    $mod+Shift+0 move container to workspace $ws10

    $mod+bracketright move workspace to output right
    $mod+bracketleft move workspace to output left
}

# Scratchpad
bindsym {
    $mod+Shift+minus move scratchpad
    $mod+minus scratchpad show
    $mod+u [instance="claude.ai"] move scratchpad; [app_id="uy.com.mzunino"] scratchpad show, move position center, fullscreen disable, resize set 1366 768
    $mod+g [app_id="uy.com.mzunino"] move scratchpad; [instance="claude.ai"] scratchpad show, move position center, fullscreen disable, resize set 1366 768
    $mod+Shift+u exec --no-startup-id $term --class="uy.com.mzunino"
    $mod+shift+g exec chromium --new-window --app="https://claude.ai"
}

# Special Functions
bindsym {
    F4 exec switch-windows
    $mod+r exec --no-startup-id ~/.local/bin/wlrecord.sh
    $mod+p exec --no-startup-id grim -g "$(slurp -d)" - | swappy -f -
    $mod+shift+p exec --no-startup-id ~/.local/bin/screenshot-upload
    $mod+F5 exec --no-startup-id ~/.local/bin/pause-notifications
    $mod+shift+d exec ~/.local/bin/satty-window
}

# Multimedia Keys
bindsym {
    XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +2%
    XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -2%
    XF86AudioMute exec --no-startup-id pactl set-sink-mute 0 toggle
    XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5%
    XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%-
}

# Mouse Bindings
bindsym {
    --border button2 kill
    --whole-window $mod+button2 kill
    button3 floating toggle
    $mod+button3 floating toggle
}
