You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
594 B

#!/usr/bin/env sh
INPUT="$(cat)"
STWIN="$(xprop -root | sed -n '/^_NET_ACTIVE_WINDOW/ s/.* //p')"
menu() {
pidof svkbd-sxmo || svkbd-sxmo &
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
}
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"