# https://wiki.hyprland.org/Configuring/Binds/
#
# Format:
#   bind = MODS, key, dispatcher, params

#-- Keybindings ----------------------------------------------------
$mod = ALT  # use ALT instead of SUPER, to match the mod key with aerospace on darwin.
$files = thunar
$browser = firefox


# SYSTEM
# ============================================================================

# - Drag modifier
# BIND     MOD            KEY       DISPATCHER
bindm =    $mod,      mouse:272,   movewindow
bindm =    $mod,      mouse:273,   resizewindow

# - System
# BIND     MOD      KEY    DISPATCHER    VALUE
bind =     $mod,     q,    killactive    # kill window

# - Terminal
# BIND     MOD            KEY       DISPATCHER      VALUE
bind =     $mod,          Return,    exec,           foot
bind =     $mod SHIFT,    Return,    exec,           alacritty
bind =     $mod,          d,         exec,           anyrun

# - Hardware control
# BIND   MOD  KEY                     DISPATCHER   VALUE
# https://wiki.archlinux.org/title/WirePlumber
bindel = ,    XF86AudioRaiseVolume,   exec,        wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bindel = ,    XF86AudioLowerVolume,   exec,        wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindl  = ,    XF86AudioMute,          exec,        wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindl  = ,    XF86AudioMicMute,       exec,        wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bind  =  ,    XF86MonBrightnessUp,    exec,        brightnessctl set 5%+
bind  =  ,    XF86MonBrightnessDown,  exec,        brightnessctl set 5%-
bind  =  ,    XF86AudioPlay,          exec,        playerctl play-pause
bind  =  ,    XF86AudioNext,          exec,        playerctl next
bind  =  ,    XF86AudioPrev,          exec,        playerctl previous
bind  =  ,    XF86Search,             exec,        anyrun
bind  =  ,    XF86PowerOff,           exec,        shutdown -h now

# WORKSPACES
# ============================================================================

# - Switch to workspace
# BIND   MOD       KEY   DISPATCHER   VALUE
bind =   $mod,     1,    workspace,     1
bind =   $mod,     2,    workspace,     2
bind =   $mod,     3,    workspace,     3
bind =   $mod,     4,    workspace,     4
bind =   $mod,     5,    workspace,     5
bind =   $mod,     6,    workspace,     6
bind =   $mod,     7,    workspace,     7
bind =   $mod,     8,    workspace,     8
bind =   $mod,     9,    workspace,     9
bind =   $mod,     0,    workspace,     10

# - Move focussed window to workspace
# BIND   MOD            KEY         DISPATCHER        VALUE
bind =   $mod SHIFT,    1,          movetoworkspace,  1
bind =   $mod SHIFT,    2,          movetoworkspace,  2
bind =   $mod SHIFT,    3,          movetoworkspace,  3
bind =   $mod SHIFT,    4,          movetoworkspace,  4
bind =   $mod SHIFT,    5,          movetoworkspace,  5
bind =   $mod SHIFT,    6,          movetoworkspace,  6
bind =   $mod SHIFT,    7,          movetoworkspace,  7
bind =   $mod SHIFT,    8,          movetoworkspace,  8
bind =   $mod SHIFT,    9,          movetoworkspace,  9
bind =   $mod SHIFT,    0,          movetoworkspace,  10

bind =   $mod,          mouse_down, workspace,        e+1
bind =   $mod,          mouse_up,   workspace,        e-1


# Window
# ============================================================================

# Move Window
bind =   $mod SHIFT,    left,       movewindow,       l
bind =   $mod SHIFT,    right,      movewindow,       r
bind =   $mod SHIFT,    up,         movewindow,       u
bind =   $mod SHIFT,    down,       movewindow,       d

# Focus Window
bind =   $mod,          left,       movefocus,        l
bind =   $mod,          right,      movefocus,        r
bind =   $mod,          up,         movefocus,        u
bind =   $mod,          down,       movefocus,        d

# Resize Window
bind =   $mod CTRL,     left,       resizeactive,     -20 0
bind =   $mod CTRL,     right,      resizeactive,     20 0
bind =   $mod CTRL,     up,         resizeactive,     0 -20
bind =   $mod CTRL,     down,       resizeactive,     0 20

# MODES
# ============================================================================

# BIND    MOD            KEY       DISPATCHER       VALUE
bind =    $mod SHIFT,    d,        submap,          mode_displays
bind =    $mod SHIFT,    a,        submap,          mode_move
bind =    $mod      ,    r,        submap,          mode_resize
bind =    $mod SHIFT,    s,        submap,          mode_screenshot
bind =    $mod SHIFT,    e,        submap,          mode_shutdown

# LAYOUT
# ============================================================================

# ## Action // Toggle floating ##
bind = $mod, space, togglefloating

# ## Action // Toggle fullscreen ##
bind = $mod, f, fullscreen

# ## Action // Switch to window stacking ##
# bind = $mod, s, layout stacking

# ## Action // Switch to window tabbing ##
# bind = $mod, w, layout tabbed

# ## Action // Toggle window splitting ##
# bind = $mod, e, layout toggle split


# Misc
# ============================================================================

# -- Screenshots --
bind =   ,           Print,  exec,  hyprshot -m output -o ~/Pictures/Screenshots -- imv
bind =   $mod,       Print,  exec,  hyprshot -m window  -o ~/Pictures/Screenshots -- imv
bind =   CTRL,       Print,  exec,  hyprshot -m region -o ~/Pictures/Screenshots

# -- Others --
bind =   CTRL ALT,   l,      exec,  hyprlock
bind =   $mod SHIFT, x,      exec,  wlogout
bind =   $mod,       n,      exec,  nm-connection-editor  # need install network-manager-applet
