zero/home-environments/radio/files/.config/river/init

201 lines
8.0 KiB
Bash
Executable File

#!/bin/sh
# Set up keyboard layout
riverctl keyboard-layout\
-options grp:menu_switch,parens:swap_brackets,caps:swapescape \
us,br
# close the focused view
riverctl map normal Super q close
# spawn $TERMINAL
riverctl map normal Super Return spawn foot
# spawn $EDITOR
riverctl map normal Super e spawn "foot -e $EDITOR"
# audio
# status bar
riverctl spawn waybar
# browser
riverctl map normal Super B spawn $BROWSER
# notifications
riverctl spawn fnott
# go to last tag
riverctl map normal Super Escape focus-previous-tags
# application launcher
riverctl map normal Super Semicolon spawn fuzzel
# wallpaper
riverctl spawn "swaybg -i ~/media/pictures/wallpapers/wall.png"
# grab videos from clipboard
riverctl map normal Super V spawn "wl-paste | xargs vid"
riverctl map normal Super+Shift V spawn "wl-paste | xargs vd"
# screenshot
riverctl map normal Printscreen \
spawn "grim ~/media/pictures/screenshots/$(date +'%Y-%m-%d--%H-%M-%S.png')"
# lock screen
riverctl map normal Super+Shift S \
spawn "swaylock -k -i ~/media/pictures/wallpapers/lockscreen"
# toggle monocle layout
riverctl map normal Super M send-layout-cmd rivercarro "main-location monocle"
riverctl map normal Super T send-layout-cmd rivercarro "main-location left"
# Super+J and Super+K to focus the next/previous view in the layout stack
riverctl map normal Super Tab focus-view next
riverctl map normal Super+Shift Tab focus-view previous
# Super+Shift+J and Super+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 Super+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 Return zoom
# Super+H and Super+L to decrease/increase the main ratio of rivercarro(1)
riverctl map normal Super H send-layout-cmd rivercarro "main-ratio -0.05"
riverctl map normal Super L send-layout-cmd rivercarro "main-ratio +0.05"
# Super+Shift+H and Super+Shift+L to increment/decrement the main count of rivercarro(1)
riverctl map normal Super+Shift H send-layout-cmd rivercarro "main-count +1"
riverctl map normal Super+Shift L send-layout-cmd rivercarro "main-count -1"
# Super+Alt+{H,J,K,L} to move views
riverctl map -repeat normal Super+Shift H move left 10
riverctl map -repeat normal Super+Shift J move down 10
riverctl map -repeat normal Super+Shift K move up 10
riverctl map -repeat normal Super+Shift L move right 10
# 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+Shift+{H,J,K,L} to resize views
riverctl map -repeat normal Super+Alt H resize horizontal -10
riverctl map -repeat normal Super+Alt J resize vertical 10
riverctl map -repeat normal Super+Alt K resize vertical -10
riverctl map -repeat normal Super+Alt L resize horizontal 10
# 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
# Super + Middle Mouse Button to toggle float
riverctl map-pointer normal Super BTN_MIDDLE toggle-float
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+Control+[1-9] to toggle focus of tag [0-8]
riverctl map normal Super+Control $i toggle-focused-tags $tags
# Super+Shift+Control+[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
# 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
# Eject the optical drive (well if you still have one that is)
riverctl map $mode None XF86Eject spawn 'eject -T'
# # Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
# riverctl map $mode None XF86AudioRaiseVolume spawn 'pamixer --allow-boost -i 5'
# riverctl map $mode Shift XF86AudioRaiseVolume spawn 'pamixer --allow-boost -i 10'
# riverctl map $mode None XF86AudioLowerVolume spawn 'pamixer --allow-boost -d 5'
# riverctl map $mode Shift XF86AudioLowerVolume spawn 'pamixer --allow-boost -d 10'
# riverctl map $mode None XF86AudioMute spawn 'pamixer -t'
# riverctl map $mode None XF86AudioMicMute spawn 'pamixer -t --source 4'
# one day pipewire wil work...
riverctl map $mode None XF86AudioRaiseVolume spawn 'wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 5%+'
riverctl map $mode Shift XF86AudioRaiseVolume spawn 'wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 10%+'
riverctl map $mode None XF86AudioLowerVolume spawn 'wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 5%-'
riverctl map $mode Shift XF86AudioLowerVolume spawn 'wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 10%-'
riverctl map $mode None XF86AudioMute spawn 'wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle'
riverctl map $mode None XF86AudioMicMute spawn 'wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle'
# control mpv playlist listening on socket /tmp/mpv-socket
riverctl map $mode Super XF86AudioLowerVolume spawn "echo '{ \"command\": [\"keypress\", \"<\"] }' | socat - /tmp/mpv-socket"
riverctl map $mode Super XF86AudioRaiseVolume spawn "echo '{ \"command\": [\"keypress\", \">\"] }' | socat - /tmp/mpv-socket"
riverctl map $mode Super XF86AudioMute spawn "echo '{ \"command\": [\"keypress\", \"p\"] }' | socat - /tmp/mpv-socket"
riverctl map $mode Super A spawn "echo '{ \"command\": [\"keypress\", \"N\"] }' | socat - /tmp/mpv-socket"
# Control screen backlight brightness with light (https://github.com/haikarainen/light)
riverctl map $mode None XF86MonBrightnessUp spawn 'brightnessctl set +5%'
riverctl map $mode Shift XF86MonBrightnessUp spawn 'brightnessctl set +10%'
riverctl map $mode None XF86MonBrightnessDown spawn 'brightnessctl set 5%-'
riverctl map $mode Shift XF86MonBrightnessDown spawn 'brightnessctl set 10%-'
done
# Set background and border color
riverctl border-color-focused 0x8581e0
riverctl border-color-unfocused 0x313131
riverctl border-width 1
# Set keyboard repeat rate
riverctl set-repeat 50 300
# Make all views with an app-id that starts with "float" and title "foo" start floating.
riverctl rule-add -title 'Telegram Desktop' float
# Make all views with app-id "bar" and any title use client-side decorations
riverctl rule-add -app-id "bar" csd
# Set the default layout generator to be rivercarro and start it.
# River will send the process group of the init executable SIGTERM on exit.
riverctl default-layout rivercarro
rivercarro -inner-gaps 10 -outer-gaps 10 -no-smart-gaps &