repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

river/init

Raw
#!/bin/sh

# This is the example configuration file for river.
#
# If you wish to edit this, you will probably want to copy it to
# $XDG_CONFIG_HOME/river/init or $HOME/.config/river/init first.
#
# See the river(1), riverctl(1), and rivertile(1) man pages for complete
# documentation.

# Use the "logo" key as the primary modifier
super="Mod4"
alt="Mod1"
ctrl="Control"

# super+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot)
# riverctl map normal $super+Shift Return spawn foot
riverctl map normal $super Return spawn wezterm
riverctl map normal $super B spawn firefox

# super+Q to close the focused view
riverctl map normal $super Q close

# super+E to exit river
riverctl map normal $super+Shift E exit

# super+J and Mod+K to focus the next/previous view in the layout stack
riverctl map normal $super J focus-view next
riverctl map normal $super K focus-view previous
# super+Shift+J and Mod+Shift+K to swap the focused view with the next/previous
# view in the layout stack
riverctl map normal $super+Shift J swap next
riverctl map normal $super+Shift K swap previous

# super+Period and Mod+Comma to focus the next/previous output
riverctl map normal $super Period focus-output next
riverctl map normal $super Comma focus-output previous

# super+Shift+{Period,Comma} to send the focused view to the next/previous output
riverctl map normal $super+Shift Period send-to-output next
riverctl map normal $super+Shift Comma send-to-output previous

# super+Return to bump the focused view to the top of the layout stack
riverctl map normal $super+Shift Space zoom

# super+H and Mod+L to decrease/increase the main ratio of rivertile(1)
riverctl map normal $super H send-layout-cmd rivertile "main-ratio -0.05"
riverctl map normal $super L send-layout-cmd rivertile "main-ratio +0.05"

# super+Shift+H and Mod+Shift+L to increment/decrement the main count of rivertile(1)
riverctl map normal $super+Shift H send-layout-cmd rivertile "main-count +1"
riverctl map normal $super+Shift L send-layout-cmd rivertile "main-count -1"
# super+Alt+{H,J,K,L} to move views

riverctl map normal $super+$alt H move left 100
riverctl map normal $super+$alt J move down 100
riverctl map normal $super+$alt K move up 100
riverctl map normal $super+$alt L move right 100

# super+Alt+Control+{H,J,K,L} to snap views to screen edges
riverctl map normal $super+$alt+Control H snap left
riverctl map normal $super+$alt+Control J snap down
riverctl map normal $super+$alt+Control K snap up
riverctl map normal $super+$alt+Control L snap right

# super+Alt+Shif+{H,J,K,L} to resize views
riverctl map normal $super+$alt+Shift H resize horizontal -100
riverctl map normal $super+$alt+Shift J resize vertical 100
riverctl map normal $super+$alt+Shift K resize vertical -100
riverctl map normal $super+$alt+Shift L resize horizontal 100

# super + Left Mouse Button to move views
riverctl map-pointer normal $super BTN_LEFT move-view

# super + Right Mouse Button to resize views
riverctl map-pointer normal $super BTN_RIGHT resize-view

for i in $(seq 1 9)
do
    tags=$((1 << ($i - 1)))

    # super+[1-9] to focus tag [0-8]
    riverctl map normal $super $i set-focused-tags $tags

    # super+Shift+[1-9] to tag focused view with tag [0-8]
    riverctl map normal $super+Shift $i set-view-tags $tags

    # super+Ctrl+[1-9] to toggle focus of tag [0-8]
    riverctl map normal $super+Control $i toggle-focused-tags $tags

    # super+Shift+Ctrl+[1-9] to toggle tag [0-8] of focused view
    riverctl map normal $super+Shift+Control $i toggle-view-tags $tags
done

# super+0 to focus all tags
# super+Shift+0 to tag focused view with all tags
all_tags=$(((1 << 32) - 1))
riverctl map normal $super 0 set-focused-tags $all_tags
riverctl map normal $super+Shift 0 set-view-tags $all_tags

# super+Space to toggle float
riverctl map normal $super Space toggle-float

# super+F to toggle fullscreen
riverctl map normal $super F toggle-fullscreen

# super+{Up,Right,Down,Left} to change layout orientation
riverctl map normal $super Up    send-layout-cmd rivertile "main-location top"
riverctl map normal $super Right send-layout-cmd rivertile "main-location right"
riverctl map normal $super Down  send-layout-cmd rivertile "main-location bottom"
riverctl map normal $super Left  send-layout-cmd rivertile "main-location left"

# Declare a passthrough mode. This mode has only a single mapping to return to
# normal mode. This makes it useful for testing a nested wayland compositor
riverctl declare-mode passthrough

# super+F11 to enter passthrough mode
riverctl map normal $super F11 enter-mode passthrough

# super+F11 to return to normal mode
riverctl map passthrough $super F11 enter-mode normal

# Various media key mapping examples for both normal and locked mode which do
# not have a modifier
for mode in normal locked
do
    # Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
    riverctl map $mode None XF86AudioRaiseVolume  spawn 'pamixer -i 5'
    riverctl map $mode None XF86AudioLowerVolume  spawn 'pamixer -d 5'
    riverctl map $mode None XF86AudioMute         spawn 'pamixer --toggle-mute'

    # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
    riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause'
    riverctl map $mode None XF86AudioPlay  spawn 'playerctl play-pause'
    riverctl map $mode None XF86AudioPrev  spawn 'playerctl previous'
    riverctl map $mode None XF86AudioNext  spawn 'playerctl next'

    # Control screen backlight brighness with kira (https://github.com/bugabinga/kira)
    riverctl map $mode None XF86MonBrightnessUp   spawn 'kira +5'
    riverctl map $mode None XF86MonBrightnessDown spawn 'kira -5'
done

riverctl input 2:10:TPPS/2_IBM_TrackPoint natural-scroll enabled
riverctl input 2:10:TPPS/2_IBM_TrackPoint accel-profile flat
riverctl input 2:10:TPPS/2_IBM_TrackPoint disable-while-typing enabled
riverctl set-cursor-warp on-output-change

# Set background and border color
riverctl background-color 0x000000
riverctl border-color-focused 0x993311
riverctl border-color-unfocused 0x332211

# Set repeat rate
riverctl set-repeat 50 300

# Set app-ids of views which should float
riverctl float-filter-add "float"
riverctl float-filter-add "popup"

# Set app-ids of views which should use client side decorations
riverctl csd-filter-add "gedit"

# Set and exec into the default layout generator, rivertile.
# River will send the process group of the init executable SIGTERM on exit.
riverctl default-layout rivertile
exec rivertile