# ===== Hyprland Hovedkonfiguration - Stargate Atlantis Tema =====

# ---------------------------------------------------
# Sektion 1: Autostart (Programmer der starter med Hyprland)
# VIGTIGT: Disse linjer manglede!
# ---------------------------------------------------
exec-once = waybar &
exec-once = hyprpaper &
exec-once = /usr/lib/polkit-kde-authentication-agent-1 &
exec-once = swayidle -w \
            timeout 300 'hyprctl dispatch dpms off' \
            resume 'hyprctl dispatch dpms on' \
            timeout 600 'systemctl suspend' \
            before-sleep 'swaylock -f'


# ---------------------------------------------------
# Sektion 2: Skærmindstillinger
# ---------------------------------------------------
# Se https://wiki.hyprland.org/Configuring/Monitors/ for flere detaljer
monitor=,preferred,auto,1


# ---------------------------------------------------
# Sektion 3: Environment Variabler
# ---------------------------------------------------
env = XCURSOR_SIZE,24
env = QT_QPA_PLATFORMTHEME,qt5ct # For at Qt-apps ser pænere ud


# ---------------------------------------------------
# Sektion 4: Input Indstillinger (Tastatur & Mus)
# ---------------------------------------------------
input {
    kb_layout = dk
    kb_variant =
    kb_model =
    kb_options = grp:alt_shift_toggle # Gør det muligt at tilføje flere layouts og skifte med Alt+Shift
    kb_rules =

    follow_mouse = 1

    touchpad {
        natural_scroll = no
    }
    sensitivity = 0 # -1.0 til 1.0, 0 betyder ingen ændring
}


# ---------------------------------------------------
# Sektion 5: Generelle Indstillinger & Udseende
# ---------------------------------------------------
general {
    gaps_in = 5
    gaps_out = 10
    border_size = 2
    
    # Stargate Atlantis farver
    col.active_border = rgba(00a0ffff) rgba(ffffffaa) 45deg
    col.inactive_border = rgba(ccccccaa)

    layout = dwindle # Tiling layout
}

decoration {
    # Generel dekoration
    rounding = 3
    
    # Blur-effekt for gennemsigtighed
    blur {
        enabled = true
        size = 3
        passes = 1
        new_optimizations = true
    }

    # Skygge-effekt omkring vinduer
    shadow {
        enabled = yes
        range = 4
        render_power = 3
        color = 0xee1a1a1a
    }
}

animations {
    enabled = yes
    bezier = myBezier, 0.05, 0.9, 0.1, 1.05
    animation = windows, 1, 7, myBezier
    animation = windowsOut, 1, 7, default, popin 80%
    animation = border, 1, 10, default
    animation = fade, 1, 7, default
    animation = workspaces, 1, 6, default
}


# ---------------------------------------------------
# Sektion 6: Keybindings (Genvejstaster)
# ---------------------------------------------------
$mainMod = SUPER # "Super" er Windows-tasten

# Grundlæggende navigation
bind = $mainMod, RETURN, exec, kitty
bind = $mainMod, Q, killactive, 
bind = $mainMod, M, exit, # Afslut Hyprland session
# bind = $mainMod, D, exec, wofi --show drun --conf /home/{{ username }}/.config/wofi/config --style /home/{{ username }}/.config/wofi/style.css
bind = $mainMod, D, exec, wofi --show drun
bind = $mainMod, F, fullscreen,

# Genveje til filbrowsere
bind = $mainMod, E, exec, thunar
bind = $mainMod, T, exec, kitty -e ranger

# Flyt fokus med piletaster
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d

# Flyt det aktive vindue
bind = $mainMod SHIFT, left,  movewindow, l
bind = $mainMod SHIFT, right, movewindow, r
bind = $mainMod SHIFT, up,    movewindow, u
bind = $mainMod SHIFT, down,  movewindow, d

# Ændr størrelse på det aktive vindue
bind = $mainMod CTRL, left,  resizeactive, -20 0
bind = $mainMod CTRL, right, resizeactive, 20 0
bind = $mainMod CTRL, up,    resizeactive, 0 -20
bind = $mainMod CTRL, down,  resizeactive, 0 20

# Skift til workspace 1-9
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

# Flyt aktivt vindue til workspace 1-9
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

# Vis keybindings i en wofi menu
bind = $mainMod, SPACE, exec, ~/.local/bin/hypr-keys.sh

# Volume control
bind = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%
bind = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%
bind = , XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle

# Screen brightness
bind = , XF86MonBrightnessUp, exec, brightnessctl set +5%
bind = , XF86MonBrightnessDown, exec, brightnessctl set 5%-

# Microphone mute
bind = , XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle

# Lock Screen
bind = $mainMod, L, exec, swaylock -f --screenshots --clock --indicator --effect-blur 7x5 --effect-vignette 0.5:0.5 --ring-color 89b4fa --key-hl-color 00aaff --text-color ffffff