Files
sxmo-utils/scripts/core/sxmo_pipecomplete.sh
Maarten van Gompel ace9960926 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.
2020-07-26 10:22:31 -05:00

37 lines
597 B
Bash
Executable File

#!/usr/bin/env sh
INPUT="$(cat)"
STWIN="$(xprop -root | sed -n '/^_NET_ACTIVE_WINDOW/ s/.* //p')"
menu() {
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 "$KEYBOARD"
}
copy() {
PROMPT=Copy
menu
if [ "$RESULT" = "Close Menu" ]; then
exit 0
else
echo "$RESULT" | xclip -i
fi
}
type() {
PROMPT=Type
menu
if [ "$RESULT" = "Close Menu" ]; then
exit 0
else
xdotool type --window "$STWIN" "$RESULT"
fi
}
"$1"