#####################################################################
#    __ __              __             __                ____       #
#   / // /_ _____  ____/ /__ ____  ___/ /  _______  ___  / _(_)__ _ #
#  / _  / // / _ \/ __/ / _ `/ _ \/ _  /  / __/ _ \/ _ \/ _/ / _ `/ #
# /_//_/\_, / .__/_/ /_/\_,_/_//_/\_,_/   \__/\___/_//_/_//_/\_, /  #
#     /___/_/                                             /___/     #
#####################################################################



#AUTOSTART.

# Autostart for Hyprland's FULL RESTART.
exec-once = waybar -c .config/waybar/config.jsonc -s .config/waybar/style.css
exec-once = swaybg -i Media/Pics/Walls/Anime/girl-3.png
exec-once = brightnessctl set 5%

# Autostart for Hyprland's CONFIG RELOAD.
exec = hyprctl setcursor GoogleDot-White 28
exec = export QT_QPA_PLATFORM=wayland
exec = export QT_DISABLE_WINDOWDECORATION=1



#DEFAULT THINGS.
# Mod key.
$mainMod = SUPER

# Default programs.
$term = foot	#Terminal emulator.
$fmt = foot -e ranger	#File manager.
$fmg = nemo	#File manager.
$mpt = foot --title=cmus -e cmus	#Music player.
$vc = foot --title=vc -e pulsemixer

# Some default env vars.
env = XCURSOR_SIZE,28

# Display configuration.
monitor=eDP-1,1920x1080@60,0x0,1

# Apllications (windows) rules.
windowrule = workspace 1, firefox
windowrule = workspace 3, 64gram-desktop
windowrule = workspace 2, foot
windowrule = workspace 3, signal-desktop
windowrule = xray 1, 64gram-desktop
windowrule = workspace 6, krita
windowrule = workspace 5, prismlauncher

windowrule = float, swayimg
windowrule = center, swayimg
windowrule = workspace 4, swayimg
windowrule = size 1250 700, swayimg
windowrule = move 330 15%, swayimg

windowrulev2 = float,^(foot)$,title:^(cmus)$
windowrulev2 = center,^(foot)$,title:^(cmus)$
windowrulev2 = size 1250 700,^(foot)$,title:^(cmus)
windowrulev2 = move 330 15%,^(foot)$,title:^(cmus)
windowrulev2 = workspace 4,^(foot)$,title:^(cmus)$

windowrulev2 = float,^(foot)$,title:^(vc)$
windowrulev2 = center,^(foot)$,title:^(vc)$
windowrulev2 = size 800 550,^(foot)$,title:^(vc)
windowrulev2 = move 1100 42%,^(foot)$,title:^(vc)
windowrulev2 = workspace unset,^(foot)$,title:^(vc)$



# Layer rules.
layerrule = blur, waybar
#layerrule = blur, gtklock



# SYSTEM SHORTCUTS.

# Brightness 5% step contol shortcuts.
bind=,XF86MonBrightnessDown, exec, brightnessctl set 5%-
bind=,XF86MonBrightnessUp, exec, brightnessctl set +5%

# Brightness 1% step contol shortcuts.
bind=$mainMod, XF86MonBrightnessDown, exec, brightnessctl set 1%-
bind=$mainMod, XF86MonBrightnessUp, exec, brightnessctl set +1%

# Toggle Waybar.
bindr=$mainMod, D, exec, pkill waybar || waybar

# Audio volume control shortcuts.
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

# Audio play/pause control shortcut.
bindl=, XF86AudioPlay, exec, cmus-remote --pause
bindl=, XF86AudioPlay, exec, playerctl play-pause

# Audio next song control shortcut.
bindl=, XF86AudioNext, exec, cmus-remote --next
bindl=, XF86AudioNext, exec, playerctl next

# Audio prev song control shortcut.
bindl=, XF86AudioPrev, exec, cmus-remote --prev
bindl=, XF86AudioPrev, exec, playerctl prev



# APPS SHORTCUTS.
# Applications shortcuts.
bind = $mainMod, Q, exec, $term
bind = $mainMod, E, exec, $fmt
bind = $mainMod ALT, E, exec, $fmg
bind = $mainMod ALT, C, exec, $mpt
bind = $mainMod, G, exec, $vc
bind = $mainMod ALT, 1, exec, hyprctl dispatch exec [workspace 3] Telegram
bind = $mainMod ALT, 2, exec, hyprctl dispatch exec [workspace 1] firefox
bind = $mainMod ALT, 3, exec, hyprctl dispatch exec [workspace 5] prismlauncher
bind = $mainMod ALT, 4, exec, hyprctl dispatch exec [workspace 3] signal-desktop
bind = $mainMod ALT, 5, exec, hyprctl dispatch exec [workspace 5] ./.freetube/freetube

# Lock screen shortcut.
bind=$mainMod ALT, Delete, exec, gtklock -i

# Grim (screenshot tool) shortcut.
bind = , Print, exec, grim /home/lilac/Media/Pics/Scr/Screen-"$(date +%s)".png



# WINDOWS SHORTCUTS.
# Windows shortcuts.
bind = $mainMod, F, fullscreen,
bind = $mainMod, W, killactive, 
bind = $mainMod, M, exit, 
bind = $mainMod, S, togglefloating, 
bind = $mainMod, C, centerwindow, # dwindle
bind = $mainMod, R, fakefullscreen,

# Move focus shortcuts.
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d

# Move floating windows.
bind = $mainMod SHIFT, right, moveactive, 45 0
bind = $mainMod SHIFT, left, moveactive, -45 0
bind = $mainMod SHIFT, up, moveactive, 0 -45
bind = $mainMod SHIFT, down, moveactive, 0 45

# Move floating windows with smaller steps.
bind = $mainMod SHIFT ALT, right, moveactive, 15 0
bind = $mainMod SHIFT ALT, left, moveactive, -15 0
bind = $mainMod SHIFT ALT, up, moveactive, 0 -15
bind = $mainMod SHIFT ALT, down, moveactive, 0 15

# Move floating windows to a screen edge.
bind = $mainMod ALT, Left, movewindow, l
bind = $mainMod ALT, Right, movewindow, r
bind = $mainMod ALT, Up, movewindow, u
bind = $mainMod ALT, Down, movewindow, d

# Resize windows.
bind = $mainMod CTRL, left, resizeactive,-45 0
bind = $mainMod CTRL, right, resizeactive,45 0
bind = $mainMod CTRL, up, resizeactive,0 -45
bind = $mainMod CTRL, down, resizeactive,0 45

bind = $mainMod ALT CTRL, left, resizeactive,-15 0
bind = $mainMod ALT CTRL, right, resizeactive,15 0
bind = $mainMod ALT CTRL, up, resizeactive,0 -15
bind = $mainMod ALT CTRL, down, resizeactive,0 15

# Move/resize windows with mouse/touchpad.
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow


#Workspaces shortcuts.
# Switch workspaces.
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 another workspace.
bind = $mainMod CONTROL, 1, movetoworkspace, 1
bind = $mainMod CONTROL, 2, movetoworkspace, 2
bind = $mainMod CONTROL, 3, movetoworkspace, 3
bind = $mainMod CONTROL, 4, movetoworkspace, 4
bind = $mainMod CONTROL, 5, movetoworkspace, 5
bind = $mainMod CONTROL, 6, movetoworkspace, 6
bind = $mainMod CONTROL, 7, movetoworkspace, 7
bind = $mainMod CONTROL, 8, movetoworkspace, 8
bind = $mainMod CONTROL, 9, movetoworkspace, 9
bind = $mainMod CONTROL, 0, movetoworkspace, 10

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



# Input things.
input {
    #Keyboard layout.
    kb_layout = us, ru
    kb_variant =
    kb_model =
    kb_options = grp:win_space_toggle
    kb_rules =
    left_handed = false
    follow_mouse = 1
    #TouchPad.
    touchpad {
        natural_scroll = no
        disable_while_typing=0
    }
    #Mouse.
    sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}

# TOUCHPAD GESTURES.
gestures {
    workspace_swipe = on
    workspace_swipe_fingers = 3
    workspace_swipe_distance = 80
    workspace_swipe_min_speed_to_force = 10
}



# APPEARANCE.
# Basics.
general {
    cursor_inactive_timeout = 10
    gaps_in = 8
    gaps_out = 18
    border_size = 1
    col.active_border = rgb(181825) #rgb(b4befe) rgb(45475a) rgb(45475a) rgb(b4befe) 40deg
    col.inactive_border = rgb(181825) 
    layout = master
    allow_tearing = false
}

# Windows decorations.
decoration {
    rounding = 12
    dim_inactive = true
    blur {
        enabled = true
        size = 10
        passes = 3
	xray = true
    }
    
    # Shadows.
    drop_shadow = yes
    shadow_range = 70
    shadow_render_power = 5
    col.shadow= 0x55000000
    col.shadow_inactive=0x55000000
}

# Animations.
animations {
    enabled = yes

    bezier = myBezier, 0.05, 0.7, 0.1, 1.0
    bezier = myBezier1, 0.05, 0.8, 0.1, 1.0
    bezier = myBezier2, 0.05, 0.92, 0.1, 1.0

    animation = windows, 1, 9, myBezier2, popin
    animation = windowsOut, 1, 7, myBezier2, popin 80%
    animation = border, 1, 10, default
    animation = borderangle, 0, 8, myBezier1
    animation = fade, 1, 7, myBezier1
    animation = workspaces, 1, 8, myBezier, slide
}



# LAYOUT THINGS.
# DWindle layout.
dwindle {
    pseudotile = yes
    preserve_split = yes
    smart_split = no
    no_gaps_when_only = 1
}

# Master layout (In use now).
master {
    new_is_master = false
    no_gaps_when_only = 1
    mfact = 0.62
}



# OTHER THINGS.
misc {
    animate_manual_resizes = true
    force_default_wallpaper = 0
    disable_hyprland_logo = true # Set to 0 to disable the anime mascot wallpapers
}

device:epic-mouse-v1 {
    sensitivity = -0.5
}
