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.

35 lines
540 B

#!/usr/bin/env sh
INPUT="$(cat)"
STWIN="$(xprop -root | sed -n '/^_NET_ACTIVE_WINDOW/ s/.* //p')"
menu() {
RESULT="$(
printf %b "$(
echo "Close Menu";
echo "$INPUT" | grep -Eo '\S+' | tr -d '[:blank:]' | sort | uniq
)" | sxmo_dmenu_with_kb.sh -p "$PROMPT" -l 10 -i -c
)"
}
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"