# Hyprland Configuration
# Converted from Nix settings for nate-work

# Variables
$mod = Super
$terminal = ghostty
$fileManager = nautilus
$menu = nwg-drawer

# Autostart applications
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = blueman-applet
exec-once = hypridle
exec-once = kanshi
exec-once = lxqt-policykit-agent
exec-once = nm-applet --indicator
exec-once = sleep 5 && syncthingtray --wait
exec-once = swaybg -i ~/.config/hypr/va_background.png
# exec-once = swaylock -C ~/.config/swaylock/boot-config
exec-once = swaync
exec-once = waybar
exec-once = firefox --new-tab https://vasion.okta.com --new-tab https://github.com/PrinterLogic --new-tab https://claude.ai
exec-once = flatpak run org.signal.Signal
exec-once = flatpak run com.slack.Slack
exec-once = ghostty
exec-once = keepassxc

# Input configuration
input {
    repeat_rate = 50
    repeat_delay = 350
    follow_mouse = 0
    float_switch_override_focus = 0

    touchpad {
        natural_scroll = true
    }
}

# Animations
bezier = easeout, 0, 0.55, 0.45, 1
animation = workspaces, 1, 1, easeout

# Gestures
gesture = 3, horizontal, workspace

# General layout
general {
    gaps_in = 3
    gaps_out = 5
    border_size = 3
    col.active_border = rgba(7e5fddff) rgba(ff5100ff) 60deg
}

# Decoration
decoration {
    rounding = 12
    active_opacity = 0.98
    inactive_opacity = 0.95
    dim_inactive = true
    dim_strength = 0.03

    blur {
        enabled = true
        passes = 1
        size = 10
    }

    shadow {
        enabled = true
    }
}

# Cursor
cursor {
    no_hardware_cursors = true
}

# Misc
misc {
    vfr = 0
    force_default_wallpaper = 0
    disable_hyprland_logo = true
}

# Render
render {
    direct_scanout = 0
}

# Debug (remove when nvidia damage tracking works)
debug {
    damage_tracking = 0
}

# OpenGL
opengl {
    nvidia_anti_flicker = 0
}

# Window rules
windowrulev2 = float, class:^(org.keepassxc.KeePassXC)$
windowrulev2 = workspace special:scratch silent, class:^(org.keepassxc.KeePassXC)$
windowrulev2 = workspace special:scratch silent, class:^(org.signal.Signal)$
windowrulev2 = workspace 2 silent, class:^(firefox)$
windowrulev2 = workspace 3 silent, class:^(com.slack.Slack)$
windowrulev2 = workspace 4 silent, class:^(zoom)$
windowrulev2 = fullscreen, class:^(zoom)$, title:^(Meeting)$
windowrulev2 = float, class:^(zoom)$, title:!^(Meeting)$

# Key bindings
bind = $mod, Q, killactive
bind = $mod Shift, Q, exit
bind = $mod, W, exec, firefox
bind = $mod, D, exec, $menu
bind = $mod, T, exec, $fileManager
bind = $mod, code:36, exec, $terminal
bind = $mod, Space, togglefloating
bind = $mod Shift, Space, exec, hyprctl dispatch focuswindow $(if [[ $(hyprctl activewindow -j | jq ."floating") == "true" ]]; then echo "tiled"; else echo "floating"; fi;)
bind = $mod, F, fullscreen, 0
bind = $mod, Tab, cyclenext
bind = $mod Shift, Tab, swapnext

# Movement - Arrow keys
bind = $mod, left, movefocus, l
bind = $mod, right, movefocus, r
bind = $mod, up, movefocus, u
bind = $mod, down, movefocus, d
bind = $mod Shift, left, movewindow, l
bind = $mod Shift, right, movewindow, r
bind = $mod Shift, up, movewindow, u
bind = $mod Shift, down, movewindow, d

# Movement - Colemak-DH
bind = $mod, N, movefocus, l
bind = $mod, O, movefocus, r
bind = $mod, E, movefocus, u
bind = $mod, I, movefocus, d
bind = $mod Shift, N, movewindow, l
bind = $mod Shift, O, movewindow, r
bind = $mod Shift, E, movewindow, u
bind = $mod Shift, I, movewindow, d

# Special actions
bind = $mod SHIFT, K, exec, hyprctl keyword 'device[at-translated-set-2-keyboard]:enabled' 'false' && notify-send 'Laptop keyboard disabled' -i nix-snowflake
bind = $mod SHIFT, R, exec, hyprctl reload && notify-send 'Hypr Config Reloaded' -i nix-snowflake

# Workspaces
bind = $mod, minus, togglespecialworkspace, scratch
bind = $mod SHIFT, minus, movetoworkspacesilent, special:scratch
bind = $mod, M, togglespecialworkspace, music
bind = $mod Shift, M, exec, ~/.config/hypr/scripts/music_setup.sh

# Screenshots
bind = $mod, P, exec, ~/.config/hypr/scripts/screenshot.sh clipboard
bind = $mod SHIFT, P, exec, ~/.config/hypr/scripts/screenshot.sh

# Color picker
bind = $mod, C, exec, color=$(hyprpicker) && echo $color | wl-copy && notify-send "Copied $color to clipboard"

# Notification drawer
bind = $mod CONTROL, N, exec, swaync-client -t -sw

# Workspace bindings (1-9)
bind = $mod, code:10, workspace, 1
bind = $mod SHIFT, code:10, movetoworkspacesilent, 1
bind = $mod, code:11, workspace, 2
bind = $mod SHIFT, code:11, movetoworkspacesilent, 2
bind = $mod, code:12, workspace, 3
bind = $mod SHIFT, code:12, movetoworkspacesilent, 3
bind = $mod, code:13, workspace, 4
bind = $mod SHIFT, code:13, movetoworkspacesilent, 4
bind = $mod, code:14, workspace, 5
bind = $mod SHIFT, code:14, movetoworkspacesilent, 5
bind = $mod, code:15, workspace, 6
bind = $mod SHIFT, code:15, movetoworkspacesilent, 6
bind = $mod, code:16, workspace, 7
bind = $mod SHIFT, code:16, movetoworkspacesilent, 7
bind = $mod, code:17, workspace, 8
bind = $mod SHIFT, code:17, movetoworkspacesilent, 8
bind = $mod, code:18, workspace, 9
bind = $mod SHIFT, code:18, movetoworkspacesilent, 9

# Mouse bindings
bindm = $mod, mouse:272, movewindow
bindm = $mod, mouse:273, resizewindow

# Brightness and Volume controls
bindel = , XF86MonBrightnessDown, exec, brightnessctl s 10%-
bindel = , XF86MonBrightnessUp, exec, brightnessctl s 10%+
bindel = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindel = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindel = , XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
bindel = , XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
