# #######################################################################################
# AUTOGENERATED HYPR CONFIG.
# PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT,
# OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS.
# #######################################################################################

#autogenerated = 1 # remove this line to remove the warning

# This is an example Hyprland config file.
# 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 =


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

# See https://wiki.hyprland.org/Configuring/Monitors/
monitor= HDMI-A-3, 1920x1080@74.97, 0x0, 1

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

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

# Set programs that you use
# user modified manually
$terminal = kitty --title kitty
$fileManager = nautilus
$menu = tofi-drun -c ~/.config/tofi/configA --drun-launch=true
# $browser = firefox
$browser = zen-browser
$notes = obsidian --disable-gpu-compositing
# $editor = code --disable-gpu-compositing
# $editor = zeditor
$editor = neovide
$editor-alt = kitty --title nvim -e nvim
$colorPicker = hyprpicker
$mail = thunderbird

# --enable-features=UseOzonePlatform --ozone-platform=wayland use this flag to launch CEF/Electron apps in wayland

# user created manually
$spotify = kitty --title jellyfin-tui -e jellyfin-tui
$mumble = mumble
$mumblemic = mumble rpc togglemute
$cava = kitty --title cava -e cava
$matrix = kitty --title unimatrix -e unimatrix -u 01 -s 96 -c white
$lavat = kitty --title lavat -e lavat -c A6ADC8 -R 4 -b 5 -r 1 -k CBA6F7 -g -s 3
$gamelauncher = flatpak run page.kramo.Cartridges
$telegram = Telegram
$element = element-desktop
$jellyfin = jellyfinmediaplayer
$htop = kitty --title htop -e htop
$nvtop = kitty --title nvtop -e nvtop
$btop = kitty --title btop -e btop
$lazydocker = kitty --title lazydocker -e lazydocker
$hyperion0 = kitty -e hyperion-remote --suspend
$hyperion1 = kitty -e hyperion-remote --resume
$headset = kitty -e pactl set-default-sink alsa_output.usb-C-Media_Electronics_Inc._USB_Audio_Device-00.iec958-stereo
$speaker = kitty -e pactl set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo

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

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

exec-once=/usr/lib/polkit-kde-authentication-agent-1 #Polkit to manage passwords
exec-once=/usr/bin/dunst
exec-once=waybar # topbar
exec-once = awww-daemon # wallpaper
exec-once = awww img ~/.config/assets/backgrounds/cat_leaves.png  --transition-fps 255 --transition-type outer --transition-duration 0.8
exec-once = mpvpaper HDMI-A-3 ~/Downloads/walls/175436-853585098.mp4 --loop --no-audio --fps=30
exec-once = wl-paste --type text --watch cliphist store # clipboard
exec-once = wl-paste --type image --watch cliphist store
# user modified manually
exec-once = rm "$HOME/.cache/cliphist/db"   #it'll delete history at every restart    
exec-once = hypridle

exec-once=dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = $terminal
#exec-once = nm-applet &
#exec-once = waybar & hyprpaper & firefox

# user created manually
# exec-once = $mail
exec-once = udiskie
# exec-once = $telegram
exec-once = $element
exec-once = $browser
exec-once = hyprpm reload
# exec-once = $cava

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

# See https://wiki.hyprland.org/Configuring/Environment-variables/

env = XCURSOR_SIZE,24
env = HYPRCURSOR_SIZE,24
# user created manually
env = HYPRCURSOR_THEME, Bibata-Modern-Ice
env = XCURSOR_THEME, Bibata-Modern-Ice

# Firefox
# env = MOZ_ENABLE_WAYLAND,1

# AMD
env = LIBVA_DRIVER_NAME,radeonsi
env = XDG_SESSION_TYPE,wayland
env = GBM_BACKEND,amdgpu
env = ELECTRON_OZONE_PLATFORM_HINT,auto

# QT
env = QT_QPA_PLATFORM,wayland
env = QT_QPA_PLATFORMTHEME,qt5ct
env = QT_WAYLAND_DISABLE_WINDOWDECORATION,1
env = QT_AUTO_SCREEN_SCALE_FACTOR,1
env = QT_STYLE_OVERRIDE,kvantum

# Toolkit Backend Variables
env = GDK_BACKEND,wayland,x11,*
env = SDL_VIDEODRIVER,wayland
env = CLUTTER_BACKEND,wayland

# XDG Specifications
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = XDG_SESSION_DESKTOP,Hyprland

# user created manually
env "YAZI_CONFIG_HOME=~/.config/yazi" yazi
env = AQ_DRM_DEVICES,/dev/dri/card2:/dev/dri/card1

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

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

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

    border_size = 2

    # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
# user modified manually
    col.active_border = rgb(cba6f7) rgb(1e1e1e) rgb(1e1e1e) rgb(cba6f7) 45deg
    col.inactive_border = rgb(cba6f7) rgb(cba6f7) rgb(cba6f7) rgb(cba6f7) 45deg

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

    # 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 = 10

    # Change transparency of focused and unfocused windows
    active_opacity = 1.0
# user modified manually
    inactive_opacity = 0.7

    # https://wiki.hyprland.org/Configuring/Variables/#blur
    blur {
        enabled = true
        size = 3
# user modified manually
        passes = 2
        new_optimizations = true
        vibrancy = 0.1696
        ignore_opacity = true
    }
}

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

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

    # 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

    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, loop
    animation = fade, 1, 10, default
    animation = workspaces, 1, 5, wind
}

# 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 {
    
}

# https://wiki.hyprland.org/Configuring/Variables/#misc
misc { 
    force_default_wallpaper = 0 # 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. :(
    disable_splash_rendering = true
# user modified manually
    vrr = 0
}

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

# https://wiki.hyprland.org/Configuring/Variables/#input
input {
    kb_layout = us,ir
    kb_variant =
    kb_model =
    kb_options = grp:win_space_toggle
    kb_rules =

    follow_mouse = 1
    force_no_accel = 1

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

    touchpad {
        natural_scroll = true
    }
}

# https://wiki.hyprland.org/Configuring/Variables/#gestures
gestures {
    # workspace_swipe = true
    # workspace_swipe_fingers = 3
}

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

####################
### KEYBINDINGSS ###
####################

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

# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, T, exec, $terminal
bind = $mainMod, B, exec, $browser
bind = $mainMod, O, exec, $notes
bind = $mainMod, C, exec, $editor
bind = $mainMod, S, exec, $editor-alt
bind = $mainMod, Q, killactive,
# user modified manually
# bind = $mainMod, M, exit,
bind = $mainMod, F, exec, $fileManager
bind = $mainMod, W, togglefloating,
bind = $mainMod, A, exec, $menu
# bind = $mainMod, P, pseudo, # dwindle
#bind = $mainMod, J, togglesplit, # dwindle

bind = SUPER, E, exec, jome -d | wl-copy #Emojipicker + clipboard copy

# 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

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

# user modified manually
# 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
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow

# Move/resize windows + Mouse
bindm = $mainMod, Z, movewindow
bindm = $mainMod, X, resizewindow

# Resize windows
binde = $mainMod+Shift, Right, resizeactive, 30 0
binde = $mainMod+Shift, Left, resizeactive, -30 0
binde = $mainMod+Shift, Up, resizeactive, 0 -30
binde = $mainMod+Shift, Down, resizeactive, 0 30


# Clipboard
bind = SUPER, V, exec, cliphist list | tofi -c ~/.config/tofi/configV | cliphist decode | wl-copy

# Colour Picker
bind = $mainMod, P, exec, $colorPicker | wl-copy 

# Screen locking
bind = SUPER, L, exec, hyprlock

# wlogout
bind = SUPER, ESCAPE, exec, wlogout

# waybar
bind = Ctrl, Escape, exec, killall waybar || waybar # toggle waybar

# Screenshot 
# add --cursor flag to include cursor also, --freeze flag to freeze before selection
bind = , Print, exec, grimblast --notify copysave screen # Entire screen + clipboard copy
bind = SUPER, Print, exec, grimblast --freeze --notify copysave active # current Active window only + clipboard copy
bind = SUPER ALT, Print, exec, grimblast --freeze --notify copysave area # Select area to take screenshot

# Volume and Media Control
bind = , XF86AudioRaiseVolume, exec, pamixer -i 5 
bind = , XF86AudioLowerVolume, exec, pamixer -d 5 
bind = , XF86AudioMicMute, exec, pamixer --default-source -m
bind = , XF86AudioMute, exec, pamixer -t
bind = , XF86AudioPlay, exec, playerctl play-pause
bind = , XF86AudioPause, exec, playerctl play-pause
bind = , XF86AudioNext, exec, playerctl next
bind = , XF86AudioPrev, exec, playerctl previous

# Screen brightness
bind = , XF86MonBrightnessUp, exec, brightnessctl s +5%
bind = , XF86MonBrightnessDown, exec, brightnessctl s 5%-

# user created manually
bind = $mainMod, K, exec, $mail
bind = $mainMod, F1, exec, $spotify
bind = $mainMod, F2, exec, $htop
bind = $mainMod, F3, exec, $nvtop
# bind = $mainMod, F4, exec, $telegram
bind = $mainMod, F4, exec, $element
bind = $mainMod, F5, exec, $jellyfin
bind = $mainMod, F6, exec, $btop
bind = $mainMod, F7, exec, $btop
bind = $mainMod, F8, exec, $btop
bind = $mainMod, F9, exec, $gamelauncher
bind = $mainMod, F10, exec, $lavat
bind = $mainMod, F11, exec, $matrix
bind = $mainMod, F12, exec, $cava
bind = $mainMod, M, exec, $mumblemic
bind = $mainMod, Delete, exec, $hyperion0
bind = $mainMod, Insert, exec, $hyperion1
bind = $mainMod, bracketright, exec, $headset
bind = $mainMod, bracketleft, exec, $speaker
bind = $mainMod, H, togglespecialworkspace, Magic
bind = $mainMod Shift, H, movetoworkspace, special:Magic
bind = $mainMod, Page_Up, togglespecialworkspace, Dream
bind = $mainMod Shift, Page_Up, movetoworkspace, special:Dream
#bind = $mainMod, mouse:276, togglespecialworkspace, Dream
#bind = $mainMod Shift, mouse:276, movetoworkspace, special:Dream
bind = $mainMod, Page_Down, togglespecialworkspace, Sky
bind = $mainMod Shift, Page_Down, movetoworkspace, special:Sky
#bind = $mainMod, mouse:275, togglespecialworkspace, Sky
#bind = $mainMod Shift, mouse:275, movetoworkspace, special:Sky
bind = $mainMod, mouse:275, exec, mumble rpc starttalking
bindr = $mainMod, mouse:275, exec, mumble rpc stoptalking
bind = $mainMod, Scroll_Lock, exec, systemctl hibernate

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

## Use hyprctl clients to look for window class

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

# Example windowrule
windowrule = match:class Thorium-browser, opacity 0.90 0.90
windowrule = match:class Code, opacity 0.80 0.80
windowrule = match:class Arduino IDE, opacity 0.80 0.80
windowrule = match:class dev.warp.Warp, opacity 0.80 0.80
windowrule = match:class obsidian, opacity 0.80 0.80
windowrule = match:class code-url-handler, opacity 0.80 0.80
windowrule = match:class code-insiders-url-handler, opacity 0.80 0.80
windowrule = match:class kitty, opacity 0.80 0.80
windowrule = match:class org.gnome.Nautilus, opacity 0.80 0.80
windowrule = match:class org.kde.ark, opacity 0.80 0.80
windowrule = match:class nwg-look, opacity 0.80 0.80
windowrule = match:class qt5ct, opacity 0.80 0.80
windowrule = match:class qt6ct, opacity 0.80 0.80
windowrule = match:class kvantummanager, opacity 0.80 0.80
windowrule = match:class pavucontrol, opacity 0.80 0.70
windowrule = match:class blueman-manager, opacity 0.80 0.70
windowrule = match:class nm-applet, opacity 0.80 0.70
#user modified manually
windowrule = match:class nm-connection-editor, opacity 0.80 0.70
windowrule = match:class org.kde.polkit-kde-authentication-agent-1, opacity 0.80 0.70
windowrule = match:class polkit-gnome-authentication-agent-1, opacity 0.80 0.70
windowrule = match:class org.freedesktop.impl.portal.desktop.gtk, opacity 0.80 0.70
windowrule = match:class org.freedesktop.impl.portal.desktop.hyprland, opacity 0.80 0.70

windowrule = match:class kvantummanager, float on
windowrule = match:class qt5ct, float on
windowrule = match:class qt6ct, float on
windowrule = match:class nwg-look, float on
windowrule = match:class org.kde.ark, float on
windowrule = match:class pavucontrol, float on
windowrule = match:class blueman-manager, float on
windowrule = match:class nm-applet, float on
windowrule = match:class nm-connection-editor, float on
windowrule = match:class org.kde.polkit-kde-authentication-agent-1, float on

# user created manually
windowrule = match:class kitty, match:title kitty, opacity 0.90 0.90
windowrule =  match:class kitty, match:title kitty, float on
windowrule =  match:class kitty, match:title kitty, center on
windowrule =  match:class kitty, match:title kitty, size 1280 720
# windowrule =  match:class kitty, match:title kitty, no_initial_focus on
# windowrule =  match:class kitty, match:title kitty, workspace 2
# windowrule =  match:class kitty, match:title kitty, pin on

windowrule =  match:class org.jackhuang.hmcl.Launcher, float on
windowrule =  match:class org.jackhuang.hmcl.Launcher, center on
windowrule =  match:class org.jackhuang.hmcl.Launcher, size 1280 720

windowrule =  match:class page.kramo.Cartridges, float on
windowrule =  match:class page.kramo.Cartridges, center on
windowrule =  match:class page.kramo.Cartridges, size 1280 720

windowrule =  match:class org.pulseaudio.pavucontrol, float on
windowrule =  match:class org.pulseaudio.pavucontrol, center on
windowrule =  match:class org.pulseaudio.pavucontrol, size 1280 720

windowrule =  match:class kitty, match:title unimatrix, float on
windowrule =  match:class kitty, match:title unimatrix, center on
windowrule =  match:class kitty, match:title unimatrix, size 1280 720
windowrule =  match:class kitty, match:title unimatrix, no_initial_focus on
windowrule =  match:class kitty, match:title unimatrix, pin on

windowrule =  match:class kitty, match:title cava, float on
windowrule =  match:class kitty, match:title cava, center on
windowrule =  match:class kitty, match:title cava, size 450 180
windowrule =  match:class kitty, match:title cava, no_initial_focus on
windowrule =  match:class kitty, match:title cava, pin on

windowrule =  match:class kitty, match:title btop, float on
windowrule =  match:class kitty, match:title btop, center on
windowrule =  match:class kitty, match:title btop, size 1280 720

windowrule =  match:class kitty, match:title nvim, float on
windowrule =  match:class kitty, match:title nvim, center on
windowrule =  match:class kitty, match:title nvim, size 1600 900

windowrule =  match:class obsidian, float on
windowrule =  match:class obsidian, center on
windowrule =  match:class obsidian, size 1280 720

# user created manually
workspace = 10, rounding:false, decorate:false, gapsin:0, gapsout:0, border:false

# user created manually
####################
# hyprland plugins #
####################
plugin:dynamic-cursors {
    enabled = true

    # tilt
    # rotate
    # stretch
    # none
    mode = stretch

    # minimum angle difference in degrees after which the shape is changed
    # smaller values are smoother, but more expensive for hw cursors
    threshold = 2

    rotate {
        length = 20
        offset = 0.0
    }

    tilt {
        limit = 5000

        # linear
        # quadratic
        # negative_quadratic
        function = negative_quadratic
        
        window = 100
    }

    # for mode = stretch
    stretch {
        limit = 3000

        # linear
        # quadratic
        # negative_quadratic
        function = quadratic

        window = 100
    }

    shake {
        enabled = false
        nearest = true
        threshold = 6.0
        base = 4.0
        speed = 4.0
        influence = 0.0
        
        # values below 1 disable the limit (e.g. 0)
        limit = 0.0

        timeout = 1000

        # show cursor behaviour `tilt`, `rotate`, etc. while shaking
        effects = false

        ipc = false
    }

    hyprcursor {

        # use nearest-neighbour (pixelated) scaling when magnifing beyond texture size
        # this will also have effect without hyprcursor support being enabled
        # 0 / false - never use pixelated scaling
        # 1 / true  - use pixelated when no highres image
        # 2         - always use pixleated scaling
        nearest = true
        enabled = true
        resolution = -1

        # shape to use when clientside cursors are being magnified
        # see the shape-name property of shape rules for possible names
        # specifying clientside will use the actual shape, but will be pixelated
        fallback = clientside
    }
}
plugin {
    hyprtrails {
        color = rgb(cba6f7)
    }
}
plugin {
    hyprbars {
        bar_height = 20
        bar_color = rgb(1e1e1e)
        #bar_blur = true
        col.text = rgb(a6adc8)
        bar_padding = 15
        bar_button_padding = 7
        icon_on_hover = true
        inactive_button_color = rgb(cba6f7)

        # hyprbars-button = color, size, on-click
        hyprbars-button = rgb(cba6f7), 15, 󰖭, hyprctl dispatch killactive
        hyprbars-button = rgb(cba6f7), 15, , hyprctl dispatch fullscreen 1

        # cmd to run on double click of the bar
        on_double_click = hyprctl dispatch fullscreen 1
    }
}
# plugin {
#     hyprscrolling {
#         column_width = 0.7
#     }
# }
