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

246 lines
8.7 KiB
Bash
Executable File

#!/bin/sh
# Decorations _________________________________________________________________
# wallpaper
setsid -f swww-daemon &
swww img ~/media/pictures/wallpapers/wall.png -t none
# Set background and border color
riverctl border-color-focused 0x8581e0
riverctl border-color-unfocused 0x313131
riverctl border-width 1
# Window layout _______________________________________________________________
# 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 &
# Window focus ________________________________________________________________
riverctl focus-follows-cursor normal
# Inputs ______________________________________________________________________
riverctl input keyboard-0-1-Power_Button events enabled
riverctl input keyboard-0-6-Video_Bus events enabled
riverctl input switch-0-5-Lid_Switch events enabled
riverctl input keyboard-0-3-Sleep_Button events enabled
riverctl input keyboard-1-1-AT_Translated_Set_2_keyboard events enabled
riverctl input pointer-2-7-SynPS/2_Synaptics_TouchPad events enabled
riverctl input pointer-2-10-TPPS/2_IBM_TrackPoint events enabled
riverctl input keyboard-6058-20564-ThinkPad_Extra_Buttons events enabled
riverctl input switch-6058-20564-ThinkPad_Extra_Buttons events enabled
# Keyboard ____________________________________________________________________
# layout
riverctl keyboard-layout\
-options grp:menu_switch,parens:swap_brackets,caps:swapescape \
us,br
# repeat rate
riverctl set-repeat 50 300
# Bindings ____________________________________________________________________
## layout related keybindings _________________________________________________
# 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+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 (re)move views from rivercarro(1) main
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+Return to bump the focused view to the top of the layout stack
#riverctl map normal Super Return zoom
## view related keybindings ___________________________________________________
# Super+Control+{J,K} to swap views
riverctl map -repeat normal Super+Shift J swap next
riverctl map -repeat normal Super+Shift K swap previous
# Super+Alt+{H,J,K,L} to move views
riverctl map -repeat normal Super+Control H move left 10
riverctl map -repeat normal Super+Control J move down 10
riverctl map -repeat normal Super+Control K move up 10
riverctl map -repeat normal Super+Control L move right 10
# 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
# Super+Space to toggle float
riverctl map normal Super Space toggle-float
# Super+F to toggle fullscreen
riverctl map normal Super F toggle-fullscreen
# close the focused view
riverctl map normal Super q close
## Application related keybindings ____________________________________________
# $TERMINAL
riverctl map normal Super Return spawn $TERMINAL
# $EDITOR
riverctl map normal Super e spawn "$TERMINAL -e $EDITOR"
# file manager
riverctl map normal Super d spawn "$TERMINAL -t st -e lf"
# $BROWSER
riverctl map normal Super b spawn $BROWSER
# application launcher
riverctl map normal Super Semicolon spawn fuzzel
# webcam (TODO: fix)
riverctl map normal XF86WebCam spawn cam
# rss reader (TODO: fix)
riverctl map normal XF86Launch1 spawn newsraft
# telegram
riverctl map normal Super a spawn telegram-desktop
# keepassxc
riverctl map normal Super c spawn keepassxc
# loot some ships
riverctl map normal Super z spawn anna
# guix repl
riverctl map normal Super g spawn "$TERMINAL -e guix repl"
## Tag related keybindings ____________________________________________________
# go to last tag
riverctl map normal Super Escape focus-previous-tags
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
## Clipboard related keybindings ______________________________________________
# 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"
riverctl map normal Super P \
spawn 'grim -g "$(slurp)" -t png - | wl-copy -t image/png'
# screenshot (TODO: fix)
# riverctl map normal PrintScreen \
# spawn "grim ~/media/pictures/screenshots/$(date +'%Y-%m-%d--%H-%M-%S.png')"
## Audio related keybindings __________________________________________________
for mode in normal locked
do
riverctl map -repeat $mode None XF86AudioRaiseVolume \
spawn 'wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 1%+'
riverctl map -repeat $mode None XF86AudioLowerVolume \
spawn 'wpctl set-volume -l 2.0 @DEFAULT_AUDIO_SINK@ 1%-'
riverctl map -repeat $mode None XF86AudioMute \
spawn 'wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle'
riverctl map -repeat $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
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
# lock screen
riverctl map normal Super+Shift S \
spawn "swaylock -k -i ~/media/pictures/wallpapers/lockscreen"
# 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
# Autostart applications ______________________________________________________
# status bar
riverctl spawn waybar
# password manager
riverctl spawn keepassxc
# notifications
riverctl spawn fnott
# wayneko
riverctl spawn "wayneko --background-colour 0x606060"
# Application rules ___________________________________________________________
# float windows
riverctl rule-add -app-id 'KeePassXC' float
riverctl rule-add -app-id 'Pavucontrol' float
riverctl rule-add -app-id 'TelegramDesktop' float