river: Add output quick switch script

Invoked by `MOD+SHIFT+O` (for '[O]utput'), it greps the kanshi
configuration file for existing profiles and allows you to select one
which kanshi tries to apply. Can be a little buggy, though due to kanshi
and not the plugin (sometimes failing to re-activate turned off screens
etc).
This commit is contained in:
Marty Oehme 2025-06-09 14:19:57 +02:00
parent ff7863b011
commit d91bc46d75
Signed by: Marty
GPG key ID: 4E535BC19C61886E
3 changed files with 31 additions and 9 deletions

View file

@ -5,13 +5,6 @@ profile docked {
exec notify-send "💻 Display changed" "Applying docked LG profile"
}
profile docked {
output "Goldstar Company Ltd W2442 0x000574FD" position 1920,0
output "Goldstar Company Ltd W2442 0x000574E1" position 0,0
output eDP-1 disable
exec notify-send "💻 Display changed" "Applying docked Goldstar profile"
}
profile dockedall {
output "LG Electronics W2442 0x000574FD" position 1920,0
output "LG Electronics W2442 0x000574E1" position 0,0
@ -19,7 +12,7 @@ profile dockedall {
exec notify-send "💻 Display changed" "Applying docked 3-screen profile"
}
profile portable {
profile portableforce {
output "LG Electronics W2442 0x000574FD" disable
output "LG Electronics W2442 0x000574E1" disable
output eDP-1 enable position 0,0

View file

@ -176,6 +176,7 @@ riverctl map normal $mod+Shift v toggle-float
# shellcheck disable=SC2016
# Make all connected outputs show the desktop and no windows at all
riverctl map normal $mod+Shift M spawn 'for i in $(wlopm | wc -l); do riverctl set-focused-tags $((1 << 10)); riverctl focus-output next; done; riverctl set-focused-tags $((1 << 10)); riverctl focus-output next'
riverctl map normal $mod+Shift O spawn "kanshiswitch"
riverctl map normal $mod+Shift F10 spawn "riverctl send-layout-cmd $layout_cmd '--tags all --output all view-padding 0'"
riverctl map normal $mod F10 spawn "riverctl send-layout-cmd $layout_cmd '--tags all --output all view-padding 6'"
@ -306,7 +307,6 @@ for pad in $(riverctl list-inputs | grep -i touchscreen); do
riverctl input "$pad" pointer-accel 0.5
done
# We are not in voidlinux, so no nice turnstile user services will take care of us
# have to start everything manually here.
if ! cat /etc/*-release | grep -q '^NAME=.*Void'; then

29
desktop/.local/bin/kanshiswitch Executable file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env sh
if ! exist kanshictl; then
printf "Requires command 'kanshictl' on system."
exit 1
fi
picker=dmenu
if exist bemenu; then
picker=bemenu
elif exist wofi; then
picker=wofi
elif exist rofi; then
picker=rofi
fi
regex='s/profile \+\(.*\) \+{/\1/p'
list=$(sed -ne "$regex" "${XDG_CONFIG_HOME:-~/.config}/kanshi/config")
profile=$(printf "%s" "$list" | "$picker")
if [ -z "$profile" ]; then
return
else
kanshictl switch "$profile"
fi
if [ "$1" = '-v' ]; then
notify-send "Kanshi profile set" "Set to: $profile"
fi