dotfiles/river/init
2025-05-29 20:29:02 -05:00

233 lines
9.9 KiB
Bash

#!/bin/sh
# Apps shortcuts
riverctl map normal Super B spawn firefox
riverctl map normal Super E spawn pcmanfm-qt
riverctl map normal Super C spawn code-oss
riverctl map normal Super Return spawn footclient
riverctl map normal Super Space spawn "pkill fuzzel || XDG_DATA_DIRS=/usr/share:/var/lib/flatpak/exports/share fuzzel"
riverctl map normal Super Backspace spawn "pkill wlogout || wlogout"
riverctl map normal None Print spawn 'grim -g "$(slurp)" - | wl-copy && notify-send "Screenshot Copied"'
riverctl map normal Control Print spawn 'grim -g "$(slurp)" && notify-send "Screenshot Saved"'
riverctl map normal Super V spawn "pkill fuzzel || cliphist list | fuzzel --dmenu --config=$XDG_CONFIG_HOME/fuzzel/cliphist.ini | cliphist decode | wl-copy"
# Super+Q to close the focused view
riverctl map normal Super Q close
# Super+Shift+E to exit river
riverctl map normal Super+Shift E exit
# 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+Shift+Return to bump the focused view to the top of the layout stack
riverctl map normal Super+Shift Return zoom
# 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+Shift+Space to toggle float
riverctl map normal Super+Shift Space toggle-float
# Super+F to toggle fullscreen
riverctl map normal Super F toggle-fullscreen
# Window management with arrow keys
riverctl map normal Super Left send-layout-cmd wideriver "--ratio -0.05"
riverctl map normal Super Down focus-view next
riverctl map normal Super Up focus-view previous
riverctl map normal Super Right send-layout-cmd wideriver "--ratio +0.05"
riverctl map normal Super+Shift Left send-layout-cmd wideriver "--count +1"
riverctl map normal Super+Shift Down swap next
riverctl map normal Super+Shift Up swap previous
riverctl map normal Super+Shift Right send-layout-cmd wideriver "--count -1"
riverctl map normal Super+Alt Left move left 100
riverctl map normal Super+Alt Down move down 100
riverctl map normal Super+Alt Up move up 100
riverctl map normal Super+Alt Right move right 100
riverctl map normal Super+Alt+Control Left snap left
riverctl map normal Super+Alt+Control Down snap down
riverctl map normal Super+Alt+Control Up snap up
riverctl map normal Super+Alt+Control Right snap right
riverctl map normal Super+Alt+Shift Left resize horizontal -100
riverctl map normal Super+Alt+Shift Down resize vertical 100
riverctl map normal Super+Alt+Shift Up resize vertical -100
riverctl map normal Super+Alt+Shift Right resize horizontal 100
riverctl map normal Super+Control Left send-layout-cmd wideriver "--layout left --stack dwindle"
riverctl map normal Super+Control Down send-layout-cmd wideriver "--layout bottom --stack dwindle"
riverctl map normal Super+Control Up send-layout-cmd wideriver "--layout top --stack dwindle"
riverctl map normal Super+Control Right send-layout-cmd wideriver "--layout right --stack dwindle"
# Window management with vim keys (repetition of above)
riverctl map normal Super H send-layout-cmd wideriver "--ratio -0.05"
riverctl map normal Super J focus-view next
riverctl map normal Super K focus-view previous
riverctl map normal Super L send-layout-cmd wideriver "--ratio +0.05"
riverctl map normal Super+Shift H send-layout-cmd wideriver "--count +1"
riverctl map normal Super+Shift J swap next
riverctl map normal Super+Shift K swap previous
riverctl map normal Super+Shift L send-layout-cmd wideriver "--count -1"
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
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
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
riverctl map normal Super+Control H send-layout-cmd wideriver "--layout left --stack dwindle"
riverctl map normal Super+Control J send-layout-cmd wideriver "--layout bottom --stack dwindle"
riverctl map normal Super+Control K send-layout-cmd wideriver "--layout top --stack dwindle"
riverctl map normal Super+Control L send-layout-cmd wideriver "--layout right --stack dwindle"
# Wideriver additional layouts
riverctl map normal Super+Control Space send-layout-cmd wideriver "--layout wide --stack even"
riverctl map normal Super+Control Return send-layout-cmd wideriver "--layout monocle"
# 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 -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 brightness with brightnessctl (https://github.com/Hummer12007/brightnessctl)
riverctl map $mode None XF86MonBrightnessUp spawn 'brightnessctl set +5%'
riverctl map $mode None XF86MonBrightnessDown spawn 'brightnessctl set 5%-'
done
# Set background and border color
riverctl background-color 0x24273a
riverctl border-color-focused 0xa6da95
riverctl border-color-unfocused 0xb7bdf8
riverctl border-color-urgent 0xed8796
riverctl border-width 3
# New views attach to the bottom of the stack
riverctl default-attach-mode below
# Hide cursor after 10 seconds of inactivity
riverctl hide-cursor timeout 10000
# Window focus follows cursor
riverctl focus-follows-cursor normal
# Set keyboard repeat rate
riverctl set-repeat 30 500
# Define floating views
riverctl rule-add -app-id "gsimplecal" float
riverctl rule-add -app-id "pavucontrol-qt" float
riverctl rule-add -app-id "wpaCute" float
riverctl rule-add -app-id "nwg-look" float
riverctl rule-add -app-id "qt5ct" float
riverctl rule-add -app-id "qt6ct" float
riverctl rule-add -app-id "wdisplays" float
riverctl rule-add -app-id "lxqt-archiver" float
riverctl rule-add -app-id "imv" float
# Set server-side decorations for all apps
riverctl rule-add ssd
# Set the default layout generator to be wideriver and start it.
# River will send the process group of the init executable SIGTERM on exit.
riverctl default-layout wideriver
wideriver \
--layout left \
--layout-alt monocle \
--stack dwindle \
--count-master 1 \
--ratio-master 0.5 \
--count-wide-left 2 \
--ratio-wide 0.5 \
--smart-gaps \
--inner-gaps 7 \
--outer-gaps 7 \
--border-width 3 \
--border-width-monocle 0 \
--border-width-smart-gaps 0 \
--border-color-focused "0xa6da95" \
--border-color-focused-monocle "0xb7bdf8" \
--border-color-unfocused "0xb7bdf8" \
--log-threshold warning \
> "/tmp/wideriver.${XDG_VTNR}.${USER}.log" 2>&1 &
# Configure inputs
riverctl input pointer-1267-12350-ELAN1200:00_04F3:303E_Touchpad natural-scroll enabled
riverctl input pointer-1267-12350-ELAN1200:00_04F3:303E_Touchpad tap enabled
riverctl keyboard-layout -options "grp:ctrls_toggle" "us(intl),us,latam"
riverctl xcursor-theme catppuccin-macchiato-green-cursors
# Autostart apps or processes
pipewire &
yambar &
mako &
foot -s &
wl-paste --type text --watch cliphist store &
wbg "$XDG_CONFIG_HOME/wallpapers/moments_before_desk.png" &
batsignal -b -w 15 -c 10 -d 5 -f 90 -p -e -D "loginctl suspend" -m 30 &
pcmanfm-qt -d &
swayidle -w \
timeout 500 "waylock -fork-on-lock -init-color 0x24273a -input-color 0x6e738d -fail-color 0xed8796 -ignore-empty-password" \
timeout 700 "loginctl suspend" \
before-sleep "waylock -fork-on-lock -init-color 0x24273a -input-color 0x6e738d -fail-color 0xed8796 -ignore-empty-password" &
# Fix screen sharing issue with void and xdg-desktop-portal-wlr
exec dbus-update-activation-environment DISPLAY I3SOCK SWAYSOCK WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=River