# Hyprland config - port of sway config

# Launch hyprlock immediately on startup
# The '|| hyprctl dispatch exit' is a safety net:x
# if hyprlock fails to start, it kills the session so the desktop isn't exposed.
exec-once = hyprlock || hyprctl dispatch exit

# Monitor configuration
# Monitor configuration
monitor = HDMI-A-1,1920x1080@165,0x0,1
monitor = eDP-1,2560x1600@240,-1600x0,1.6

####exec-once = hyprctl dispatch moveworkspacetomonitor 1 HDMI-A-1
workspace = 1, monitor:HDMI-A-1, default:true
workspace = 10, monitor:eDP-1, default:true

# Execute at launch
exec-once = swaybg -i /home/texturawasd/Pictures/Wallpapers/wallpaper-black-mountain.jpg -m fill
exec-once = export GTK_THEME=Mint-Y-Dark-Aqua
exec-once = export QT_QPA_PLATFORMTHEME=qt5ct
exec-once = waybar
exec-once = dunst

# =====================================================================
# FULLSCREEN-PAGE MODE (Sway-like Tabbed Emulation)
# toggle with SUPER+TAB
# when enabled, ALT+TAB cycles through windows, each maximized (fullscreen 1)
# =====================================================================

# state variable
$pagemode = 0

# toggle function
bind = SUPER, TAB, exec, \
    if [ "$pagemode" = "0" ]; then \
        pagemode=1; \
        hyprctl dispatch fullscreen 1; \
    else \
        pagemode=0; \
        hyprctl dispatch fullscreen 0; \
    fi

# cycle next
bind = ALT, TAB, exec, \
    if [ "$pagemode" = "1" ]; then \
        hyprctl dispatch cyclenext; \
        hyprctl dispatch fullscreen 1; \
    else \
        hyprctl dispatch cyclenext; \
    fi

# cycle previous (SHIFT+ALT+TAB)
bind = ALT SHIFT, TAB, exec, \
    if [ "$pagemode" = "1" ]; then \
        hyprctl dispatch cycleprev; \
        hyprctl dispatch fullscreen 1; \
    else \
        hyprctl dispatch cycleprev; \
    fi

#
# ==================================================================
#

$mod = SUPER
$term = alacritty

input {
    kb_layout = us, latam
	kb_options = grp:alt_shift_toggle
    follow_mouse = 1
    sensitivity = 0
}

general {
    gaps_in = 5
    gaps_out = 5
    border_size = 0
    col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
    col.inactive_border = rgba(595959aa)
    layout = master
    allow_tearing = false
}

# so pretty :o
decoration {
    rounding = 8
    blur {
        enabled = true
        size = 3
        passes = 1
        #blur_exceptions = ["alacritty"]
    }
    shadow {
        enabled = false
    }
}

windowrule = no_blur on, match:class Alacritty

# animations
animations {
    enabled = true
    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
}

# layouts
dwindle {
    pseudotile = true
    preserve_split = true
}

master {
    new_status = master
}

misc {
    vrr = 0
    force_default_wallpaper = 0
    disable_hyprland_logo = true
    vfr = false
	render_unfocused_fps = 0

}


################
# Key bindings #
################

bind = $mod, Return, exec, $term
bind = $mod SHIFT, Q, killactive,
bind = $mod, D, exec, XDG_DATA_DIRS="$HOME/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share" wofi --show drun
bind = $mod SHIFT, D, exec, hyprland-run
bind = $mod SHIFT, r, exec, wofi --show run
bind = $mod SHIFT, C, exec, hyprctl reload
#NONONONONONONONNONONONONbind = $mod SHIFT, E, exit,

bind = $mod      , X, exec, wlogout -b 2 -c 2 -p layer-shell

bind = $mod SHIFT, F, exec, thunar

bind = , Print, exec, grim ~/Pictures/screenshot_$(date +%F_%T).png
bind = $mod SHIFT, S, exec, grim -g "$(slurp)" - | tee ~/Pictures/screenshot_$(date +%F_%T).png | wl-copy

# Move focus (vim keys)
#bind = $mod, H, movefocus, l
#bind = $mod, L, movefocus, r
#bind = $mod, K, movefocus, u
#bind = $mod, J, movefocus, d

# Move focus (arrow keys)
bind = $mod, left, movefocus, l
bind = $mod, right, movefocus, r
bind = $mod, up, movefocus, u
bind = $mod, down, movefocus, d

# Move windows (vim keys)
bind = $mod SHIFT, H, movewindow, l
bind = $mod SHIFT, L, movewindow, r
bind = $mod SHIFT, K, movewindow, u
bind = $mod SHIFT, J, movewindow, d

# Move windows (arrow keys)
bind = $mod SHIFT, left, movewindow, l
bind = $mod SHIFT, right, movewindow, r
bind = $mod SHIFT, up, movewindow, u
bind = $mod SHIFT, down, movewindow, d

# Workspaces
bind = $mod, 1, workspace, 1
bind = $mod, 2, workspace, 2
bind = $mod, 3, workspace, 3
bind = $mod, 4, workspace, 4
bind = $mod, 5, workspace, 5
bind = $mod, 6, workspace, 6
bind = $mod, 7, workspace, 7
bind = $mod, 8, workspace, 8
bind = $mod, 9, workspace, 9
bind = $mod, 0, workspace, 10

# Move to workspace
bind = $mod SHIFT, 1, movetoworkspace, 1
bind = $mod SHIFT, 2, movetoworkspace, 2
bind = $mod SHIFT, 3, movetoworkspace, 3
bind = $mod SHIFT, 4, movetoworkspace, 4
bind = $mod SHIFT, 5, movetoworkspace, 5
bind = $mod SHIFT, 6, movetoworkspace, 6
bind = $mod SHIFT, 7, movetoworkspace, 7
bind = $mod SHIFT, 8, movetoworkspace, 8
bind = $mod SHIFT, 9, movetoworkspace, 9
bind = $mod SHIFT, 0, movetoworkspace, 10

# Layout controls
bind = $mod, B, togglesplit, # horizontal split
bind = $mod, V, togglesplit, # vertical split (Hyprland uses togglesplit)
bind = $mod, S, exec, hyprctl keyword general:layout master # stacking-like (master layout)
bind = $mod, E, exec, hyprctl keyword general:layout dwindle # back to tiling

# Fullscreen
bind = $mod, F, fullscreen, 0

# Floating
bind = $mod SHIFT, SPACE, togglefloating,
bind = $mod, SPACE, focusmonitor, +1

# Scratchpad (special workspace in Hyprland)
bind = $mod SHIFT, W, movetoworkspace, special
bind = $mod SHIFT, A, togglespecialworkspace,
bind = $mod, minus, togglespecialworkspace,1

# Resize mode
bind = $mod, R, submap, resize
submap = resize
#binde = , H, resizeactive, -35 0
#binde = , L, resizeactive, 35 0
#binde = , K, resizeactive, 0 -35
#binde = , J, resizeactive, 0 35
binde = , left, resizeactive, -35 0
binde = , right, resizeactive, 35 0
binde = , up, resizeactive, 0 -35
binde = , down, resizeactive, 0 35
bind = , Return, submap, reset
bind = , escape, submap, reset
submap = reset

# lock screen like in windows
bind = $mod, L, exec, hyprlock

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

# Media keys
bindl = , XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle
bindl = , XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%
bindl = , XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%
bindl = , XF86AudioMicMute, exec, pactl set-source-mute @DEFAULT_SOURCE@ toggle

# Brightness keys
bindl = , XF86MonBrightnessDown, exec, brightnessctl set 5%-
bindl = , XF86MonBrightnessUp, exec, brightnessctl set 5%+

# = Source for hyprviz
source = ./hyprviz.conf

damage_tracking = full
