# Source a file (multi-file configs)
# NOTE: Many of these are generated depending on the NixOS config
source = ~/.config/hypr/autostart.conf
source = ~/.config/hypr/floatingrules.conf
source = ~/.config/hypr/input.conf
source = ~/.config/hypr/keybindings.conf
source = ~/.config/hypr/monitors.conf
source = ~/.config/hypr/polkit.conf
source = ~/.config/hypr/translucentrules.conf
source = ~/.config/hypr/workspaces.conf
source = ~/.config/hypr/workspacerules.conf

layerrule = blur,rofi
layerrule = blur,waybar

general {
    gaps_in = 5
    gaps_out = 20
    border_size = 2

    col.inactive_border = rgba(463a2eff)
    col.active_border = rgba(865e4dff)

    layout = dwindle
}

group {
    groupbar {
        render_titles = false
        font_size = 10
        gradients = false
    }

    col.border_active = rgba(e4b074ff)
    col.border_inactive = rgba(997b66ff)
}

decoration {
    rounding = 5
    # multisample_edges = on # Deprecated

    blur {
        enabled = true
        size = 10
        passes = 3
        new_optimizations = true
        ignore_opacity = true
        xray = true
    }

    drop_shadow = off
    shadow_range = 4
    shadow_render_power = 3
    col.shadow = rgba(1a1a1aee)
}

misc {
    force_default_wallpaper = 0
}

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 = borderangle, 1, 8, default
    animation = fade, 1, 7, default
    animation = workspaces, 1, 6, default
}

dwindle {
    pseudotile = yes # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
    preserve_split = yes # you probably want this
}

master {
    new_is_master = true
}

gestures {
    workspace_swipe = off
}

# TODO: Rofi
bind = $mainMod, D, exec, ~/NixFlake/config/rofi/menus/systemd-podman.fish
bind = $mainMod, O, exec, ~/NixFlake/config/rofi/menus/lectures.fish
bind = $mainMod, M, exec, ~/NixFlake/config/rofi/menus/keybinds.fish
bind = $mainMod, U, exec, ~/NixFlake/config/rofi/menus/vpn.fish

# TODO: These should probably be generated depending on the NixOS workspace config?

# Move focus with mainMod + arrow keys
bind = $mainMod, h, movefocus, l
bind = $mainMod, l, movefocus, r
bind = $mainMod, k, movefocus, u
bind = $mainMod, j, movefocus, d

# Swap windows
bind = $mainMod CTRL, h, movewindow, l
bind = $mainMod CTRL, l, movewindow, r
bind = $mainMod CTRL, k, movewindow, u
bind = $mainMod CTRL, d, movewindow, d

# Switch workspaces with mainMod + [1-9] for main monitor, mainMod + 0 for secondary monitor
bind = $mainMod, tab, workspace, previous
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, workspace, 10

# Move active window to a workspace with mainMod + SHIFT + [1-9] for main monitor, mainMod + SHIFT + 0 for secondary monitor
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, 10

# Reset the workspace positions after disabling and reenabling a monitor
bind = CTRL ALT, R, moveworkspacetomonitor, 1 DP-1
bind = CTRL ALT, R, moveworkspacetomonitor, 2 DP-1
bind = CTRL ALT, R, moveworkspacetomonitor, 3 DP-1
bind = CTRL ALT, R, moveworkspacetomonitor, 4 DP-1
bind = CTRL ALT, R, moveworkspacetomonitor, 5 DP-1
bind = CTRL ALT, R, moveworkspacetomonitor, 6 DP-1
bind = CTRL ALT, R, moveworkspacetomonitor, 7 DP-1
bind = CTRL ALT, R, moveworkspacetomonitor, 8 DP-1
bind = CTRL ALT, R, moveworkspacetomonitor, 9 DP-1
bind = CTRL ALT, R, moveworkspacetomonitor, 10 HDMI-A-1

# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
