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.
28 lines
445 B
28 lines
445 B
4 years ago
|
#!/usr/bin/env bash
|
||
|
|
||
|
# This script creates menus for applications running on my phone
|
||
|
|
||
|
error(){
|
||
|
echo "$@" > /dev/stderr
|
||
|
exit 1
|
||
|
}
|
||
|
|
||
|
windowFocus="$(xdotool getwindowfocus)"
|
||
|
if [ -n "$1" ]; then
|
||
|
menu="menu-$1"
|
||
|
else
|
||
|
class="$(xprop -id "$windowFocus" | grep "WM_CLASS" | cut -d '"' -f 2)"
|
||
|
case "$class" in
|
||
|
"xterm-256color") menu="menu-st" ;;
|
||
|
*) menu="menu-$class" ;;
|
||
|
esac
|
||
|
fi
|
||
|
|
||
|
|
||
|
type "$menu" > /dev/null 2>&1 || menu="menu-system"
|
||
|
|
||
|
"$menu"
|
||
|
|
||
|
|
||
|
|