# Config home wiki: https://wiki.hyprland.org
# See https://wiki.hyprland.org/Configuring/Monitors/

# Day
monitor=DP-2, highrr, 0x1080, 1, bitdepth, 10, vrr, 1
monitor=DP-3, highrr, 760x0, 1, vrr, 1
workspace = DP-3, 5

# Night
#monitor=DP-2, highrr, 0x0, 1, bitdepth, 10, vrr, 0
#monitor=DP-3, disable

# Main workspace
workspace = DP-2, 1

# Color: Catppuccin Mocha
source=~/.config/hypr/mocha.conf

# Launch applications
exec-once = hyprpaper
exec-once = waybar -c ~/.config/waybar/config.json
exec-once = syncthing --no-browser
exec-once = hyprctl setcursor Catppuccin-Mocha-Lavender 24
exec-once = xwaylandvideobridge
exec-once = linux-discord-rich-presence -c ~/.config/linux-discord-rich-presencerc 


# Slow launch fix
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP

# Default env vars.
env = XCURSOR_SIZE,20

# Nvidia environment variables
env = LIBVA_DRIVER_NAME,nvidia
env = XDG_SESSION_TYPE,wayland
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = WLR_NO_HARDWARE_CURSORS,1
#env = GBM_BACKEND,nvidia-drm
#env = WLR_DRM_NO_ATOMIC,1

# Nvidia G-Sync
env = __GL_GSYNC_ALLOWED,1
env = __GL_VRR_ALLOWED,1

input {
    kb_layout = us
    follow_mouse = 2
    sensitivity = -.75 # -1.0 - 1.0, 0 means no modification.
}

general {
    gaps_in = 5
    gaps_out = 10
    border_size = 0
    col.active_border = 0xee$lavenderAlpha 45deg
    col.inactive_border = 0xaa$overlay0Alpha
    layout = dwindle
    allow_tearing = false
}

decoration {
    rounding = 10
    blur { 
        enabled = yes
        size = 12
        passes = 1
    }

    drop_shadow = yes
    shadow_range = 4
    shadow_render_power = 3
    col.shadow = 0xee$baseAlpha

    active_opacity = 1.0
    inactive_opacity = 0.9
}

animations {
    enabled = yes
    animation = windows, 1, 8, default
    animation = windowsOut, 1, 8, default
    animation = border, 1, 8, default
    animation = borderangle, 1, 8, default
    animation = fade, 1, 8, default
    animation = workspaces, 1, 8, default, slidefade 80%
}

dwindle {
    pseudotile = yes
    preserve_split = yes 
}

master {
    new_is_master = true
}

misc {
    disable_hyprland_logo = true
    disable_splash_rendering = true
    force_default_wallpaper = 0
    vrr = 1
}

# General window rules
windowrule = float, ^(SnakePlusPlus)$ 
windowrule = center, ^(SnakePlusPlus)$ 
windowrule = opacity 0.6, ^(SnakePlusPlus)$ 
windowrule = float, ^(TetrisPlusPlus)$ 
windowrule = center, ^(TetrisPlusPlus)$ 
windowrulev2 = pseudo,class:^(firefox.*)$
windowrulev2 = pseudo,class:^(Alacritty.*)$
windowrulev2 = opacity 0.6 override 0.6 override,class:(Spotify)

# Game window rules
windowrulev2 = pseudo, class:(Minecraft.*)
windowrulev2 = size 2646 1108, class:(Minecraft.*)
windowrulev2 = pseudo, title:(Warframe.*)
windowrulev2 = size 2646 1108, title:(Warframe.*)

# Super bind
$mainMod = SUPER

# Passthrough
bind = , mouse:275, pass, ^(discord)$

# Tiling binds
bind = $mainMod SHIFT, Q, killactive, 
bind = $mainMod, SPACE, togglefloating, 
bind = $mainMod SHIFT, M, exit, 
bind = $mainMod SHIFT, J, togglesplit, # dwindle
bind = $mainMod SHIFT, P, pseudo, # dwindle
bind = $mainMod, F, fullscreen,

# Exec binds
bind = $mainMod SHIFT, E, exec, dolphin
bind = $mainMod SHIFT, S, exec, grim -g "$(slurp)" - | wl-copy
bind = $mainMod SHIFT, L, exec, swaylock -e -c cba6f7 -i /home/trianta/pics/catppuccin/misc/Street.jpg
bind = $mainMod, RETURN, exec, alacritty
bind = $mainMod, S, exec, wofi --show drun


# Audio binds
binde = , XF86AudioPlay, exec, playerctl play-pause
binde = , XF86AudioStop, exec, playerctl stop 
binde = , XF86AudioPrev, exec, playerctl previous
binde = , XF86AudioNext, exec, playerctl next 
binde = , XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle
binde = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%
binde = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%

bind = $mainMod, h, movefocus, l
bind = $mainMod, l, movefocus, r
bind = $mainMod, k, movefocus, u
bind = $mainMod, j, movefocus, d

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 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

# Custom resize bind
# bindsym $mod+ctrl+0 resize set width 3440px height 1440px
#binde = $mainMod SHIFT, ], setactivesize, 2646 1108

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

# Resize windows with arrow keys
binde = $mainMod, right, resizeactive, 10 0
binde = $mainMod, left, resizeactive, -10 0
binde = $mainMod, up, resizeactive, 0 10
binde = $mainMod, down, resizeactive, 0 -10