# === General Settings ===
set $mod Mod4
set $alt Mod1
set $myTerm alacritty

font pango:MesloLGS NF 11

floating_modifier $mod
#hide_edge_borders none
default_border none

# === Monitor related ===

# === Terminal ===
bindsym $mod+Return exec $myTerm --command tmux
bindsym $mod+Ctrl+Return exec $myTerm

# === Program Launcher & Utilities ===
#bindsym $mod+Shift+Return exec wofi --show drun --style ~/.config/wofi/style.css
bindsym $mod+Shift+Return exec rofi -show combi
bindsym $mod+Print exec "flameshot full -c"
bindsym $mod+Shift+Print exec "flameshot gui"
bindsym $mod+Ctrl+Shift+Print exec --no-startup-id simplescreenrecorder --start-hidden --start-recording

# === input devices ===

input "1267:12572:DELL097D:00_04F3:311C_Touchpad" {
    tap enabled
    natural_scroll enabled
    tap_button_map lrm  # tap with 1 finger = left click, 2 fingers = right click, 3 fingers = middle click
}
input type:keyboard {
    xkb_layout us
    xkb_variant intl
}

# === Volume & Media Keys ===
bindsym XF86AudioLowerVolume exec pamixer --decrease 5
bindsym XF86AudioRaiseVolume exec pamixer --increase 5
bindsym XF86AudioMute exec pamixer -t
bindsym $mod+XF86AudioMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle

bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous
bindsym $mod+XF86AudioRaiseVolume exec playerctl next
bindsym $mod+XF86AudioLowerVolume exec playerctl previous

# === Brightness Keys ===
bindsym XF86MonBrightnessUp exec "light -A 5; notify-send 'Brightness set to $(light)'"
bindsym XF86MonBrightnessDown exec "light -U 5; notify-send 'Brightness set to $(light)'"
bindsym $mod+XF86MonBrightnessDown exec "light -S 0.2; notify-send 'Brightness set to min'"
bindsym $mod+XF86MonBrightnessUp exec "light -S 100; notify-send 'Brightness set to max'"

# === Calculator ===
bindsym XF86Calculator exec --no-startup-id qalculate-gtk

# === Kill Window ===
bindsym $mod+Shift+c kill

# === Autostart ===
exec waybar -c ~/.config/waybar/config.jsonc
exec --no-startup-id nextcloud
exec mako
exec --no-startup-id mullvad-vpn
exec --no-startup-id redshift ~/.config/redshift/redshift.conf
exec --no-startup-id blueman-applet
exec --no-startup-id flameshot

# === Idle / Lock ===
exec swayidle -w \
  timeout 1800 'swaylock -f' \
  timeout 1860 'systemctl suspend' \
  resume 'notify-send "Welcome back!"' \
  before-sleep 'swaylock -f'

# === Borders ===
bindsym $mod+u border none
bindsym $mod+y border pixel 1
bindsym $mod+n border normal

# === Focus Movement ===
bindsym $mod+h focus left
bindsym $mod+j focus down
bindsym $mod+k focus up
bindsym $mod+l focus right
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right

# === Move Windows ===
bindsym $mod+Shift+h move left
bindsym $mod+Shift+j move down
bindsym $mod+Shift+k move up
bindsym $mod+Shift+l 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

# === Workspace Management ===
workspace_auto_back_and_forth yes
bindsym $mod+b workspace back_and_forth
bindsym $mod+Shift+b move container to workspace back_and_forth; workspace back_and_forth

bindsym $mod+Ctrl+Right workspace next
bindsym $mod+Ctrl+Left workspace prev

set $ws1 1
set $ws2 2
set $ws3 3
set $ws4 4
set $ws5 5
set $ws6 6
set $ws7 7
set $ws8 8
set $ws9 9

# Switch to workspace
bindsym $mod+1 workspace $ws1
bindsym $mod+2 workspace $ws2
bindsym $mod+3 workspace $ws3
bindsym $mod+4 workspace $ws4
bindsym $mod+5 workspace $ws5
bindsym $mod+6 workspace $ws6
bindsym $mod+7 workspace $ws7
bindsym $mod+8 workspace $ws8
bindsym $mod+9 workspace $ws9

# Move to workspace
bindsym $mod+Ctrl+1 move container to workspace $ws1
bindsym $mod+Ctrl+2 move container to workspace $ws2
bindsym $mod+Ctrl+3 move container to workspace $ws3
bindsym $mod+Ctrl+4 move container to workspace $ws4
bindsym $mod+Ctrl+5 move container to workspace $ws5
bindsym $mod+Ctrl+6 move container to workspace $ws6
bindsym $mod+Ctrl+7 move container to workspace $ws7
bindsym $mod+Ctrl+8 move container to workspace $ws8
bindsym $mod+Ctrl+9 move container to workspace $ws9

# Move and switch
bindsym $mod+Shift+1 move container to workspace $ws1; workspace $ws1
bindsym $mod+Shift+2 move container to workspace $ws2; workspace $ws2
bindsym $mod+Shift+3 move container to workspace $ws3; workspace $ws3
bindsym $mod+Shift+4 move container to workspace $ws4; workspace $ws4
bindsym $mod+Shift+5 move container to workspace $ws5; workspace $ws5
bindsym $mod+Shift+6 move container to workspace $ws6; workspace $ws6
bindsym $mod+Shift+7 move container to workspace $ws7; workspace $ws7
bindsym $mod+Shift+8 move container to workspace $ws8; workspace $ws8
bindsym $mod+Shift+9 move container to workspace $ws9; workspace $ws9

# === Monitor Output Control ===
bindsym $mod+greater focus output right
bindsym $mod+less focus output left
bindsym $mod+Ctrl+greater move container to output right; focus output right
bindsym $mod+Ctrl+less move container to output left; focus output left
bindsym $mod+Ctrl+Shift+greater move workspace to output right
bindsym $mod+Ctrl+Shift+less move workspace to output left
bindsym $mod+Ctrl+Shift+h move workspace to output left
bindsym $mod+Ctrl+Shift+l move workspace to output right
bindsym $mod+Ctrl+Shift+k move workspace to output up
bindsym $mod+Ctrl+Shift+j move workspace to output down

# === Layout and Modes ===
bindsym $mod+z split h; exec notify-send 'Tile horizontally'
bindsym $mod+v split v; exec notify-send 'Tile vertically'
bindsym $mod+q split toggle
bindsym $mod+f fullscreen toggle
bindsym $mod+Shift+y fullscreen disable; floating enable; resize set 640 480; sticky enable; move window to position 1270 590
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
bindsym $mod+Shift+space floating toggle
bindsym $mod+space focus mode_toggle
bindsym $mod+Shift+s sticky toggle
bindsym $mod+a focus parent

# === Scratchpad ===
bindsym $mod+Shift+minus move scratchpad
bindsym $mod+minus scratchpad show

# === Resize Mode ===
bindsym $mod+r mode "resize"
mode "resize" {
    bindsym h resize shrink width 4 px or 4 ppt
    bindsym j resize grow height 4 px or 4 ppt
    bindsym k resize shrink height 4 px or 4 ppt
    bindsym l resize grow width 4 px or 4 ppt
    bindsym Left resize shrink width 10 px or 10 ppt
    bindsym Down resize grow height 10 px or 10 ppt
    bindsym Up resize shrink height 10 px or 10 ppt
    bindsym Right resize grow width 10 px or 10 ppt
    bindsym Return mode "default"
    bindsym Escape mode "default"
}

# === System Actions ===
bindsym $mod+Ctrl+l exec --no-startup-id i3lock -c 000000
bindsym $mod+Ctrl+Shift+$alt+l exec --no-startup-id light-locker-command -l
bindsym $mod+Shift+Ctrl+$alt+h exec --no-startup-id systemctl hibernate
bindsym $mod+Shift+Ctrl+$alt+s exec --no-startup-id systemctl suspend

# === Assign Applications ===
assign [class="Thunderbird"] $ws9
assign [class="Spotify"] $ws9

# === Floating Windows ===
for_window [title="alsamixer"] floating enable border pixel 1
for_window [title="Qalculate!"] floating enable border normal
for_window [class="Psensor"] floating enable border normal
for_window [title="lxrandr"] floating enable border normal
for_window [class="Blueman-manager"] floating enable border normal
for_window [class="GParted"] floating enable border normal
for_window [class="pavucontrol"] floating enable
for_window [class="Volume Control"] floating enable
for_window [class="(?i)VirtualBox"] floating enable border normal

# Focus urgent windows
for_window [urgent=latest] focus

# === Reload / Restart sway ===
bindsym $mod+Shift+r reload
#bindsym $mod+Shift+r restart

# === Colors ===
client.focused          #ff8800 #2F3D44 #FF8800 #FDF6E3 #ff8800
client.focused_inactive #333333 #222222 #444444 #454948 #222222
client.unfocused        #2F3D44 #2F3D44 #FF8800 #454948
client.urgent           #CB4B16 #FDF6E3 #FF8800 #268BD2
client.placeholder      #000000 #0c0c0c #ffffff #000000
client.background       #2B2C2B

# === Gaps ===
gaps inner 8
gaps outer -4
smart_gaps on
smart_borders on

