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

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

# Set programs that you use
$terminal = kitty
#$fileManager = kitty -e yazi
$editor = kitty nvim
$fileManager = thunar
#$menu = ulauncher-toggle
$menu = vicinae toggle 

####################
###   GESTURES   ###
####################

#gesture = 2, pinchout, move
gesture = 3, horizontal, workspace
gesture = 3, up, dispatcher, movetoworkspacesilent, special:magic
gesture = 3, down, special, magic
gesture = 3, pinchin, dispatcher, exec, $menu
gesture = 3, pinchout, float, 

gesture = 4, pinchout, close
gesture = 4, pinchin, dispatcher, exec, $terminal

gesture = 4, down, dispatcher, movetoworkspace, special:magic
gesture = 4, up, dispatcher, movetoworkspace, r+0

gesture = 4, left, dispatcher, movetoworkspace, r+1
gesture = 4, right, dispatcher, movetoworkspace, r-1

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

bindl=,switch:on:Lid Switch, exec, systemctl suspend &
bindl=,switch:off:Lid Switch, exec, hyprctl dispatch exec hyprlock 

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

$navleft = left
$navright = right
$navup = up
$navdown = down

$vimleft = h
$vimright = l
$vimup = k
$vimdown = j

bind = $mainMod CTRL, P, exec, ~/.config/scripts/screenrec.sh
#bind = $mainMod, E, hyprexpo:expo, toggle

# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, T, exec, $terminal
bind = $mainMod SHIFT, T, exec, cool-retro-term -p ~/Dotfiles/desktopenvs/hyprland/CRT
bind = $mainMod, Z, exec, ~/.config/scripts/togglebar.sh
bind = $mainMod, Q, killactive,
bind = $mainMod, M, exec, $editor
bind = $mainMod, E, exec, $fileManager
bind = $mainMod ALT, E, exec, pcmanfm-qt
bind = $mainMod, X, exec, wofi --show=run
bind = $mainMod, F, exec, ~/.config/scripts/wofi-file-search.sh
bind = $mainMod SHIFT, F, exec, ~/.config/scripts/foldersearch.sh
bind = $mainMod ALT, F, exec, wofi-calc
bind = $mainMod, V, togglefloating,
bind = $mainMod SHIFT, V, tagwindow, +centered
#bind = $mainMod, H, movecurrentworkspacetomonitor
bind = $mainMod, C, pseudo, # dwindle
#bind = $mainMod, B, togglesplit, dwindle
bind = $mainMod SHIFT, O, exec, hyprctl dispatch exit
bind = $mainMod CTRl, O, exec, systemctl poweroff
bind = $mainMod, O, exec, hyprlock
#power-dmenu
bind = $mainMod ALT, O, exec, ~/.config/scripts/pwr-dmenu.sh
#bind = $mainMod, A, exec, killall waybar ; waybar
bind = $mainMod CTRL, B, exec, eww reload
bind = $mainMod, N, exec, nextcloud
bind = $mainMod SHIFT, I, exec, [tag +mixer] nm-connection-editor
bind = $mainMod, I, exec, iwmenu --launcher walker
bind = $mainMod ALT, I, exec, bzmenu --launcher walker

bind = $mainMod CTRL, M, exec, ~/.config/scripts/toggle-layout.sh

bind = $mainMod, S, exec, [tag +mixer] pavucontrol
bind = $mainMod, F1, exec, [tag +centered] kitty ~/.config/scripts/helpmenu.sh
bind = $mainMod CTRL, T, exec, [tag +centered-S] kitty bash ~/.config/scripts/timer-pick
bind = $mainMod, U, exec, [tag +centered-L] kitty btop
bind = $mainMod SHIFT, F1, exec, [tag +centered-L] kitty nvim ~/.config/binds.conf
bind = $mainMod CTRL, E, exec, ~/.config/scripts/screenrotationwcw.sh
bind = $mainMod CTRL, D, exec, ~/.config/scripts/screenrotationacw.sh

# Move focus with mainMod + vim keys
bind = $mainMod, $vimleft, movefocus, l
bind = $mainMod, $vimright, movefocus, r
bind = $mainMod, $vimup, movefocus, u
bind = $mainMod, $vimdown, movefocus, d

#Move focus with mainMod + arrow keys
bind = $mainMod, $navleft, movefocus, l
bind = $mainMod, $navright, movefocus, r
bind = $mainMod, $navup, movefocus, u
bind = $mainMod, $navdown, 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

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


bind = $mainMod CTRL, $navup, togglespecialworkspace, magic
bind = $mainMod CTRL SHIFT, $navup, movetoworkspace, special:magic

bind = $mainMod CTRL SHIFT, $navdown, movetoworkspace, empty
bind = $mainMod CTRL, $navdown, movetoworkspacesilent, special:magic



bind = $mainMod CTRL, $vimup, togglespecialworkspace, magic
bind = $mainMod CTRL, $vimdown, movetoworkspacesilent, special:magic

bind = $mainMod CTRL SHIFT, $vimdown, movetoworkspace, r+0
bind = $mainMod CTRL SHIFT, $vimup, movetoworkspace, special:magic



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

binde = $mainMod, XF86AudioLowerVolume, workspace, r-1
binde = $mainMod, XF86AudioRaiseVolume, workspace, r+1

bind = $mainMod SHIFT, XF86AudioLowerVolume, movetoworkspace, r-1
bind = $mainMod SHIFT, XF86AudioRaiseVolume, movetoworkspace, r+1

binde = $mainMod, XF86AudioMute, togglespecialworkspace, magic
binde = $mainMod SHIFT, XF86AudioMute, movetoworkspace, special:magic

bind = $mainMod, TAB, cyclenext
bind = $mainMod SHIFT, TAB, exec, $winswitch

bind = $mainMod ALT CTRL SHIFT, END, exit

bind = $mainMod CTRL, $navleft, workspace, r-1
bind = $mainMod CTRL, $navright, workspace, r+1

bind = $mainMod CTRL SHIFT, $navleft, movetoworkspace, r-1
bind = $mainMod CTRL SHIFT, $navright, movetoworkspace, r+1


bind = $mainMod CTRL, $vimleft, workspace, r-1
bind = $mainMod CTRL, $vimright, workspace, r+1

bind = $mainMod CTRL SHIFT, $vimleft, movetoworkspace, r-1
bind = $mainMod CTRL SHIFT, $vimright, movetoworkspace, r+1




# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
bindm = $mainMod SHIFT, mouse:272, resizewindow

# Move/rezie windows with Keyboard

#rofi keybind
bind = $mainMod SHIFT, R, exec, wofi --show drun
bind = $mainMod, R, exec, $menu
bind = $mainMod, RETURN, exec, $menu
bind = $mainMod SHIFT, RETURN, exec, $winswitch
bind = CTRL SHIFT, R, exec, $menu

#window location edit mode source: https://www.reddit.com/r/hyprland/comments/14jehzj/comment/jpl5c8f/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button

#bind = $mainMod, A, submap, fastedit
#submap = fastedit
binde = $mainMod ALT, $navright, resizeactive, 10 0
binde = $mainMod ALT, $navleft, resizeactive, -10 0
binde = $mainMod ALT, $navup, resizeactive, 0 -10
binde = $mainMod ALT, $navdown, resizeactive, 0 10

bind = $mainMod SHIFT, $navleft, movewindow, l
bind = $mainMod SHIFT, $navright, movewindow, r
bind = $mainMod SHIFT, $navup, movewindow, u
bind = $mainMod SHIFT, $navdown, movewindow, d

#vime key window nav
binde = $mainMod ALT, $vimright, resizeactive, 10 0
binde = $mainMod ALT, $vimleft, resizeactive, -10 0
binde = $mainMod ALT, $vimup, resizeactive, 0 -10
binde = $mainMod ALT, $vimdown, resizeactive, 0 10

bind = $mainMod SHIFT, $vimleft, movewindow, l
bind = $mainMod SHIFT, $vimright, movewindow, r
bind = $mainMod SHIFT, $vimup, movewindow, u
bind = $mainMod SHIFT, $vimdown, movewindow, d



#nwg-dock-hyprland

#nwg-dock-hyprland -mb 15 -r -p 

bind = $mainMod SHIFT, W, exec, killall nwg-dock-hyprland && nwg-dock-hyprland -c ~/.config/scripts/drawer.sh -ml 15 -r -s style.css -p left
bind = $mainMod SHIFT, E, exec, killall nwg-dock-hyprland && nwg-dock-hyprland -c ~/.config/scripts/drawer.sh -mr 15 -r -s style.css -p right
bind = $mainMod SHIFT, S, exec, killall nwg-dock-hyprland && nwg-dock-hyprland -c ~/.config/scripts/drawer.sh -mt 80 -r -s style.css -p top
bind = $mainMod SHIFT, D, exec, killall nwg-dock-hyprland && nwg-dock-hyprland -c ~/.config/scripts/drawer.sh -mb 15 -r -s style.css -p bottom

bindr = $mainMod, D, exec, nwg-dock-hyprland
bind = $mainMod SHIFT, A, exec, ~/.config/scripts/drawer.sh
bind = $mainMod, W, exec, [tag +centered-L] kitty -e ~/.config/scripts/wallpaper-picker ~/Pictures
#GROUPS

bind = $mainMod ALT, C, togglegroup, 
bind = $mainMod CTRL SHIFT, C, lockactivegroup, toggle

bind = $mainMod SHIFT ALT, $navleft, movewindoworgroup, l
bind = $mainMod SHIFT ALT, $navright, movewindoworgroup, r
bind = $mainMod SHIFT ALT, $navup, movewindoworgroup, u
bind = $mainMod SHIFT ALT, $navdown, movewindoworgroup, d

bind = $mainMod SHIFT ALT, $vimleft, movewindoworgroup, l
bind = $mainMod SHIFT ALT, $vimright, movewindoworgroup, r
bind = $mainMod SHIFT ALT, $vimup, movewindoworgroup, u
bind = $mainMod SHIFT ALT, $vimdown, movewindoworgroup, d

bind = $mainMod, A, changegroupactive, f
bind = $mainMod, Y, changegroupactive, b

#bind = , escape, submap, reset
#submap = reset

bind = $mainMod SHIFT, Q, exec, hyprctl kill

#screenshot capture
bind = , Print, exec, ~/.config/scripts/screenshot.sh
bind = $mainMod, P, exec, ~/.config/scripts/screenshot.sh
bind = $mainMod SHIFT, P, exec, hyprpicker | wl-copy

#audio controls
binde =, XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%+

binde =, XF86AudioLowerVolume, exec, wpctl set-volume -l 1.4 @DEFAULT_AUDIO_SINK@ 5%-

bind =, XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle 

bind =, XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle 

bindle=, XF86MonBrightnessUp, exec, bri --up
bindle=, XF86MonBrightnessDown, exec, bri --down

bindl=, XF86AudioPlay, exec, playerctl play-pause -p spotify, vlc

bind= $mainMod CTRL, I, exec, chamel toggle
bind= $mainMod CTRL, U, exec, chamel clear
bind= $mainMod CTRL, Z, exec, chamel clear-and-deactivate
#bind= $mainMod SHIFT, I, exec, env GTK_THEME=cyberqueer nm-connection-editor
bind= $mainMod CTRL, C, exec, dunstctl close-all
bind= $mainMod CTRL, G, exec, ~/.config/scripts/onscreenkb.sh
bind= $mainMod SHIFT, C, exec, ~/.config/scripts/caffeine.sh
bind= $mainMod SHIFT, X, exec, ~/.config/scripts/hyprland-toggle-touchpad.sh

bind= $mainMod CTRL, W ,exec, hyprctl hyprsunset gamma +10
bind= $mainMod CTRL, S ,exec, hyprctl hyprsunset gamma -10
bind= $mainMod CTRL, R, exec, [tag +centered-L] kitty -e ~/.config/scripts/amssh
bind= $mainMod CTRL, A ,exec, hyprctl hyprsunset temperature +450
bind= $mainMod CTRL, Q ,exec, hyprctl hyprsunset temperature -450
bind= $mainMod CTRL, X ,exec, hyprctl hyprsunset identity
