# Our powerful(in progress) Hyprland config file!
# Please read documentation!

# Monitor configuration
monitor = eDP-1, 1920x1080@144, 1920x0, 1
monitor = HDMI-A-1, 1920x1080@144, 0x0, 1, transform, 2

# Workspace assignment
workspace = 1, monitor:HDMI-A-1
workspace = 2, monitor:HDMI-A-1
workspace = 3, monitor:HDMI-A-1
workspace = 4, monitor:HDMI-A-1

workspace = 5, monitor:eDP-1
workspace = 6, monitor:eDP-1
workspace = 7, monitor:eDP-1
workspace = 8, monitor:eDP-1
workspace = 9, monitor:eDP-1
workspace = 10, monitor:eDP-1

# Autostart
exec-once = waybar # In Progress
exec-once = swww-daemon
exec-once = waypaper --restore
exec-once = hyprctl setcursor Adwaita 24 # Needed on NixOS
exec-once = mkdir -p $HOME/Pictures/Screenshots

# Our apps, adjust for yourself, otherwise apps won't run!
$terminal = kitty
$fileManager = nautilus # GNOME file manager
$menu = wofi --show drun # Aplication launcher
$telegram = Telegram
$spotify = spotify
$vscode = code
$browser = google-chrome-stable

# Cursor
env = XCURSOR_THEME,Adwaita
env = XCURSOR_SIZE,24

# Input configuration
input {
    kb_layout = us, ru
    kb_variant =
    kb_model =
    kb_options = grp:alt_shift_toggle
    kb_rules =
    numlock_by_default = true

    follow_mouse = 1

    touchpad {
        natural_scroll = false
        scroll_factor = 0.6
    }

    sensitivity = 0 # -1.0 to 1.0, 0 means no modification.
}

# Gestures
gesture = 3, horizontal, workspace
gesture = 3, vertical, fullscreen

# General settings
general {
    gaps_in = 3.5 # The space between windows
    gaps_out = 4.5 # The space between screen edges & borders

    border_size = 0
    resize_on_border = false

    allow_tearing = false

    layout = dwindle
}

# Decoration settings (borders)
decoration {
    rounding = 2

    # Change transparency of focused and unfocused windows
    active_opacity = 0.985
    inactive_opacity = 0.85

shadow {
    enabled = true
    range = 4
    render_power = 3
    color = rgba(1a1a1aee)
}

blur {
    enabled = true
    size = 3
    passes = 1

    vibrancy = 0.1696
}
}

# Animations
animations {
    enabled = true
    bezier = wind, 0.05, 0.9, 0.1, 1.05
    bezier = winIn, 0.1, 1.1, 0.1, 1.1
    bezier = winOut, 0.3, -0.3, 0, 1
    bezier = liner, 1, 1, 1, 1
    animation = windows, 1, 6, wind, slide
    animation = windowsIn, 1, 6, winIn, slide
    animation = windowsOut, 1, 5, winOut, slide
    animation = windowsMove, 1, 5, wind, slide
    animation = border, 1, 1, liner
    animation = borderangle, 1, 30, liner
    animation = fade, 1, 10, default
    animation = workspaces, 1, 5, wind
}

# Layouts
dwindle {
    pseudotile = true
    preserve_split = true
    smart_split = false
}

# Default wallpaper settings
misc {
    force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers
    disable_hyprland_logo = true
    disable_splash_rendering = true
    key_press_enables_dpms = true
    mouse_move_enables_dpms = true
    vrr = 0
}

# Binds configuration
binds {
    disable_keybind_grabbing = false
}

# XWayland settings
xwayland {
    enabled = true
    force_zero_scaling = false
    use_nearest_neighbor = false
}

# Window Rules
## Default rules
windowrule = suppressevent maximize, class:.*
windowrule = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0

## Floating app rules
windowrule = float, class:^(org.pulseaudio.pavucontrol)$
windowrule = float, title:^(blueman-manager)$
windowrule = float, class:^(nm-connection-editor)$
windowrule = float, class:^(waypaper)$
windowrule = float, size 1150 600, class:^(net.nokyan.Resources)$
windowrule = float, class:^(gnome-calculator)$
windowrule = float, class:^(Calculator)$

## File picker fixes
windowrule = float,title:^(Open Files|File Picker),class:^(.*)$
windowrule = float,title:^(Open Folder|File Picker),class:^(.*)$
windowrule = float,title:^(Select Image|File Picker),class:^(.*)$
windowrule = float,title:^(Save File|File Picker),class:^(.*)$
windowrule = float,title:^(Change Download Location|File Picker),class:^(.*)$
windowrule = float,class:^(xdg-desktop-portal-gtk)$

## Picture-in-Picture
windowrule = float, title:^(Picture-in-Picture)$
windowrule = pin, title:^(Picture-in-Picture)$
windowrule = move 69.5% 4%, title:^(Picture-in-Picture)$

# Layer Rules
layerrule = blur, waybar
layerrule = ignorealpha 0.5, waybar


# Keybindings
$mainMod = SUPER # Sets "Windows" key as main modifier
$mainMod2 = ALT  # Secondary modifier for window management (ALT Button)
$shiftMod = SHIFT

# System binds
bind = $mainMod, C, killactive,
bind = $mainMod2, F4, killactive,  # Alternative Windows-style close
bind = $mainMod, M, exit,  # Safer exit combination
bind = $mainMod, Z, togglefloating,
bind = $mainMod, X, fullscreen
bind = $mainMod SHIFT, F, fullscreen, 1  # Fullscreen mode 1 (keeps window decorations)
bind = $mainMod, L, exec, hyprlock
bind = $mainMod, O, togglesplit,  # Toggle split direction
bind = $mainMod, P, exec, poweroff

# App launcher
bind = $mainMod, R, exec, $menu

# App launch binds
bind = $mainMod, Q, exec, $terminal
bind = $mainMod, F, exec, $fileManager
bind = $mainMod, B, exec, $browser
bind = $mainMod, V, exec, $vscode
bind = $mainMod, T, exec, $telegram
bind = $mainMod, S, exec, $spotify

# Utility binds
bind = CTRL SHIFT, ESCAPE, exec, $terminal htop  # Task manager alternative
bind = $mainMod SHIFT, S, exec, hyprshot -m region -o $HOME/Pictures/Screenshots -f Screenshot_$(date "+%Y-%m-%d_%H:%M:%S").png -z

# WORKSPACE MANAGEMENT (SUPER)
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

# Workspace navigation with arrow keys
bind = $mainMod, left, workspace, r-1
bind = $mainMod, right, workspace, r+1

# Move 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, 10

# Move window to workspace with arrow keys
bind = $mainMod SHIFT, left, movetoworkspace, r-1
bind = $mainMod SHIFT, right, movetoworkspace, r+1

# Move window to workspace silently (without switching to it)
bind = $mainMod CTRL, 1, movetoworkspacesilent, 1
bind = $mainMod CTRL, 2, movetoworkspacesilent, 2
bind = $mainMod CTRL, 3, movetoworkspacesilent, 3
bind = $mainMod CTRL, 4, movetoworkspacesilent, 4
bind = $mainMod CTRL, 5, movetoworkspacesilent, 5
bind = $mainMod CTRL, 6, movetoworkspacesilent, 6
bind = $mainMod CTRL, 7, movetoworkspacesilent, 7
bind = $mainMod CTRL, 8, movetoworkspacesilent, 8
bind = $mainMod CTRL, 9, movetoworkspacesilent, 9
bind = $mainMod CTRL, 0, movetoworkspacesilent, 10

bind = $mainMod CTRL, left, movetoworkspacesilent, r-1
bind = $mainMod CTRL, right, movetoworkspacesilent, r+1

# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1

# WINDOW MANAGEMENT (ALT)
# Move focus with ALT + arrow keys (more ergonomic than SUPER)
bind = $mainMod2, left, movefocus, l
bind = $mainMod2, right, movefocus, r
bind = $mainMod2, up, movefocus, u
bind = $mainMod2, down, movefocus, d

# Cycle through windows with ALT + TAB
bind = $mainMod2, TAB, cyclenext
bind = $mainMod, TAB, cyclenext, prev

# Resize windows with ALT + CTRL + arrow keys
bind = $mainMod2 CTRL, left, resizeactive, -50 0
bind = $mainMod2 CTRL, right, resizeactive, 50 0
bind = $mainMod2 CTRL, up, resizeactive, 0 -50
bind = $mainMod2 CTRL, down, resizeactive, 0 50

# Move windows with ALT + SHIFT + arrow keys
bind = $mainMod2 SHIFT, left, movewindow, l
bind = $mainMod2 SHIFT, right, movewindow, r
bind = $mainMod2 SHIFT, up, movewindow, u
bind = $mainMod2 SHIFT, down, movewindow, d

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

# Laptop multimedia keys for volume and LCD brightness
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+
bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-

# Requires playerctl
bindl = , XF86AudioNext, exec, playerctl next
bindl = , XF86AudioPause, exec, playerctl play-pause
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPrev, exec, playerctl previous


