# Refer to the wiki for more information.
# https://wiki.hyprland.org/Configuring/Configuring-Hyprland/

# Please note not all available settings / options are set here.
# For a full list, see the wiki

# You can split this configuration into multiple files
# Create your files separately and then link them to this file like this:
# source = ~/.config/hypr/myColors.conf


################
### MONITORS ###
################

# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=eDP-1, 1920x1080@144, auto, 1
# monitor=HDMI-A-1, 1920x1080@60.02Hz, auto, 1, mirror, eDP-1
# monitor=HDMI-A-1, 1920x1080@60, auto, 1, mirror, eDP-1
# monitor=HDMI-A-1, 2560x1080@60.00, auto, 1


###################
### MY PROGRAMS ###
###################

# See https://wiki.hyprland.org/Configuring/Keywords/

# Set programs that you use
$terminal = foot
$fileManager = dolphin
$menu = tofi-drun
$browser = brave
$lock = loginctl lock-session
$screenshot_part = grimblast copysave area ~/Screenshots/$(date +'%s.png')
$screenshot_full = grimblast copysave screen ~/Screenshots/$(date +'%s.png')
$color_pick = hyprpicker --autocopy
$messaging = vesktop
$calculator = flatpak run org.gnome.Calculator
$refresh = random-paper && hyprctl hyprpaper reload ,"~/wallpapers/active.png"


#################
### AUTOSTART ###
#################

# Autostart necessary processes (like notifications daemons, status bars, etc.)
# Or execute your favorite apps at launch like this:

execr-once = random-paper && hyprpaper
execr-once = hyprctl setcursor phinger-cursors-light 24
execr-once = hypridle
execr-once = systemctl --user start hyprpolkitagent
execr-once = eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
exec-once = [workspace 1 silent] $browser
exec-once = [workspace 11 silent] $messaging
exec-once = [workspace 12 silent] foot bluetui
exec-once = [workspace 13 silent] foot nmtuii
exec-once = [workspace 14 silent] foot btop


#############################
### ENVIRONMENT VARIABLES ###
#############################

# See https://wiki.hyprland.org/Configuring/Environment-variables/
# XDG Specifications
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = XDG_SESSION_DESKTOP,Hyprland
# QT Variables
env = QT_AUTO_SCREEN_SCALE_FACTOR,1
env = QT_QPA_PLATFORM,wayland;xcb
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
env = QT_QPA_PLATFORMTHEME,qt5ct
# NVIDIA Specific
env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = LIBVA_DRIVER_NAME,nvidia # Hardware acceleration on NVIDIA GPUs
env = NVD_BACKEND,direct # https://wiki.hypr.land/Nvidia/#va-api-hardware-video-acceleration
# Theming Related Variables
env = XCURSOR_SIZE,24

cursor:no_hardware_cursors = true

#####################
### LOOK AND FEEL ###
#####################

# Refer to https://wiki.hyprland.org/Configuring/Variables/

# https://wiki.hyprland.org/Configuring/Variables/#general
general {
    gaps_in = 4
    gaps_out = 8

    border_size = 2

    # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
    col.active_border = rgba(e6003aff) rgba(3c3ce6ff) 45deg
    col.inactive_border = rgba(000000dd)

    # Set to true enable resizing windows by clicking and dragging on borders and gaps
    resize_on_border = true

    # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
    allow_tearing = false

    layout = dwindle
}

# https://wiki.hyprland.org/Configuring/Variables/#decoration
decoration {
    rounding = 0

    # Change transparency of focused and unfocused windows
    active_opacity = 1.0
    inactive_opacity = 1.0

    # https://wiki.hyprland.org/Configuring/Variables/#blur
    blur {
        enabled = true
        size = 2
        passes = 2
    }

    shadow:enabled = false
}

# https://wiki.hyprland.org/Configuring/Variables/#animations
animations {
    enabled = true

    # Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more

    animation = windows, 1, 2, default, slide
    animation = fade, 0
    animation = workspaces, 1, 2, default
}

# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
dwindle {
    pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
    preserve_split = true # You probably want this
}

# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
master {
    new_status = master
}

# https://wiki.hyprland.org/Configuring/Variables/#misc
misc {
    force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers
    disable_hyprland_logo = true # If true disables the random hyprland logo / anime girl background. :(
}


#############
### INPUT ###
#############

# https://wiki.hyprland.org/Configuring/Variables/#input
input {
    kb_layout = nus # Custom xkb layout
    kb_variant =
    kb_model =
    kb_options =
    kb_rules =

    numlock_by_default = true

    repeat_delay = 250
    repeat_rate = 50

    follow_mouse = 1
    sensitivity = 0 # -1.0 - 1.0, 0 means no modification.

    touchpad {
        natural_scroll = false
    }
}

# https://wiki.hyprland.org/Configuring/Variables/#gestures
gestures {
    workspace_swipe = false
}

# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
# device {
#     name = epic-mouse-v1
#     sensitivity = -0.5
# }


###################
### KEYBINDINGS ###
###################

# See https://wiki.hyprland.org/Configuring/Keywords/
$mainMod = SUPER # Sets "Windows" key as main modifier

# See https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod SHIFT, RETURN, exec, $terminal
bind = $mainMod, Y, exec, $browser
bind = $mainMod, C, killactive,
bind = $mainMod SHIFT, Q, exit,
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, O, togglefloating,
bind = $mainMod, SPACE, exec, $menu
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
bind = $mainMod, F, fullscreen
bind = $mainMod, S, exec, $screenshot_part
bind = $mainMod SHIFT, S, exec, $screenshot_full
bind = $mainMod, G, swapnext
bind = $mainMod, BACKSLASH, exec, $color_pick
bind = $mainMod CTRL SHIFT, A, exec, shutdown now
bind = ,F12, exec, $lock
bind = ,code:157, exec, $refresh
bind = ,code:148, exec, $calculator

# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d

# Special workspaces
# Messaging
bind = $mainMod, V, workspace, 11
bind = $mainMod, V, exec, $messaging
# Bluetooth control (bluetui)
bind = $mainMod, B, workspace, 12
bind = $mainMod, B, exec, ps aux | grep "foot bluetui" | grep -v grep || foot bluetui
# Network control (nmtui)
bind = $mainMod, N, workspace, 13
bind = $mainMod, N, exec, ps aux | grep "foot nmtuii" | grep -v grep || foot nmtuii
# Memory and system control (BTOP)
bind = $mainMod, M, workspace, 14
bind = $mainMod, M, exec, ps aux | grep "foot btop" | grep -v grep || foot btop

# Switch workspaces with mainMod + [0-9]
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 and switch to a workspace with mainMod + SHIFT + [0-9]
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 active window to a workspace with mainMod + CTRL + [0-9]
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

# Example special workspace (scratchpad)
# bind = $mainMod, S, togglespecialworkspace, magic
# bind = $mainMod SHIFT, S, movetoworkspace, special:magic

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

# Move/resize windows with mainMod + LMB/RMB and dragging
# Flag "m" means it uses the mouse
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow

# Multimedia keys for volume and brightness
# Flag "l" means you can use it on the lockscreen
# Requires playerctl
bindl = , XF86AudioNext, exec, playerctl next
bindl = , XF86AudioPause, exec, playerctl play-pause
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPrev, exec, playerctl previous

# Flag "e" means it will repeat when held down
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @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
# Requires brightnessctl
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-

##############################
### WINDOWS AND WORKSPACES ###
##############################

# See https://wiki.hypr.land/Configuring/Window-Rules/ for more
# See https://wiki.hypr.land/Configuring/Workspace-Rules/ for workspace rules

# Example windowrule v1
# windowrule = float, ^(kitty)$

# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$

# Ignore maximize requests from apps. You'll probably like this.
windowrule = suppressevent maximize, class:.*

# Fix some dragging issues with XWayland
windowrule = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0

# Float some windows
windowrule = float,class:^(confirm)$
windowrule = float,class:^(dialog)$
windowrule = float,class:^(download)$
windowrule = float,class:^(notification)$
windowrule = float,class:^(error)$
windowrule = float,class:^(confirmreset)$
windowrule = float,title:^(Open File)$
windowrule = float,title:^(branchdialog)$
windowrule = float,title:^(Confirm to replace files)
windowrule = float,title:^(File Operation Progress)
windowrule = float,title:^(Picture-in-Picture)$
windowrule = float,class:^(gpick)$
windowrule = float,class:^(com.github.hluk.copyq)
windowrule = float,class:^(org.keepassxc.KeePassXC)
windowrule = float,title:^(Save)$
windowrule = float,title:^(All Files)$
windowrule = float,title:^(Calculator)$

# Vesktop always opens fullscreen on workspace 6
windowrule = workspace 11 silent, class:^(vesktop)$

# Control panel windows have no animations
windowrule = noanim, workspace:11
windowrule = noanim, workspace:12
windowrule = noanim, workspace:13
windowrule = noanim, workspace:14
# Control panel workspaces have no borders
workspace = r[11-14], border:false, gapsin:0, gapsout:0

# Idleinhibit when fullscreen
windowrule = idleinhibit fullscreen, focus:1

# Fix Chromium context menus
windowrule = noblur,class:^()$,title:^()$

# Fix JetBrains IDEs
windowrule = noinitialfocus,class:^jetbrains-.*$,floating:1,title:^$|^\s$|^win\d+$

# No gaps when only (https://wiki.hypr.land/Configuring/Workspace-Rules/#smart-gaps)
workspace = w[tv1], gapsout:0, gapsin:0
workspace = f[1], gapsout:0, gapsin:0

