diff options
| -rwxr-xr-x | .config/river/colors | 6 | ||||
| -rw-r--r-- | .config/river/functions.sh | 21 | ||||
| -rwxr-xr-x | .config/river/gsettings | 15 | ||||
| -rwxr-xr-x | .config/river/init | 186 | ||||
| -rwxr-xr-x | .config/river/keybinds | 174 | ||||
| -rwxr-xr-x | .config/river/layouts | 1 | ||||
| -rwxr-xr-x | .config/river/mklayout.sh | 29 | ||||
| -rwxr-xr-x | .config/river/rules | 18 | ||||
| -rwxr-xr-x | .config/river/wl-kbptr-river-active-output | 4 |
9 files changed, 289 insertions, 165 deletions
diff --git a/.config/river/colors b/.config/river/colors new file mode 100755 index 0000000..57021bd --- /dev/null +++ b/.config/river/colors @@ -0,0 +1,6 @@ +#!/bin/sh +riverctl background-color 0x080808ff +riverctl border-color-focused 0x70649aff +riverctl border-color-unfocused 0x080808ff +riverctl border-color-urgent 0xcb1b45ff +riverctl border-width 2 diff --git a/.config/river/functions.sh b/.config/river/functions.sh new file mode 100644 index 0000000..69b534b --- /dev/null +++ b/.config/river/functions.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +declare_mode() { + riverctl declare-mode "$1" + riverctl map normal "$2" "$3" enter-mode "$1" + riverctl map "$1" None Return enter-mode normal + riverctl map "$1" None Escape enter-mode normal + riverctl map "$1" None Q enter-mode normal +} + +map_mode() { + if test "$1" = "-n"; then + shift 1 + local mode=$1 mod=$2 key=$3 + shift 3 + riverctl map "$mode" "$mod" "$key" $@ + else + riverctl map "$1" "$2" "$3" spawn "riverctl enter-mode normal ; $4" + fi + set +x +} diff --git a/.config/river/gsettings b/.config/river/gsettings new file mode 100755 index 0000000..c7f6871 --- /dev/null +++ b/.config/river/gsettings @@ -0,0 +1,15 @@ +#!/bin/sh + +riverctl xcursor-theme plan9 + +gsettings set org.gnome.desktop.interface gtk-theme Adwaita +gsettings set org.gnome.desktop.interface icon-theme Adwaita +gsettings set org.gnome.desktop.interface cursor-theme plan9 +gsettings set org.gnome.desktop.interface enable-animations false +gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark +gsettings set org.gnome.desktop.interface color-scheme prefer-dark +gsettings set org.gnome.desktop.privacy remember-recent-files false +gsettings set org.gnome.desktop.privacy recent-files-max-age 0 +gsettings set org.gtk.Settings.FileChooser show-hidden false +gsettings set org.gtk.gtk4.Settings.FileChooser show-hidden false +gsettings set org.gtk.gtk4.Settings.FileChooser startup-mode cwd diff --git a/.config/river/init b/.config/river/init index 320d3cf..fedb5f9 100755 --- a/.config/river/init +++ b/.config/river/init @@ -1,176 +1,32 @@ #!/bin/sh -# Note: the "Mod4" modifier is also known as Logo, GUI, Windows, Mod4, etc. -riverctl input "1739:0:Synaptics_TM3289-021" natural-scroll enabled -riverctl input "1739:0:Synaptics_TM3289-021" pointer-accel 0 -riverctl input "1739:0:Synaptics_TM3289-021" tap enabled -riverctl input "1739:0:Synaptics_TM3289-021" accel-profile adaptive +riverctl spawn /etc/s6-rc/bin/s6-session-spawn -# run application launcher -riverctl map normal Mod4 D spawn 'menu -run' +. "$XDG_CONFIG_HOME/river/functions.sh" +. "$XDG_CONFIG_HOME/river/colors" +. "$XDG_CONFIG_HOME/river/keybinds" +. "$XDG_CONFIG_HOME/river/rules" +. "$XDG_CONFIG_HOME/river/layouts" +. "$XDG_CONFIG_HOME/river/gsettings" -# start an instance of foot (https://codeberg.org/dnkl/foot) -riverctl map normal Mod4 Return spawn foot +#riverctl spawn 'dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP' +riverctl spawn 'light -i set 80%' +riverctl spawn 'kanshictl reload' -# Mod4+Q to close the focused view -riverctl map normal Mod4+Shift Q close - -# Mod4+Shift+E to exit river -riverctl map normal Mod4+Shift E exit - -# Mod4+J and Mod4+K to focus the next/previous view in the layout stack -riverctl map normal Mod4 J focus-view next -riverctl map normal Mod4 K focus-view previous - -# Mod4+Shift+J and Mod4+Shift+K to swap the focused view with the next/previous -# view in the layout stack -riverctl map normal Mod4+Shift J swap next -riverctl map normal Mod4+Shift K swap previous - -# Mod4+Period and Mod4+Comma to focus the next/previous output -riverctl map normal Mod4 Period focus-output next -riverctl map normal Mod4 Comma focus-output previous - -# Mod4+Shift+{Period,Comma} to send the focused view to the next/previous output -riverctl map normal Mod4+Shift Period send-to-output next -riverctl map normal Mod4+Shift Comma send-to-output previous - -# bump the focused view to the top of the layout stack -riverctl map normal Mod4+Shift Return zoom - -# Mod4+H and Mod4+L to decrease/increase the main ratio of rivertile(1) -riverctl map normal Mod4 H send-layout-cmd rivertile "main-ratio -0.05" -riverctl map normal Mod4 L send-layout-cmd rivertile "main-ratio +0.05" - -# Mod4+Shift+H and Mod4+Shift+L to increment/decrement the main count of rivertile(1) -riverctl map normal Mod4+Shift H send-layout-cmd rivertile "main-count +1" -riverctl map normal Mod4+Shift L send-layout-cmd rivertile "main-count -1" - -# Mod4+Alt+{H,J,K,L} to move views -# riverctl map normal Mod4+Alt H move left 100 -# riverctl map normal Mod4+Alt J move down 100 -# riverctl map normal Mod4+Alt K move up 100 -# riverctl map normal Mod4+Alt L move right 100 - -# snap views to screen edges -riverctl map normal Mod4+Control H snap left -riverctl map normal Mod4+Control J snap down -riverctl map normal Mod4+Control K snap up -riverctl map normal Mod4+Control L snap right - -# Mod4+Alt+Shif+{H,J,K,L} to resize views -# riverctl map normal Mod4+Alt+Shift H resize horizontal -100 -# riverctl map normal Mod4+Alt+Shift J resize vertical 100 -# riverctl map normal Mod4+Alt+Shift K resize vertical -100 -# riverctl map normal Mod4+Alt+Shift L resize horizontal 100 - -# Mod4 + Left Mouse Button to move views -riverctl map-pointer normal Mod4 BTN_LEFT move-view - -# Mod4 + Right Mouse Button to resize views -riverctl map-pointer normal Mod4 BTN_RIGHT resize-view - -riverctl focus-follows-cursor normal - -for i in $(seq 1 9); do - tags=$((1 << (i - 1))) - - # focus tag [0-8] - riverctl map normal Mod4 "$i" set-focused-tags "$tags" - # tag focused view with tag [0-8] - riverctl map normal Mod4+Shift "$i" set-view-tags "$tags" - # toggle focus of tag [0-8] - riverctl map normal Mod4+Control "$i" toggle-focused-tags "$tags" - # toggle tag [0-8] of focused view - riverctl map normal Mod4+Shift+Control "$i" toggle-view-tags "$tags" -done - -# Mod4+0 to focus all tags -# Mod4+Shift+0 to tag focused view with all tags -all_tags=$(((1 << 32) - 1)) -riverctl map normal Mod4 0 set-focused-tags $all_tags -riverctl map normal Mod4+Shift 0 set-view-tags $all_tags -riverctl map normal Mod4+Control+Shift 0 toggle-view-tags $all_tags - -# Mod4+Space to toggle float -riverctl map normal Mod4+Control Space toggle-float - -# Mod4+F to toggle fullscreen -riverctl map normal Mod4 F toggle-fullscreen -# Mod4+{Up,Right,Down,Left} to change layout orientation -riverctl map normal Mod4 Up send-layout-cmd rivertile "main-location top" -riverctl map normal Mod4 Right send-layout-cmd rivertile "main-location right" -riverctl map normal Mod4 Down send-layout-cmd rivertile "main-location bottom" -riverctl map normal Mod4 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 Mod4 F11 enter-mode passthrough -# return to normal mode -riverctl map passthrough Mod4 F11 enter-mode normal - -# bindsym Return mode "default" -# bindsym Escape mode "default" -# bindsym q mode "default" -riverctl declare-mode menu -riverctl map normal Mod4 M enter-mode menu -riverctl map menu None A spawn 'riverctl spawn soundswitch; riverctl enter mode normal' -riverctl map menu None M spawn 'riverctl spawn mnts; riverctl enter mode normal' -riverctl map menu None N spawn 'riverctl spawn notifmenu; riverctl enter mode normal' -riverctl map menu None P spawn 'riverctl spawn passmenu; riverctl enter mode normal' -riverctl map menu None R spawn 'riverctl spawn rcmenu; riverctl enter mode normal' -riverctl map menu None X spawn 'riverctl spawn "menu -drun"; riverctl enter mode normal' -riverctl map menu None Return enter-mode normal -riverctl map menu None Escape enter-mode normal -riverctl map menu None Q 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 - riverctl map $mode None XF86AudioRaiseVolume spawn 'soundswitch -V' - riverctl map $mode None XF86AudioLowerVolume spawn 'soundswitch -v' - riverctl map $mode None XF86AudioMute spawn 'soundswitch -m' - - # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl) - riverctl map $mode None XF86AudioMedia spawn 'playerctl -p playerctld play-pause' - riverctl map $mode None XF86AudioPlay spawn 'playerctl -p playerctld play-pause' - riverctl map $mode None XF86AudioPrev spawn 'playerctl -p playerctld previous' - riverctl map $mode None XF86AudioNext spawn 'playerctl -p playerctld next' - - # Control screen backlight brighness with light (https://github.com/haikarainen/light) - riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 5' - riverctl map $mode None XF86MonBrightnessDown spawn 'light -U 5' - - riverctl map $mode None XF86Display spawn 'kanshictl reload' - riverctl map $mode None XF86Keyboard spawn 'light -S 0' - riverctl map $mode None XF86Favorites spawn 'light -S 100' -done - -# Set background and border color -riverctl background-color 0x002b36 -riverctl border-color-focused 0x70649a -riverctl border-color-unfocused 0x1c1c1c -riverctl border-color-urgent 0x9f353a -riverctl border-width 2 - -# Set keyboard repeat rate riverctl set-repeat 70 200 +riverctl input "pointer-*" natural-scroll enabled +riverctl input "pointer-*" pointer-accel 0 +riverctl input "pointer-*" tap enabled +riverctl input "pointer-*" accel-profile adaptive +riverctl input "pointer-*" disable-while-typing enabled +riverctl input "*Kensington_Slimblade_Trackball" natural-scroll disabled +riverctl input "*Kensington_Slimblade_Trackball" pointer-accel 1 -# Make certain views start floating -# riverctl float-filter-add app-id float -# riverctl float-filter-add title "popup title with spaces" - -# Set app-ids and titles of views which should use client side decorations -# riverctl csd-filter-add app-id "gedit" - -#riverctl spawn 'once -- s6-svscan ~/.local/share/s6' -riverctl spawn 'dbus-update-activation-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP' -riverctl spawn 'light -S 80' -#riverctl spawn 'sleep 1.4 && kanshictl reload' +riverctl set-cursor-warp on-output-change # Set and exec into the default layout generator, rivertile. # River will send the process group of the init executable SIGTERM on exit. riverctl default-layout rivertile -exec rivertile -view-padding 5 -outer-padding 0 +riverctl send-layout-cmd rivertile "main-ratio 0.66" +riverctl send-layout-cmd rivertile "main-count 1" +exec rivertile -view-padding 0 -outer-padding 0 diff --git a/.config/river/keybinds b/.config/river/keybinds new file mode 100755 index 0000000..516b653 --- /dev/null +++ b/.config/river/keybinds @@ -0,0 +1,174 @@ +#!/bin/sh + +. "$XDG_CONFIG_HOME/river/functions.sh" + +export mod=Super + +# Note: the "$mod" modifier is also known as Logo, GUI, Windows, $mod, etc. +riverctl map normal $mod+Shift Q close +riverctl map normal $mod+Shift E exit + +# $mod+J and $mod+K to focus the next/previous view in the layout stack +riverctl map normal $mod J focus-view next +riverctl map normal $mod K focus-view previous +riverctl map normal $mod L focus-view right +riverctl map normal $mod H focus-view left + +# $mod+Shift+J and $mod+Shift+K to swap the focused view with the next/previous +# view in the layout stack +riverctl map normal $mod+Shift J swap next +riverctl map normal $mod+Shift K swap previous +riverctl map normal $mod+Shift L swap right +riverctl map normal $mod+Shift H swap left + +riverctl map normal $mod Backspace focus-previous-tags +riverctl map normal $mod+Shift Backspace move-previous-tags + +# $mod+Period and $mod+Comma to focus the next/previous output +riverctl map normal $mod Period focus-output next +riverctl map normal $mod Comma focus-output previous + +# $mod+Shift+{Period,Comma} to send the focused view to the next/previous output +riverctl map normal $mod+Shift Period spawn 'riverctl send-to-output next && riverctl focus-output next' +riverctl map normal $mod+Shift Comma spawn 'riverctl send-to-output previous && riverctl focus-output previous' + +# bump the focused view to the top of the layout stack +riverctl map normal $mod+Shift Return zoom + +# $mod++ and $mod+- to decrease/increase the main ratio of rivertile(1) +riverctl map normal $mod Equal send-layout-cmd rivertile "main-ratio +0.05" +riverctl map normal $mod Minus send-layout-cmd rivertile "main-ratio -0.05" + +# $mod+Shift+H and $mod+Shift+L to increment/decrement the main count of rivertile(1) +riverctl map normal $mod Plus send-layout-cmd rivertile "main-count +1" +riverctl map normal $mod Underscore send-layout-cmd rivertile "main-count -1" + +# snap views to screen edges +# riverctl map normal $mod+Control H snap left +# riverctl map normal $mod+Control J snap down +# riverctl map normal $mod+Control K snap up +# riverctl map normal $mod+Control L snap right + +declare_mode resize $mod R +map_mode -n resize None h resize horizontal 100 +map_mode -n resize None j resize vertical -100 +map_mode -n resize None k resize vertical 100 +map_mode -n resize None l resize horizontal -100 + +riverctl map-pointer normal $mod BTN_LEFT move-view +riverctl map-pointer normal $mod BTN_RIGHT resize-view + +riverctl focus-follows-cursor normal + +# tag management +for i in $(seq 1 9); do + tags=$((1 << (i - 1))) + + riverctl map normal $mod "$i" set-focused-tags "$tags" + riverctl map normal $mod+Shift "$i" set-view-tags "$tags" + riverctl map normal $mod+Control "$i" toggle-focused-tags "$tags" + riverctl map normal $mod+Shift+Control "$i" toggle-view-tags "$tags" +done + +# $mod+0 to focus all tags +# $mod+Shift+0 to tag focused view with all tags +all_tags=$(((1 << 32) - 1)) +riverctl map normal $mod 0 set-focused-tags $all_tags +riverctl map normal $mod+Shift 0 set-view-tags $all_tags +riverctl map normal $mod+Control 0 toggle-focused-tags "$all_tags" +riverctl map normal $mod+Control+Shift 0 toggle-view-tags $all_tags + +scratch_tag=$((1 << 31)) +riverctl spawn-tagmask $((all_tags ^ scratch_tag)) +riverctl map normal $mod Delete toggle-focused-tags "$scratch_tag" + +# $mod+Space to toggle float +riverctl map normal $mod+Shift Space toggle-float + +# $mod+F to toggle fullscreen +riverctl map normal $mod F toggle-fullscreen +# $mod+{Up,Right,Down,Left} to change layout orientation +riverctl map normal $mod Up send-layout-cmd rivertile "main-location top" +riverctl map normal $mod Right send-layout-cmd rivertile "main-location right" +riverctl map normal $mod Down send-layout-cmd rivertile "main-location bottom" +riverctl map normal $mod 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 $mod F11 enter-mode passthrough +# return to normal mode +riverctl map passthrough $mod F11 enter-mode normal + +# run application launcher +# riverctl map normal $mod Return spawn foot +# riverctl map normal $mod Return spawn footclient +riverctl map normal $mod Return spawn ghostty +riverctl map normal $mod D spawn 'menu -run' +riverctl map normal $mod W spawn 'oguri-cycle' + +declare_mode menu $mod M +map_mode menu None A 'riverctl spawn soundswitch' +map_mode menu None B 'riverctl spawn bluemenu' +map_mode menu None C 'riverctl spawn connmenu' +map_mode menu None D 'riverctl spawn domenu' +map_mode menu None M 'riverctl spawn mnts' +map_mode menu None N 'riverctl spawn notifmenu' +map_mode menu None O 'riverctl spawn modemenu' +map_mode menu None P 'riverctl spawn passmenu2' +map_mode menu None R 'riverctl spawn rcmenu' +map_mode menu None V 'riverctl spawn vpnmenu' +map_mode menu None Delete 'riverctl spawn powermenu' + +# TODO: screenshot mode +declare_mode screenshot $mod+Shift S +map_mode screenshot None s 'grimshot copy area' +map_mode screenshot Shift s 'grimshot save area' +map_mode screenshot None o 'grimshot copy output' +map_mode screenshot Shift o 'grimshot save output' +map_mode screenshot Shift a 'grimshot copy win' +map_mode screenshot None a 'grimshot copy' +map_mode screenshot Shift a 'grimshot copy' + +riverctl map normal $mod X spawn 'wtype -P XF86Cut' +riverctl map normal $mod C spawn 'wtype -P XF86Copy' +riverctl map normal $mod V spawn 'wtype -P XF86Paste' +#riverctl map normal $mod+Shift V spawn 'wl-paste -p -n | wtype -d 10 -s 5 -' +riverctl map normal $mod B spawn 'pkill -USR1 waybar' + +riverctl map normal $mod G spawn 'wl-kbptr' +declare_mode mouse $mod+Shift G +map_mode mouse None t 'wl-kbptr -o modes=tile,bisect' +map_mode mouse None b 'wl-kbptr -o modes=bisect' +map_mode mouse None c 'wl-kbptr -o modes=click' +# TODO: wlrctl pointer ... + +# Various media key mapping examples for both normal and locked mode which do +# not have a modifier +for mode in normal locked; do + riverctl map $mode None XF86AudioRaiseVolume spawn 'soundswitch -V' + riverctl map $mode None XF86AudioLowerVolume spawn 'soundswitch -v' + riverctl map $mode None XF86AudioMute spawn 'soundswitch -m' + + # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl) + riverctl map $mode None XF86AudioPlay spawn 'playerctl -p playerctld play-pause' + riverctl map $mode None XF86AudioPrev spawn 'playerctl -p playerctld previous' + riverctl map $mode None XF86AudioNext spawn 'playerctl -p playerctld next' + + riverctl map $mode None XF86MonBrightnessUp spawn 'light set +5%' + riverctl map $mode None XF86MonBrightnessDown spawn 'light set 5%-' + + # AudioMedia is F12/framework logo key + riverctl map $mode None XF86AudioMedia spawn 'kanshictl reload' + riverctl map $mode None XF86Keyboard spawn 'light set 0%' + riverctl map $mode None XF86Favorites spawn 'light set 100%' +done + +# suspend on lid closing +riverctl map-switch normal lid close spawn 'suspend-then-hibernate' + +declare_mode ocr $mod o +map_mode ocr None o 'transformers_ocr recognize' +map_mode ocr None h 'transformers_ocr hold' +map_mode ocr None x 'transformers_ocr stop' diff --git a/.config/river/layouts b/.config/river/layouts new file mode 100755 index 0000000..1a24852 --- /dev/null +++ b/.config/river/layouts @@ -0,0 +1 @@ +#!/bin/sh diff --git a/.config/river/mklayout.sh b/.config/river/mklayout.sh new file mode 100755 index 0000000..a6151cd --- /dev/null +++ b/.config/river/mklayout.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -eu + +case "${1:-}" in +reset) + riverctl send-layout-cmd rivertile "main-ratio 0.66" + riverctl send-layout-cmd rivertile "main-count 1" + riverctl send-layout-cmd rivertile "main-location left" + ;; +dev) + workspace=$( + zoxide query -l | + xargs zenity \ + --title 'river-mklayout' \ + --text 'Select a workspace to enter into' \ + --list \ + --column 1 + ) + # spawn 3 terminals in the workspace + riverctl spawn "foot -D $workspace" + riverctl spawn "foot -D $workspace" + riverctl spawn "foot -D $workspace" + # terminate the terminal that ran mklayout (if any) + test -t 0 && riverctl close + ;; +*) + exit 1 + ;; +esac diff --git a/.config/river/rules b/.config/river/rules new file mode 100755 index 0000000..7bfc8c6 --- /dev/null +++ b/.config/river/rules @@ -0,0 +1,18 @@ +#!/bin/sh + +riverctl rule-add -app-id 'io.mpv' float + +riverctl rule-add -app-id 'firefox' -title 'Picture-in-Picture' float +riverctl rule-add -app-id 'firefox' -title 'Picture-in-Picture' tags $(((1 << 32) - 1)) +riverctl rule-add -app-id 'firefox' -title 'Picture-in-Picture' position 9999 25 + +riverctl rule-add -app-id 'firefox' -title 'Extension: Bitwarden Password Manager*' float + +riverctl rule-add -app-id 'zen' -title 'Picture-in-Picture' float +riverctl rule-add -app-id 'zen' -title 'Picture-in-Picture' tags $(((1 << 32) - 1)) +riverctl rule-add -app-id 'zen' -title 'Picture-in-Picture' position 9999 25 + +riverctl rule-add -app-id 'wine' float +riverctl rule-add -app-id 'qmmp' float + +riverctl rule-add -app-id '*' ssd diff --git a/.config/river/wl-kbptr-river-active-output b/.config/river/wl-kbptr-river-active-output new file mode 100755 index 0000000..97febff --- /dev/null +++ b/.config/river/wl-kbptr-river-active-output @@ -0,0 +1,4 @@ +#!/bin/sh +active_area=$(swaymsg -t get_tree | jq --raw-output \ + '.. | (.nodes? + .floating_nodes? // empty)[] | select (.focused) | .rect | "\(.width)x\(.height)+\(.x)+\(.y)"') +exec wl-kbptr --restrict "$active_area" $@ |