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:
parent
ff7863b011
commit
d91bc46d75
3 changed files with 31 additions and 9 deletions
29
desktop/.local/bin/kanshiswitch
Executable file
29
desktop/.local/bin/kanshiswitch
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue