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.
36 lines
595 B
36 lines
595 B
#!/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"
|
|
|