#!/bin/sh


# ---------------------
# KEYBOARD
# ---------------------

riverctl map-pointer normal Super BTN_LEFT move-view
riverctl map-pointer normal Super BTN_RIGHT resize-view
riverctl map-pointer normal Super BTN_MIDDLE toggle-float

# ---------------------
# KEYBOARD
# ---------------------

mod=Mod1

riverctl map normal $mod Return spawn 'sh -c "ghostty & sleep 0.2 && riverctl focus-view next"'
riverctl map normal $mod Space spawn 'fuzzel'
riverctl map normal $mod q close
riverctl map normal $mod m spawn 'riverctl exit'
riverctl map normal $mod+Shift l spawn 'waylock -init-color 0x000000 -input-color 0x111111 -fail-color 0x220000'

# Volume
riverctl map normal None XF86AudioRaiseVolume spawn 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+'
riverctl map normal None XF86AudioLowerVolume spawn 'wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-'
riverctl map normal None XF86AudioMute spawn 'wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle'

# Brightness
riverctl map normal None XF86MonBrightnessUp spawn 'light -A 5'
riverctl map normal None XF86MonBrightnessDown spawn 'light -U 5'

# Navigation
riverctl map normal $mod h focus-view left
riverctl map normal $mod j focus-view down
riverctl map normal $mod k focus-view up
riverctl map normal $mod l focus-view right

riverctl map normal $mod Tab focus-view previous
riverctl map normal $mod+Shift Tab focus-view next

# Tags Navigation
for i in $(seq 1 9); do
  tag=$((1 << ($i - 1)))
  riverctl map normal $mod $i set-focused-tags $tag
  riverctl map normal $mod+Shift $i spawn "riverctl set-view-tags $tag && riverctl set-focused-tags $tag"
done
