diff --git a/.config/river/bar.sh b/.config/river/bar.sh new file mode 100644 index 0000000..382f8ac --- /dev/null +++ b/.config/river/bar.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +FIFO="$XDG_RUNTIME_DIR/sandbar" +[ -e "$FIFO" ] && rm -f "$FIFO" +mkfifo "$FIFO" + +while cat "$FIFO"; do :; done | sandbar \ + -font "LiterationMono Nerd Font:size=24" \ + -active-bg-color "#9D3232" \ + -inactive-bg-color "#222222" \ + -title-bg-color "#222222" \ + -bottom diff --git a/.config/river/init b/.config/river/init new file mode 100755 index 0000000..1376d51 --- /dev/null +++ b/.config/river/init @@ -0,0 +1,226 @@ +#!/bin/bash + +# See the river(1), riverctl(1), and rivertile(1) man pages for complete +# documentation. + +# Fix screen share +export XDG_CURRENT_DESKTOP=river +export XDG_SESSION_TYPE=wayland + +## Start portals +dbus-update-activation-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP +xdg-desktop-portal-wlr & +xdg-desktop-portal & + +## Start easyeffects +flatpak run com.github.wwmm.easyeffects --gapplication-service & + +# Mod1+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot) +riverctl map normal Mod1+Shift Return spawn foot + +# Menu +#riverctl map normal Mod1 p spawn "bemenu-run --fn 'LiterationMono Nerd Font 12'" +#riverctl map normal Mod1 p spawn "wmenu_run -f 'LiterationMono Nerd Font 12'" +#riverctl map normal Mod1 p spawn "wmenu-run -il 16 -p 'Run:' -f 'LiterationMono Nerd Font 12'" +#riverctl map normal Mod1 p spawn "wmenu-run -il 16 -f 'LiterationMono Nerd Font 12' -n bbbbbbff -N 222222ff -s eeeeeeff -S 444444ff -m eeeeeeff -M 444444ff" +riverctl map normal Mod1 p spawn "wmenu-run -F -il 16 -f 'LiterationMono Nerd Font 12' -n bbbbbbff -N 222222ff -s eeeeeeff -S 444444ff -m eeeeeeff -M 444444ff" + +# Mod1+Q to close the focused view +riverctl map normal Mod1+Shift C close + +# Mod1+Shift+E to exit river +riverctl map normal Mod1+Shift E exit + +# Mod1+J and Super+K to focus the next/previous view in the layout stack +riverctl map normal Mod1 J focus-view next +riverctl map normal Mod1 K focus-view previous + +# Mod1+Shift+J and Super+Shift+K to swap the focused view with the next/previous +# view in the layout stack +riverctl map normal Mod1+Shift J swap next +riverctl map normal Mod1+Shift K swap previous + +# Mod1+Period and Super+Comma to focus the next/previous output +riverctl map normal Mod1 Period focus-output next +riverctl map normal Mod1 Comma focus-output previous + +# Mod1+Shift+{Period,Comma} to send the focused view to the next/previous output +riverctl map normal Mod1+Shift Period send-to-output next +riverctl map normal Mod1+Shift Comma send-to-output previous + +# Mod1+Tab to cycle between the last 2 tags +riverctl map normal Mod1 Tab focus-previous-tags + +# Mod1+Return to bump the focused view to the top of the layout stack +riverctl map normal Mod1 Return zoom + +# Increment/decrement the main count +riverctl map normal Mod1 i send-layout-cmd filtile "main-count +1" +riverctl map normal Mod1 d send-layout-cmd filtile "main-count -1" + +# Mod1+Super+{H,J,K,L} to move views +riverctl map normal Mod1+Super H move left 100 +riverctl map normal Mod1+Super J move down 100 +riverctl map normal Mod1+Super K move up 100 +riverctl map normal Mod1+Super L move right 100 + +# Mod1+Super+Control+{H,J,K,L} to snap views to screen edges +riverctl map normal Mod1+Super+Control H snap left +riverctl map normal Mod1+Super+Control J snap down +riverctl map normal Mod1+Super+Control K snap up +riverctl map normal Mod1+Super+Control L snap right + +# Mod1+Super+Shift+{H,J,K,L} to resize views +riverctl map normal Mod1+Super+Shift H resize horizontal -100 +riverctl map normal Mod1+Super+Shift J resize vertical 100 +riverctl map normal Mod1+Super+Shift K resize vertical -100 +riverctl map normal Mod1+Super+Shift L resize horizontal 100 + +# Mod1 + Left Mouse Button to move views +riverctl map-pointer normal Mod1 BTN_LEFT move-view + +# Mod1 + Right Mouse Button to resize views +riverctl map-pointer normal Mod1 BTN_RIGHT resize-view + +# Mod1 + Middle Mouse Button to toggle float +riverctl map-pointer normal Mod1 BTN_MIDDLE toggle-float + +for i in $(seq 1 9) +do + tags=$((1 << ($i - 1))) + riverctl map normal Mod1 $i set-focused-tags $tags + riverctl map normal Mod1+Shift $i set-view-tags $tags + riverctl map normal Mod1+Control $i toggle-focused-tags $tags + riverctl map normal Mod1+Shift+Control $i toggle-view-tags $tags +done + +# Mod1+0 to focus all tags +# Mod1+Shift+0 to tag focused view with all tags +all_tags=$(((1 << 32) - 1)) +riverctl map normal Mod1 0 set-focused-tags $all_tags +riverctl map normal Mod1+Shift 0 set-view-tags $all_tags + +# Mod1+Space to toggle float +riverctl map normal Mod1+Shift Space toggle-float + +# Mod1+F to toggle fullscreen +riverctl map normal Mod1 F toggle-fullscreen + +# Mod1+{Up,Right,Down,Left} to change layout orientation +riverctl map normal Mod1 Up send-layout-cmd rivertile "main-location top" +riverctl map normal Mod1 Right send-layout-cmd rivertile "main-location right" +riverctl map normal Mod1 Down send-layout-cmd rivertile "main-location bottom" +riverctl map normal Mod1 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 + +# Mod1+F11 to enter passthrough mode +riverctl map normal Mod1 F11 enter-mode passthrough + +# Mod1+F11 to return to normal mode +riverctl map passthrough Mod1 F11 enter-mode normal + +# Lock screen +riverctl map normal Mod1+Shift L spawn waylock + +# 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' +done + +# Grim +riverctl map normal None Print spawn 'file="/home/$USER/Pictures/Screenshots/$(date +%F_%T).png"; grim -g "$(slurp -d)" "$file" && wl-copy --type text/uri-list "file://$file"' +riverctl map normal Mod1 Print spawn 'grim - | tee /home/$USER/Pictures/Screenshots/$(date +"%F_%T").png | wl-copy' +riverctl map normal Mod1+Shift Print spawn "grim -g \"\$(slurp -p)\" -t ppm - | convert - -format '%[pixel:p{0,0}]' txt:- | grep -o '#[0-9A-F]\{6\}' | tr -d '\n' | wl-copy" + +# Passmenu +#riverctl map normal Mod1 o spawn 'passmenu -l 10' + +# Focus follows mouse +riverctl focus-follows-cursor normal + +# Borders & Colors +riverctl background-color 0x002b36 +riverctl border-color-focused 0x93a1a1 +riverctl border-color-unfocused 0x586e75 +riverctl border-width 1 + +# Set keyboard repeat rate +riverctl set-repeat 30 200 + +# Keyboard layouts +riverctl keyboard-layout -options "grp:win_space_toggle" "us,cz(qwerty)" +#riverctl keyboard-layout CShack + +# Make all views with an app-id that starts with "float" and title "foo" start floating. +riverctl rule-add -app-id 'float*' -title 'foo' float + +# Make all views with app-id "bar" and any title use client-side decorations +riverctl rule-add -app-id "bar" csd + +# File manager +riverctl rule-add -title 'yazi' float +riverctl map normal Mod1 r spawn 'foot -T yazi -W 150x50 -e yazi' + +# Audio (wireplumber runs automatically) +riverctl spawn pipewire +riverctl spawn pipewire-pulse +riverctl spawn wireplumber + +# Services +riverctl spawn dunst +#riverctl spawn blueman-applet +riverctl spawn "udiskie -ANt" + +# Color temp + riverctl spawn "wlsunset -l 50.08 -L 14.42 -t 5000 -T 6500" + +# Wallpaper +riverctl spawn "swaybg -c 1D1F21" +#[[ -e ~/.config/wallpaper.png ]] && + #riverctl spawn "swaybg -m fill -i ~/.config/wallpaper.png" + +# Clock +riverctl spawn "wlclock --layer background --background-colour '#00000000' --clock-colour '#ffffff' --border-size 0 --hand-width 2 --size 300" + +# Statusbar +#riverctl spawn "$HOME/.config/river/status" +#riverctl spawn "$HOME/.config/river/bar" +riverctl spawn waybar + +# Idle configuration +riverctl spawn "swayidle -w timeout 1200 'wlopm --off \"*\"' resume 'wlopm --on \"*\"' before-sleep 'waylock -fork-on-lock'" + +# Displays +# way-displays > /tmp/way-displays.${XDG_VTNR}.${USER}.log 2>&1 & +riverctl spawn kanshi + +# riverctl default-layout rivertile +# rivertile -view-padding 0 -outer-padding 0 & + +# Filtile +riverctl map normal Mod1 H send-layout-cmd filtile "main-ratio -5" +riverctl map normal Mod1 L send-layout-cmd filtile "main-ratio +5" +riverctl map normal Mod1 M send-layout-cmd filtile "monocle" + +riverctl default-layout filtile +filtile \ + pad off, \ + view-padding 5, \ + outer-padding 5, \ + smart-padding 0, \ + main-ratio 55, \ + main-location left diff --git a/.config/river/status.sh b/.config/river/status.sh new file mode 100644 index 0000000..297ac9e --- /dev/null +++ b/.config/river/status.sh @@ -0,0 +1,53 @@ +# !/bin/env sh + +cpu() { + cpu="$(grep -o "^[^ ]*" /proc/loadavg)" +} + +memory() { + memory="$(free -h | sed -n "2s/\([^ ]* *\)\{2\}\([^ ]*\).*/\2/p")" +} + +disk() { + disk="$(df -h | awk 'NR==2{print $4}')" +} + +datetime() { + datetime="$(date "+%F %a %H:%M")" +} + +bat() { + read -r bat_status "$FIFO" + echo "all status 🔈$vol $datetime" >"$FIFO" +} + +printf "%s" "$$" > "$XDG_RUNTIME_DIR/status_pid" +FIFO="$XDG_RUNTIME_DIR/sandbar" +[ -e "$FIFO" ] || mkfifo "$FIFO" +sec=0 + +while true; do + sleep 1 & + wait && { + #[ $((sec % 15)) -eq 0 ] && memory + #[ $((sec % 15)) -eq 0 ] && cpu + #[ $((sec % 15)) -eq 0 ] && disk + #[ $((sec % 60)) -eq 0 ] && bat + [ $((sec % 5)) -eq 0 ] && vol + [ $((sec % 5)) -eq 0 ] && datetime + + [ $((sec % 5)) -eq 0 ] && display + + sec=$((sec + 1)) + } +done