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

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

# See https://wiki.hyprland.org/Configuring/Monitors/
# FIXME: Update the monitor settings below to match your setup
monitor=eDP-1,preferred,auto,1.6   # Settings for the internal monitor
monitor=HDMI-A-1,preferred,auto-up,1.6  # Settings for the external monitor

# If you prefer to use the default settings, comment out the two lines above 
# and uncomment the line below
# monitor=,preferred,auto,1  # Default monitor settings

# Bind workspaces to the internal monitor
workspace=1,monitor:eDP-1
workspace=2,monitor:eDP-1
workspace=3,monitor:eDP-1
workspace=4,monitor:eDP-1
workspace=5,monitor:eDP-1
workspace=6,monitor:eDP-1
workspace=7,monitor:eDP-1
workspace=8,monitor:eDP-1
workspace=9,monitor:eDP-1
workspace=10,monitor:eDP-1

# Bind workspaces to the external monitor
workspace=11,monitor:HDMI-A-1
workspace=12,monitor:HDMI-A-1
workspace=13,monitor:HDMI-A-1
workspace=14,monitor:HDMI-A-1
workspace=15,monitor:HDMI-A-1
workspace=16,monitor:HDMI-A-1
workspace=17,monitor:HDMI-A-1
workspace=18,monitor:HDMI-A-1
workspace=19,monitor:HDMI-A-1
workspace=20,monitor:HDMI-A-1

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

# Execute your favorite apps at launch
exec-once = fish -c autostart


# Source a file (multi-file configs)
source = ~/.config/hypr/macchiato.conf

# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
    kb_layout = us,ua,ru
    kb_variant =
    kb_model =
    kb_options = grp:win_space_toggle
    kb_rules =

    follow_mouse = 1
    
    touchpad {
        natural_scroll = yes
        tap-and-drag = true
    }

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

# XWayland disable scaling
# xwayland {
#     force_zero_scaling = true
# }

# env = GDK_SCALE, 1.6
env = HYPRCURSOR_THEME,Catppuccin-Macchiato-Teal
env = HYPRCURSOR_SIZE,24
env = XCURSOR_THEME,Catppuccin-Macchiato-Teal
env = XCURSOR_SIZE,24

general {
    # See https://wiki.hyprland.org/Configuring/Variables/ for more

    gaps_in = 5
    gaps_out = 10
    border_size = 2
    col.active_border = $teal
    col.inactive_border = $surface1

    layout = dwindle
}

decoration {
    # See https://wiki.hyprland.org/Configuring/Variables/ for more

    rounding = 10

    blur {
        size = 8
        passes = 2
    }

    shadow {
        enabled = true
        range = 15
        render_power = 3
        offset = 0, 0
        color = $teal
        color_inactive = 0xff$baseAlpha
    }
    
    active_opacity = 0.7
    inactive_opacity = 0.7
    fullscreen_opacity = 0.7
}

# layerrule = blur, waybar
layerrule = blur, logout_dialog

animations {
    enabled = yes

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

    bezier = myBezier, 0.05, 0.9, 0.1, 1.05

    animation = windows, 1, 2, myBezier
    animation = windowsOut, 1, 2, default, popin 80%
    animation = border, 1, 3, default
    animation = fade, 1, 2, default
    animation = workspaces, 1, 1, default
}

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

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

gestures {
    # See https://wiki.hyprland.org/Configuring/Variables/ for more
    workspace_swipe = on
}

misc {
    disable_hyprland_logo = true
    disable_splash_rendering = true
    background_color = 0x24273a
}

binds {
    workspace_back_and_forth = true
}

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

# Example windowrule v1
# windowrule = float, ^(kitty)$
windowrule = float, title:.*mpv$
windowrule = opaque, title:.*mpv$
windowrule = size 50% 50%, title:.*mpv$
windowrule = float, content:video
windowrule = opaque, content:video
windowrule = size 50% 50%, content:video

windowrule = float, title:.*imv.*
windowrule = opaque, title:.*imv.*
windowrule = size 70% 70%, title:.*imv.*
windowrule = float, content:photo
windowrule = opaque, content:photo
windowrule = size 70% 70%, content:photo

windowrule = float, title:.*\.pdf$
windowrule = opaque, title:.*\.pdf$
windowrule = maximize, title:.*\.pdf$

windowrule = opaque, title:.*YouTube - Brave$

windowrule = opaque, title:swappy
windowrule = center 1, title:swappy
windowrule = stayfocused, title:swappy

windowrule = opaque, title:^TelegramDesktop$

# See https://wiki.hyprland.org/Configuring/Keywords/ for more
$mainMod = SUPER

# will switch to a submap called resize
bind=$mainMod ALT,R,submap,resize

# will start a submap called "resize"
submap=resize

# sets repeatable binds for resizing the active window
binde=,right,resizeactive,10 0
binde=,left,resizeactive,-10 0
binde=,up,resizeactive,0 -10
binde=,down,resizeactive,0 10

binde=,l,resizeactive,10 0
binde=,h,resizeactive,-10 0
binde=,k,resizeactive,0 -10
binde=,j,resizeactive,0 10

# use reset to go back to the global submap
bind=,escape,submap,reset 

# will reset the submap, meaning end the current one and return to the global one
submap=reset

# will switch to a submap called move
bind=$mainMod ALT,M,submap,move

# will start a submap called "move"
submap=move

# sets repeatable binds for moving the active window
bind=,right,movewindow,r
bind=,left,movewindow,l
bind=,up,movewindow,u
bind=,down,movewindow,d

bind=,l,movewindow,r
bind=,h,movewindow,l
bind=,k,movewindow,u
bind=,j,movewindow,d

# use reset to go back to the global submap
bind=,escape,submap,reset 

# will reset the submap, meaning end the current one and return to the global one
submap=reset

# keybinds further down will be global again...

# Scrachpads
bind = $mainMod CTRL, T, exec, pypr toggle term
$dropterm  = title:^wezterm_dropdown$
windowrule = float, $dropterm

bind = $mainMod CTRL, V, exec, pypr toggle volume
$volume_sidemenu = title:^Volume Control$
windowrule = float, $volume_sidemenu 

# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod CTRL, M, togglespecialworkspace, minimized
bind = $mainMod, M, exec, pypr toggle_special minimized
bind = $mainMod CTRL, E, exec, pypr expose
bind = $mainMod, Z, exec, pypr zoom

# bind = $mainMod, T, exec, wezterm start --always-new-process
bind = $mainMod, T, exec, nvidia-offload kitty
bind = $mainMod SHIFT, T, exec, telegram-desktop
bind = $mainMod, B, exec, qutebrowser
bind = $mainMod SHIFT, B, exec, brave
bind = $mainMod, F, exec, thunar
bind = $mainMod, S, exec, spotify
bind = $mainMod, Y, exec, youtube-music
bind = $mainMod, D, exec, rofi -show drun
bind = $mainMod SHIFT, D, exec, firejail --apparmor discord
bind = $mainMod, ESCAPE, exec, fish -c wlogout_uniqe
bind = $mainMod SHIFT, L, exec, hyprlock
bind = $mainMod SHIFT, S, exec, fish -c screenshot_to_clipboard
bind = $mainMod, E, exec, fish -c screenshot_edit
bind = $mainMod SHIFT, R, exec, fish -c record_screen_gif
bind = $mainMod, R, exec, fish -c record_screen_mp4
bind = $mainMod, V, exec, fish -c clipboard_to_type
bind = $mainMod SHIFT, V, exec, fish -c clipboard_to_wlcopy
bind = $mainMod, X, exec, fish -c clipboard_delete_item
bind = $mainMod SHIFT, X, exec, fish -c clipboard_clear
bind = $mainMod, U, exec, fish -c bookmark_to_type
bind = $mainMod SHIFT, U, exec, fish -c bookmark_add
bind = $mainMod CTRL, U, exec, fish -c bookmark_delete
bind = $mainMod, C, exec, hyprpicker -a
bind = $mainMod SHIFT, C, exec, pypr menu "Color picker"
bind = $mainMod SHIFT, Q, killactive
bind = $mainMod SHIFT, F, togglefloating, 
bind = $mainMod CTRL, F, fullscreen, 0
bind = $mainMod SHIFT, P, pseudo, # dwindle
bind = $mainMod SHIFT, O, togglesplit, # dwindle
bind = $mainMod ALT, M, exit,

bind = $mainMod SHIFT, A, exec, fish -c airplane_mode_toggle
bind = $mainMod SHIFT, N, exec, dunstctl set-paused toggle
bind = $mainMod SHIFT, Y, exec, fish -c bluetooth_toggle
bind = $mainMod SHIFT, W, exec, fish -c wifi_toggle

bind = $mainMod, p, exec, playerctl play-pause
bind = $mainMod, bracketright, exec, playerctl next
bind = $mainMod, bracketleft, exec, playerctl previous

bind = , XF86AudioRaiseVolume, exec, volumectl -u up
bind = , XF86AudioLowerVolume, exec, volumectl -u down
bind = , XF86AudioMute, exec, volumectl toggle-mute
bind = , XF86AudioMicMute, exec, volumectl -m toggle-mute

bind = , XF86MonBrightnessUp, exec, lightctl -D intel_backlight up
bind = , XF86MonBrightnessDown, exec, lightctl -D intel_backlight down

# 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
bind = $mainMod, h, movefocus, l
bind = $mainMod, l, movefocus, r
bind = $mainMod, k, movefocus, u
bind = $mainMod, j, movefocus, d
bind = $mainMod, Tab, cyclenext,
bind = $mainMod, Tab, bringactivetotop,

# Switch workspaces with mainMod + [0-9] for the internal monitor
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

# Switch workspaces with mainMod + ALT + [0-9] for the external monitor
bind = $mainMod ALT, 1, workspace, 11
bind = $mainMod ALT, 2, workspace, 12
bind = $mainMod ALT, 3, workspace, 13
bind = $mainMod ALT, 4, workspace, 14
bind = $mainMod ALT, 5, workspace, 15
bind = $mainMod ALT, 6, workspace, 16
bind = $mainMod ALT, 7, workspace, 17
bind = $mainMod ALT, 8, workspace, 18
bind = $mainMod ALT, 9, workspace, 19
bind = $mainMod ALT, 0, workspace, 20

# Move active window to a workspace with mainMod + SHIFT + [0-9] for the internal monitor
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 + ALT + SHIFT + [0-9] for the external monitor
bind = $mainMod ALT SHIFT, 1, movetoworkspace, 11
bind = $mainMod ALT SHIFT, 2, movetoworkspace, 12
bind = $mainMod ALT SHIFT, 3, movetoworkspace, 13
bind = $mainMod ALT SHIFT, 4, movetoworkspace, 14
bind = $mainMod ALT SHIFT, 5, movetoworkspace, 15
bind = $mainMod ALT SHIFT, 6, movetoworkspace, 16
bind = $mainMod ALT SHIFT, 7, movetoworkspace, 17
bind = $mainMod ALT SHIFT, 8, movetoworkspace, 18
bind = $mainMod ALT SHIFT, 9, movetoworkspace, 19
bind = $mainMod ALT SHIFT, 0, movetoworkspace, 20

# 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
