### Basic Settings
set $mod Mod4
set $term alacritty

floating_modifier $mod

font pango:MesloLGS Nerd Font 11

### Startup Applications
exec --no-startup-id blueman-applet
exec --no-startup-id mullvad-vpn
exec --no-startup-id gammastep
exec --no-startup-id swaymsg workspace 1
exec --no-startup-id waybar
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

### output config
output HDMI-A-1 resolution 3840x2160@119.88Hz

bar {
  swaybar_command waybar
  mode hide
  hidden_state hide
  position top
}

### Input
input "type:touchpad" {
  tap enabled
  dwt enabled
  click_method clickfinger
  natural_scroll enabled
  tap_button_map lrm
}

input "*" {
  xkb_layout us
  xkb_variant intl
}

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

### Default workspace behavior
workspace_auto_back_and_forth yes

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

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

# System
bindsym $mod+Ctrl+l exec swaylock
bindsym $mod+Shift+r reload
bindsym $mod+Ctrl+Shift+Alt+s exec systemctl suspend
bindsym $mod+Ctrl+Shift+Alt+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-gtk
bindsym $mod+Shift+c kill

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

# Workspace keybindings 1-9
bindsym $mod+1 workspace 1
bindsym $mod+Shift+1 move container to workspace 1
bindsym $mod+Ctrl+1 move container to workspace 1; workspace 1
bindsym $mod+2 workspace 2
bindsym $mod+Shift+2 move container to workspace 2
bindsym $mod+Ctrl+2 move container to workspace 2; workspace 2
bindsym $mod+3 workspace 3
bindsym $mod+Shift+3 move container to workspace 3
bindsym $mod+Ctrl+3 move container to workspace 3; workspace 3
bindsym $mod+4 workspace 4
bindsym $mod+Shift+4 move container to workspace 4
bindsym $mod+Ctrl+4 move container to workspace 4; workspace 4
bindsym $mod+5 workspace 5
bindsym $mod+Shift+5 move container to workspace 5
bindsym $mod+Ctrl+5 move container to workspace 5; workspace 5
bindsym $mod+6 workspace 6
bindsym $mod+Shift+6 move container to workspace 6
bindsym $mod+Ctrl+6 move container to workspace 6; workspace 6
bindsym $mod+7 workspace 7
bindsym $mod+Shift+7 move container to workspace 7
bindsym $mod+Ctrl+7 move container to workspace 7; workspace 7
bindsym $mod+8 workspace 8
bindsym $mod+Shift+8 move container to workspace 8
bindsym $mod+Ctrl+8 move container to workspace 8; workspace 8
bindsym $mod+9 workspace 9
bindsym $mod+Shift+9 move container to workspace 9
bindsym $mod+Ctrl+9 move container to workspace 9; workspace 9

### Assignments
assign [app_id="thunderbird"] workspace "9: mail"

### Resize mode
mode "resize" {
  bindsym h resize shrink width 4px or 4ppt
  bindsym j resize grow height 4px or 4ppt
  bindsym k resize shrink height 4px or 4ppt
  bindsym l resize grow width 4px or 4ppt
  bindsym Left resize shrink width 10px or 10ppt
  bindsym Down resize grow height 10px or 10ppt
  bindsym Up resize shrink height 10px or 10ppt
  bindsym Right resize grow width 10px or 10ppt
  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

# Float all windows with "VirtualBox" in the title
for_window [class=".*VirtualBox.*"] floating enable
# EXCEPT: unfloat those that also contain "Manager" or "Machine"
for_window [class=".*VirtualBox Manager.*"] floating disable
for_window [class=".*VirtualBox Machine"] floating disable
