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.

# systemd user integration
# in order to export the environment variables, that river sets for other services, we need to tell
# systemd about those
systemd-notify --status="Initializing river"

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

riverctl map normal $super Return spawn wezterm
riverctl map normal $super B spawn firefox
riverctl map normal $super asciicircum spawn 'fuzzel --terminal "wezterm start"'

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

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

# 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
# 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

# focus the next/previous output
riverctl map normal $super Period focus-output next
riverctl map normal $super Comma focus-output previous

# 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

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

# 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

# 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

# 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

# move views
riverctl map-pointer normal $super BTN_LEFT move-view

# resize views
riverctl map-pointer normal $super BTN_RIGHT resize-view

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

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

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

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

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

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

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

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

# 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

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

# 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
    # TODO these do nothing for now. do i even want sound here?
    riverctl map $mode None XF86AudioRaiseVolume  spawn 'kira +10'
    riverctl map $mode None XF86AudioLowerVolume  spawn 'kira -10'
    # riverctl map $mode None XF86AudioMute         spawn 'pamixer --toggle-mute'
    # 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'

    riverctl map $mode None XF86Launch1 spawn 'darkman toogle'
done

riverctl input pointer-2-10-TPPS/2_IBM_TrackPoint natural-scroll enabled
riverctl input pointer-2-10-TPPS/2_IBM_TrackPoint accel-profile flat
riverctl input pointer-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 0x131313
riverctl border-color-focused 0x31ae99
riverctl border-color-unfocused 0x113131
riverctl border-color-urgent 0xaefeff
riverctl border-width 8

# Set repeat rate
riverctl set-repeat 50 300

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

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

# Export some environment variables into the systemd user scope and dbus for dependent services
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XCURSOR_SIZE XDG_CURRENT_DESKTOP 
# Notify systemd that river is now "booted up"
systemd-notify --ready
systemd-notify --status="Initialized river"