From ace99609266d72d347ac0257ce3ff4b95c94128b Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sat, 25 Jul 2020 17:12:20 +0200 Subject: [PATCH] Made choice for virtual keyboard configurable through the $KEYBOARD environment variable. This implements what was suggested in the discussion regarding the svkbd patch, it makes the choice of virtual keyboard configurable using the $KEYBOARD variable, rather than hard-coding it. --- scripts/appscripts/sxmo_reddit.sh | 10 +++++----- scripts/appscripts/sxmo_timer.sh | 6 +++--- scripts/appscripts/sxmo_websearch.sh | 4 ++-- scripts/appscripts/sxmo_youtube.sh | 4 ++-- scripts/core/sxmo_dmenu_with_kb.sh | 4 ++-- scripts/core/sxmo_lisgdstart.sh | 4 ++-- scripts/core/sxmo_pipecomplete.sh | 4 ++-- scripts/core/sxmo_surf_linkselect.sh | 4 ++-- scripts/core/sxmo_xinit.sh | 1 + 9 files changed, 21 insertions(+), 20 deletions(-) diff --git a/scripts/appscripts/sxmo_reddit.sh b/scripts/appscripts/sxmo_reddit.sh index cc06ddc..2a1a047 100755 --- a/scripts/appscripts/sxmo_reddit.sh +++ b/scripts/appscripts/sxmo_reddit.sh @@ -2,20 +2,20 @@ [ -z "$SXMO_SUBREDDITS" ] && SXMO_SUBREDDITS="pine64official pinephoneofficial unixporn postmarketos linux" menu() { - pidof svkbd-sxmo || svkbd-sxmo & + pidof "$KEYBOARD" || "$KEYBOARD" & SUBREDDIT="$( printf %b "Close Menu\n$(echo "$SXMO_SUBREDDITS" | tr " " '\n')" | dmenu -p "Subreddit:" -c -l 10 -fn Terminus-20 )" - pkill svkbd-sxmo + pkill "$KEYBOARD" [ "Close Menu" = "$SUBREDDIT" ] && exit 0 REDDITRESULTS="$( reddit-cli "$SUBREDDIT" | grep -E '^((created_utc|ups|title|url):|===)' | sed -E 's/^(created_utc|ups|title|url):\s+/\t/g' | - tr -d '\n' | - sed 's/===/\n/g' | + tr -d '\n' | + sed 's/===/\n/g' | sed 's/^\t//g' | sort -t"$(printf '%b' '\t')" -rnk4 | awk -F'\t' '{ printf "↑%4s", $3; print " " $4 " " $1 " " $2 }' @@ -23,7 +23,7 @@ menu() { while true; do RESULT="$( - printf %b "Close Menu\n$REDDITRESULTS" | + printf %b "Close Menu\n$REDDITRESULTS" | dmenu -c -l 10 -fn Terminus-20 )" diff --git a/scripts/appscripts/sxmo_timer.sh b/scripts/appscripts/sxmo_timer.sh index f4ec14e..c2580d6 100755 --- a/scripts/appscripts/sxmo_timer.sh +++ b/scripts/appscripts/sxmo_timer.sh @@ -24,7 +24,7 @@ timerrun() { } menu() { - pidof svkbd-sxmo || svkbd-sxmo & + pidof "$KEYBOARD" || "$KEYBOARD" & TIMEINPUT="$( echo " 1h @@ -42,9 +42,9 @@ menu() { Close Menu " | awk 'NF' | awk '{$1=$1};1' | dmenu -p Timer -c -fn "Terminus-30" -l 20 )" - pkill svkbd-sxmo + pkill "$KEYBOARD" [ "Close Menu" = "$TIMEINPUT" ] && exit 0 st -f Monospace-50 -e "$0" timerrun "$TIMEINPUT" } -if [ $# -gt 0 ]; then "$@"; else menu; fi \ No newline at end of file +if [ $# -gt 0 ]; then "$@"; else menu; fi diff --git a/scripts/appscripts/sxmo_websearch.sh b/scripts/appscripts/sxmo_websearch.sh index 4604d67..505eaef 100755 --- a/scripts/appscripts/sxmo_websearch.sh +++ b/scripts/appscripts/sxmo_websearch.sh @@ -1,9 +1,9 @@ #!/usr/bin/env sh -pidof svkbd-sxmo || svkbd-sxmo & +pidof "$KEYBOARD" || "$KEYBOARD" & SEARCHQUERY="$( echo "Close Menu" | dmenu -t -p "Search Query:" -c -fn "Terminus-20" -l 20 )" -pkill svkbd-sxmo +pkill "$KEYBOARD" [ "Close Menu" = "$SEARCHQUERY" ] && exit 0 echo "$SEARCHQUERY" | grep . || exit 0 diff --git a/scripts/appscripts/sxmo_youtube.sh b/scripts/appscripts/sxmo_youtube.sh index 8d8b323..89b2edb 100755 --- a/scripts/appscripts/sxmo_youtube.sh +++ b/scripts/appscripts/sxmo_youtube.sh @@ -1,11 +1,11 @@ #!/usr/bin/env sh menu() { - pidof svkbd-sxmo || svkbd-sxmo & + pidof "$KEYBOARD" || "$KEYBOARD" & SEARCHTERMS="$( echo "Close Menu" | dmenu -p "Yt Search" -c -l 10 -fn Terminus-20 )" - pkill svkbd-sxmo + pkill "$KEYBOARD" [ "Close Menu" = "$SEARCHTERMS" ] && exit 0 IDIOTRESULTS="$(youtube-cli "$SEARCHTERMS")" diff --git a/scripts/core/sxmo_dmenu_with_kb.sh b/scripts/core/sxmo_dmenu_with_kb.sh index aedefcb..0022009 100755 --- a/scripts/core/sxmo_dmenu_with_kb.sh +++ b/scripts/core/sxmo_dmenu_with_kb.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -pidof svkbd-sxmo >&2 || svkbd-sxmo & +pidof "$KEYBOARD" >&2 || "$KEYBOARD" & OUTPUT="$(cat | dmenu "$@")" -pkill svkbd-sxmo >&2 +pkill "$KEYBOARD" >&2 echo "$OUTPUT" diff --git a/scripts/core/sxmo_lisgdstart.sh b/scripts/core/sxmo_lisgdstart.sh index 69737c4..cff9e38 100755 --- a/scripts/core/sxmo_lisgdstart.sh +++ b/scripts/core/sxmo_lisgdstart.sh @@ -10,6 +10,6 @@ lisgd "$@" \ -g '1,ULDR,sxmo_lisgdonefingercheck.sh sxmo_brightness.sh down' \ -g '2,LR,xdotool key --clearmodifiers Alt+e' \ -g '2,RL,xdotool key --clearmodifiers Alt+r' \ - -g '2,DU,pidof svkbd-sxmo || svkbd-sxmo &' \ - -g '2,UD,pkill -9 svkbd-sxmo' \ + -g "2,DU,pidof $KEYBOARD || $KEYBOARD &" \ + -g "2,UD,pkill -9 $KEYBOARD" \ & diff --git a/scripts/core/sxmo_pipecomplete.sh b/scripts/core/sxmo_pipecomplete.sh index c4ee680..1a447c6 100755 --- a/scripts/core/sxmo_pipecomplete.sh +++ b/scripts/core/sxmo_pipecomplete.sh @@ -3,14 +3,14 @@ INPUT="$(cat)" STWIN="$(xprop -root | sed -n '/^_NET_ACTIVE_WINDOW/ s/.* //p')" menu() { - pidof svkbd-sxmo || svkbd-sxmo & + pidof "$KEYBOARD" || "$KEYBOARD" & RESULT="$( printf %b "$( echo "Close Menu"; echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]' | sort | uniq )" | dmenu -p "$PROMPT" -l 10 -i -c -fn Terminus-20 )" - pkill svkbd-sxmo + pkill "$KEYBOARD" } copy() { diff --git a/scripts/core/sxmo_surf_linkselect.sh b/scripts/core/sxmo_surf_linkselect.sh index 7788828..32d2b94 100755 --- a/scripts/core/sxmo_surf_linkselect.sh +++ b/scripts/core/sxmo_surf_linkselect.sh @@ -73,7 +73,7 @@ link_select() { link_normalize "$(xprop -id "$SURF_WINDOW" _SURF_URI | cut -d '"' -f 2)" } -pidof svkbd-sxmo || svkbd-sxmo & +pidof "$KEYBOARD" || "$KEYBOARD" & VAL="$(link_select)" -pkill svkbd-sxmo +pkill "$KEYBOARD" echo "$VAL" diff --git a/scripts/core/sxmo_xinit.sh b/scripts/core/sxmo_xinit.sh index ea478af..80d1ae8 100755 --- a/scripts/core/sxmo_xinit.sh +++ b/scripts/core/sxmo_xinit.sh @@ -6,6 +6,7 @@ envvars() { command -v "$TERM" || export TERM=st command -v "$BROWSER" || export BROWSER=surf command -v "$EDITOR" || export EDITOR=vis + command -v "$KEYBOARD" || export KEYBOARD=svkbd-sxmo [ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1 [ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME=~/.config [ -z "$XDG_CACHE_HOME" ] && export XDG_CACHE_HOME=~/.cache