Dotfiles/bin/.bin/dmenu/spawn-phone-menu
Jonathan Hodgson 43f0dd09bc Many changes including introduction to menu system
THe main addition here is the menu system that is used to contoll the
phone. THere are also some small helper scripts for calls etc.
2021-04-04 16:04:22 +01:00

27 lines
445 B
Bash
Executable file

#!/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"