### Variables

$mainMod = SUPER
$colorActive = rgb(bb9af7)
$wallpaper = ~/.config/wallpapers/taylor-bw.jpg
$lockCmd = swaylock --daemonize --image $wallpaper
$sleepCmd = systemctl suspend
$launcherCmd = wofi --show drun --no-actions --insensitive --prompt 'Run'

general {
    border_size = 2
    gaps_in = 0
    gaps_out = 0
    col.active_border = $colorActive
    col.group_border_active = $colorActive
    cursor_inactive_timeout = 8
}

input {
    kb_options = caps:escape,compose:ralt
    touchpad {
        natural_scroll = yes
    }
}

gestures {
    workspace_swipe = yes
    workspace_swipe_min_speed_to_force = 5
}

misc {
  disable_hyprland_logo = true
  disable_splash_rendering = true
}

### Dwindle

dwindle {
    # Put new splits on the right/bottom
    force_split = 2
    no_gaps_when_only = true
}

### Monitors

# Scale built in monitor correctly
monitor = eDP-1, preferred, auto, 1.5

# Run helper programs
exec-once = workstyle &> /tmp/workstyle.log
exec-once = waybar
exec-once = mako
exec-once = gammastep
exec-once = swaybg --mode fill --image $wallpaper
exec-once = wl-paste --type text --watch clipman store
exec-once = swayidle -w timeout 900 '$lockCmd' timeout 1200 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' timeout 1800 '$sleepCmd' before-sleep 'playerctl pause' before-sleep '$lockCmd' lock '$lockCmd'

### Binds

# Window manager
bind = $mainMod, Tab, focusurgentorlast
bind = $mainMod, Q, killactive,
bind = $mainMod, F, fullscreen

# Shortcuts
bind = $mainMod, Space, exec, $launcherCmd
bind = $mainMod, Return, exec, alacritty
bind = $mainMod, W, exec, brave
bind = $mainMod, V, exec, clipman pick --tool wofi
bind = SUPER_CTRL, Q, exec, $lockCmd

# Media keys
bind = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bind = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bind = , XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bind = , XF86MonBrightnessDown, exec, brightnessctl set 5%-
bind = , XF86MonBrightnessUp, exec, brightnessctl set +5%
bind = , XF86AudioPlay, exec, playerctl play-pause
bind = , XF86AudioNext, exec, playerctl next
bind = , XF86AudioPrev, exec, playerctl previous
bind = , XF86Search, exec, $launcherCmd

# Screenshots
bind = , Print ,exec, grim "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png"
bind = $mainMod, Print , exec, grim -g "$(slurp)" "${HOME}/Downloads/screenshot-$(date +'%F-%H-%M-%S').png"

# Move window focus
bind = $mainMod, H, movefocus, l
bind = $mainMod, J, movefocus, d
bind = $mainMod, K, movefocus, u
bind = $mainMod, L, movefocus, r

# Switch workspaces
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, togglespecialworkspace

# Move active window to workspace
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, special

# Move/resize windows with mouse
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
