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

# https://wiki.hyprland.org/Configuring/Variables/#input
input {

    numlock_by_default = true

    follow_mouse = 1

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

    touchpad {
        natural_scroll = true
        disable_while_typing = false
    }
}

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

# 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

# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more

# Main desktop controls
bind = $mainMod, Q, killactive,
bind = $mainMod, R, exec, $menu  # Omnibar
bind = $mainMod, D, exec, $menu  # Legacy menu shortcut
bind = $mainMod, L, exec, hyprlock  # Lockscreen
bind = $mainMod, B, exec, ~/.config/hypr/scripts/toggle-waybar.sh  # Toggle sidebar
bind = $mainMod SHIFT, R, exec, ~/.config/hypr/scripts/reload.sh  # Reload desktop
bind = $mainMod, F11, exec, ~/.config/hypr/scripts/gamemode.sh  # Gamemode
bind = $mainMod SHIFT, M, exit,  # Exit desktop session

# Shortcuts
bind = $mainMod, RETURN, exec, $terminal
bind = $mainMod, SPACE, exec, $menu
bind = $mainMod, E, exec, $fileManager
bindel = , XF86Launch1, exec, kitty vim ~/.config/hypr/config

# 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

# Layout
bind = $mainMod, F, fullscreen,
bind = $mainMod, V, togglesplit, # Horizontal/vertical split
bind = $mainMod, T, togglefloating,
bind = $mainMod, H, pseudo, # Toggle pseudo-tiling

# 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, S, togglespecialworkspace, magic
bind = $mainMod SHIFT, S, movetoworkspace, special:magic

# Minimize function (uses scratchpad)
# For testing, may be removed in future releases
bind = $mainMod, N, togglespecialworkspace, magic
bind = $mainMod, N, movetoworkspace, +0
bind = $mainMod, N, togglespecialworkspace, magic
bind = $mainMod, N, movetoworkspace, special:magic
bind = $mainMod, N, togglespecialworkspace, 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


# Function keys

## Volume
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @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

## Brightness
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 5%+
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 5%-
bindel = SHIFT, XF86MonBrightnessUp, exec, brightnessctl s 1%+
bindel = SHIFT, XF86MonBrightnessDown, exec, brightnessctl s 1%-

## Player controls 
bindl = , XF86AudioNext, exec, playerctl next
bindl = , XF86AudioPause, exec, playerctl play-pause
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPrev, exec, playerctl previous

## Screenshot
bind = , Print, exec, ~/.config/hypr/scripts/screenshot.sh

## Touchpad toggle
###   On galaxy books, pressing the disable touchpad key also triggers SUPER and 
###   CONTROL keys, this is why there are present here
bind = SUPER CONTROL, XF86TouchpadToggle, exec, ~/.config/hypr/scripts/toggle-touchpad.sh

## Keyboard layout toggle
###   Only works between AZERTY and QWERTY because of differences in the numbers row
###   that prevent using the default way provided by hyprland
bind = $mainMod CONTROL, SPACE, exec, ~/.config/hypr/scripts/change-kb-layout.sh

## Testing
#bind = $mainMod, TAB, overview:toggle, toggle
