# === Basic Settings ===
set $mod Mod4
set $term alacritty
floating_modifier $mod
font pango:MesloLGS Nerd Font 11

# === Startup Applications ===
exec --no-startup-id numlockx
exec --no-startup-id blueman-applet
exec --no-startup-id mullvad-vpn
exec --no-startup-id gammastep
exec --no-startup-id i3-msg workspace 1
exec --no-startup-id polybar
exec --no-startup-id thunderbird
exec --no-startup-id nextcloud
exec --no-startup-id spotify
exec --no-startup-id brave
exec --no-startup-id alacritty -e tmux

exec xset s noblank
exec xset -dpms

# === Bar ===
#bar {
#    status_command polybar 
#    mode hide
#    hidden_state hide
#    position top
#}

# === Keyboard Layout ===
exec --no-startup-id setxkbmap -layout us -variant intl

# === Gaps === (requires i3-gaps)
gaps inner 8
gaps outer -4
smart_gaps on
smart_borders on

# === Workspace Behavior ===
workspace_auto_back_and_forth yes

# === Keybindings ===

# Terminal and Rofi
bindsym $mod+Return exec alacritty
bindsym $mod+Ctrl+Return exec alacritty -e zellij
bindsym $mod+Shift+Return exec rofi -show combi

# System
bindsym $mod+Ctrl+l exec i3lock
bindsym $mod+Shift+r restart
bindsym $mod+Ctrl+Shift+Mod1+s exec systemctl suspend
bindsym $mod+Ctrl+Shift+Mod1+h exec systemctl hibernate

# Audio
bindsym XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindsym XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bindsym XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindsym $mod+XF86AudioMute exec wpctl set-mute @DEFAULT_AUDIO_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
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"

# Misc
bindsym XF86Calculator exec qalculate-qt
bindsym $mod+Shift+c kill

bindsym $mod+Shift+f exec polybar-msg cmd toggle
bindsym $mod+Shift+Print exec flameshot gui

# Borders
default_border pixel 2
bindsym $mod+u border none
bindsym $mod+y border pixel 1
bindsym $mod+n border normal
bindsym $mod+Shift+n border none

# Focus
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 containers
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

# Workspaces
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

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

# Layout
#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+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

# Workspaces 1–9
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"

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

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

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

# Assignments
assign [class="Thunderbird"] $ws9

# Resize Mode
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"
}

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

# === 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 [title="Volume Control"] floating enable
for_window [class="Spotify"] move scratchpad
for_window [class="Deezer"] move scratchpad
for_window [class=".*VirtualBox.*"] floating enable
for_window [class=".*VirtualBox Manager.*"] floating disable
for_window [class=".*VirtualBox Machine"] floating disable
