|
|
|
@ -1,30 +1,24 @@ |
|
|
|
|
#!/usr/bin/env sh |
|
|
|
|
WIN=$(xdotool getwindowfocus) |
|
|
|
|
INCOMINGCALL=$(cat /tmp/sxmo_incomingcall || echo NOCALL) |
|
|
|
|
|
|
|
|
|
programchoicesinit() { |
|
|
|
|
WMCLASS="${1:-$(xprop -id $(xdotool getactivewindow) | grep WM_CLASS | cut -d ' ' -f3-)}" |
|
|
|
|
|
|
|
|
|
# Default |
|
|
|
|
# Default system menu (no matches) |
|
|
|
|
CHOICES="$(echo " |
|
|
|
|
Scripts ^ 0 ^ sxmo_appmenu.sh scripts |
|
|
|
|
Apps ^ 0 ^ sxmo_appmenu.sh applications |
|
|
|
|
Volume ↑ ^ 1 ^ sxmo_vol.sh up |
|
|
|
|
Volume ↓ ^ 1 ^ sxmo_vol.sh down |
|
|
|
|
Dialer ^ 1 ^ sxmo_phonecaller.exp dial |
|
|
|
|
Volume ↑ ^ 1 ^ sxmo_vol.sh up |
|
|
|
|
Volume ↓ ^ 1 ^ sxmo_vol.sh down |
|
|
|
|
Dialer ^ 1 ^ sxmo_modemcall.sh dial |
|
|
|
|
Texts ^ 0 ^ sxmo_readtexts.sh |
|
|
|
|
Camera ^ 0 ^ sxmo_camera.sh |
|
|
|
|
Wifi ^ 0 ^ st -e "nmtui" |
|
|
|
|
System Config ^ 0 ^ sxmo_appmenu.sh control |
|
|
|
|
Logout ^ 0 ^ pkill -9 dwm |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=Sys |
|
|
|
|
|
|
|
|
|
# E.g. for the system menu if there's an incoming call pop it on top of menu |
|
|
|
|
echo "$INCOMINGCALL" | grep -v NOCALL && CHOICES="$(echo " |
|
|
|
|
Pickup $INCOMINGCALL ^ 0 ^ sxmo_phonecaller.exp pickup $INCOMINGCALL |
|
|
|
|
")""$CHOICES" |
|
|
|
|
|
|
|
|
|
# Apps menu |
|
|
|
|
echo $WMCLASS | grep -i "applications" && CHOICES="$(echo " |
|
|
|
|
Surf ^ 0 ^ surf |
|
|
|
|
NetSurf ^ 0 ^ netsurf |
|
|
|
@ -33,30 +27,31 @@ programchoicesinit() { |
|
|
|
|
St ^ 0 ^ st |
|
|
|
|
Firefox ^ 0 ^ firefox |
|
|
|
|
Foxtrotgps ^ 0 ^ foxtrotgps |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=Apps |
|
|
|
|
")" && WINNAME=Apps && return |
|
|
|
|
|
|
|
|
|
# Scripts menu |
|
|
|
|
echo $WMCLASS | grep -i "scripts" && CHOICES="$(echo " |
|
|
|
|
Timer ^ 0 ^ sxmo_timermenu.sh |
|
|
|
|
Youtube ^ 0 ^ sxmo_youtube.sh |
|
|
|
|
Youtube (Audio) ^ 0 ^ sxmo_youtube.sh --no-video |
|
|
|
|
Weather ^ 0 ^ sxmo_weather.sh |
|
|
|
|
RSS ^ 0 ^ sxmo_rss.sh |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=Scripts |
|
|
|
|
")" && WINNAME=Scripts && return |
|
|
|
|
|
|
|
|
|
# System Control menu |
|
|
|
|
echo $WMCLASS | grep -i "control" && CHOICES="$(echo " |
|
|
|
|
Volume ↑ ^ 1 ^ sxmo_vol.sh up |
|
|
|
|
Volume ↓ ^ 1 ^ sxmo_vol.sh down |
|
|
|
|
Brightesss ↑ ^ 1 ^ sxmo_brightness.sh up |
|
|
|
|
Brightness ↓ ^ 1 ^ sxmo_brightness.sh down |
|
|
|
|
Modem Info ^ 1 ^ st -e 'mmcli -m 0 && read' |
|
|
|
|
Rotate ^ 1 ^ rotate |
|
|
|
|
Wifi ^ 0 ^ st -e "nmtui" |
|
|
|
|
Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=Control |
|
|
|
|
|
|
|
|
|
Volume ↑ ^ 1 ^ sxmo_vol.sh up |
|
|
|
|
Volume ↓ ^ 1 ^ sxmo_vol.sh down |
|
|
|
|
Brightesss ↑ ^ 1 ^ sxmo_brightness.sh up |
|
|
|
|
Brightness ↓ ^ 1 ^ sxmo_brightness.sh down |
|
|
|
|
Modem $(pgrep -f sxmo_modemmonitor.sh >/dev/null && echo -n "On → Off" || echo -n "Off → On") ^ 1 ^ sxmo_modemmonitortoggle.sh |
|
|
|
|
Modem Info ^ 1 ^ sxmo_modeminfo.sh |
|
|
|
|
Rotate ^ 1 ^ rotate |
|
|
|
|
Wifi ^ 0 ^ st -e "nmtui" |
|
|
|
|
Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh |
|
|
|
|
")" && WINNAME=Control && return |
|
|
|
|
|
|
|
|
|
# MPV |
|
|
|
|
echo $WMCLASS | grep -i "mpv" && CHOICES="$(echo " |
|
|
|
|
Pause ^ 0 ^ key space |
|
|
|
|
Seek ← ^ 1 ^ key Left |
|
|
|
@ -69,30 +64,27 @@ programchoicesinit() { |
|
|
|
|
Loopmark ^ 1 ^ key l |
|
|
|
|
Info ^ 1 ^ key i |
|
|
|
|
Seek Info ^ 1 ^ key o |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=Mpv |
|
|
|
|
")" && WINNAME=Mpv && return |
|
|
|
|
|
|
|
|
|
# St |
|
|
|
|
echo $WMCLASS | grep -i "st-256color" && CHOICES="$(echo " |
|
|
|
|
Pastecomplete ^ 0 ^ key Ctrl+Shift+u |
|
|
|
|
Copycomplete ^ 0 ^ key Ctrl+Shift+i |
|
|
|
|
Paste ^ 0 ^ key Ctrl+Shift+v |
|
|
|
|
Pipe Data ^ 0 ^ |
|
|
|
|
Zoom + ^ 1 ^ key Ctrl+Shift+Prior |
|
|
|
|
Zoom - ^ 1 ^ key Ctrl+Shift+Next |
|
|
|
|
Scroll ↑ ^ 1 ^ key Shift+Prior |
|
|
|
|
Scroll ↓ ^ 1 ^ key Shift+Next |
|
|
|
|
Scroll ↑ ^ 1 ^ key Ctrl+Shift+b |
|
|
|
|
Scroll ↓ ^ 1 ^ key Ctrl+Shift+f |
|
|
|
|
Invert ^ 1 ^ key Ctrl+Shift+x |
|
|
|
|
Hotkeys ^ 0 ^ sxmo_appmenu.sh sthotkeys |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=st |
|
|
|
|
")" && WINNAME=st && return |
|
|
|
|
|
|
|
|
|
# St hotkeys |
|
|
|
|
echo $WMCLASS | grep -i "sthotkeys" && CHOICES="$(echo " |
|
|
|
|
Send Ctrl-C ^ 0 ^ key Ctrl+c |
|
|
|
|
Send Ctrl-L ^ 0 ^ key Ctrl+l |
|
|
|
|
Send Ctrl-D ^ 0 ^ key Ctrl+d |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=st |
|
|
|
|
")" && WINNAME=st && return |
|
|
|
|
|
|
|
|
|
# Surf |
|
|
|
|
echo $WMCLASS | grep surf && CHOICES="$(echo " |
|
|
|
@ -107,18 +99,27 @@ programchoicesinit() { |
|
|
|
|
Search ^ 1 ^ key Ctrl+f |
|
|
|
|
History ← ^ 1 ^ key Ctrl+h |
|
|
|
|
History → ^ 1 ^ key Ctrl+l |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=surf |
|
|
|
|
")" && WINNAME=surf && return |
|
|
|
|
|
|
|
|
|
# Netsurf |
|
|
|
|
echo $WMCLASS | grep -i netsurf && CHOICES="$(echo " |
|
|
|
|
Pipe URL ^ 0 ^ sxmo_urlhandler.sh |
|
|
|
|
Zoom + ^ 1 ^ key Ctrl+plus |
|
|
|
|
Zoom - ^ 1 ^ key Ctrl+minus |
|
|
|
|
History ← ^ 1 ^ key Alt+Left |
|
|
|
|
History → ^ 1 ^ key Alt+Right |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=netsurf |
|
|
|
|
")" && WINNAME=netsurf && return |
|
|
|
|
|
|
|
|
|
# Firefox |
|
|
|
|
echo $WMCLASS | grep -i firefox && CHOICES="$(echo " |
|
|
|
|
Pipe URL ^ 0 ^ sxmo_urlhandler.sh |
|
|
|
|
Zoom + ^ 1 ^ key Ctrl+plus |
|
|
|
|
Zoom - ^ 1 ^ key Ctrl+minus |
|
|
|
|
History ← ^ 1 ^ key Alt+Left |
|
|
|
|
History → ^ 1 ^ key Alt+Right |
|
|
|
|
")" && WINNAME=netsurf && return |
|
|
|
|
|
|
|
|
|
# Foxtrot GPS |
|
|
|
|
echo $WMCLASS | grep -i foxtrot && CHOICES="$(echo " |
|
|
|
|
Zoom + ^ 1 ^ key i |
|
|
|
|
Zoom - ^ 1 ^ key o |
|
|
|
@ -127,8 +128,33 @@ programchoicesinit() { |
|
|
|
|
Route ^ 0 ^ key r |
|
|
|
|
Gmaps Transfer ^ 0 ^ key o |
|
|
|
|
Copy Cords ^ 0 ^ key o |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
")" && WINNAME=gps |
|
|
|
|
")" && WINNAME=gps && return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getprogchoices() { |
|
|
|
|
# E.g. sets CHOICES var |
|
|
|
|
programchoicesinit $@ |
|
|
|
|
|
|
|
|
|
# Decorate menu at top w/ incoming call entry if present |
|
|
|
|
INCOMINGCALL=$(cat /tmp/sxmo_incomingcall || echo NOCALL) |
|
|
|
|
echo "$INCOMINGCALL" | grep -v NOCALL && CHOICES="$(echo " |
|
|
|
|
Pickup $(echo $INCOMINGCALL | cut -d: -f2) ^ 0 ^ sxmo_modemcall.sh pickup $(echo $INCOMINGCALL | cut -d: -f1) |
|
|
|
|
$CHOICES |
|
|
|
|
")" |
|
|
|
|
|
|
|
|
|
# Decorate menu at bottom w/ system menu entry if not system menu |
|
|
|
|
echo $WINNAME | grep -v Sys && CHOICES=" |
|
|
|
|
$CHOICES |
|
|
|
|
System Menu ^ 0 ^ sxmo_appmenu.sh sys |
|
|
|
|
" |
|
|
|
|
|
|
|
|
|
# Decorate menu at bottom w/ close menu entry |
|
|
|
|
CHOICES=" |
|
|
|
|
$CHOICES |
|
|
|
|
Close Menu ^ 0 ^ quit |
|
|
|
|
" |
|
|
|
|
|
|
|
|
|
PROGCHOICES="$(echo "$CHOICES" | xargs -0 echo | sed '/^[[:space:]]*$/d' | awk '{$1=$1};1')" |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
rotate() { |
|
|
|
@ -145,33 +171,30 @@ quit() { |
|
|
|
|
exit 0 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boot() { |
|
|
|
|
mainloop() { |
|
|
|
|
DMENUIDX=0 |
|
|
|
|
PICKED="" |
|
|
|
|
pgrep -f sxmo_appmenu.sh | grep -Ev "^${$}$" | xargs kill -9 |
|
|
|
|
pkill -9 dmenu |
|
|
|
|
} |
|
|
|
|
ARGS="$@" |
|
|
|
|
|
|
|
|
|
mainloop() { |
|
|
|
|
while : |
|
|
|
|
do |
|
|
|
|
PICKED=$( |
|
|
|
|
echo "$CHOICES" | |
|
|
|
|
xargs -0 echo | |
|
|
|
|
# E.g. sets PROGCHOICES |
|
|
|
|
getprogchoices $ARGS |
|
|
|
|
|
|
|
|
|
PICKED="$( |
|
|
|
|
echo "$PROGCHOICES" | |
|
|
|
|
cut -d'^' -f1 | |
|
|
|
|
sed '/^[[:space:]]*$/d' | |
|
|
|
|
awk '{$1=$1};1' | |
|
|
|
|
dmenu -idx $DMENUIDX -l 14 -c -fn "Terminus-30" -p "$WINNAME" |
|
|
|
|
) |
|
|
|
|
LOOP=$(echo "$CHOICES" | grep "$PICKED" | cut -d '^' -f2) |
|
|
|
|
CMD=$(echo "$CHOICES" | grep "$PICKED" | cut -d '^' -f3) |
|
|
|
|
DMENUIDX=$(echo $(echo "$CHOICES" | grep -n "$PICKED" | cut -d ':' -f1) - 1 | bc) |
|
|
|
|
)" |
|
|
|
|
LOOP="$(echo "$PROGCHOICES" | grep -F "$PICKED" | cut -d '^' -f2)" |
|
|
|
|
CMD="$(echo "$PROGCHOICES" | grep -F "$PICKED" | cut -d '^' -f3)" |
|
|
|
|
DMENUIDX="$(echo "$PROGCHOICES" | grep -F -n "$PICKED" | cut -d ':' -f1)" |
|
|
|
|
echo "Eval: <$CMD> from picked <$PICKED> with loop <$LOOP>" |
|
|
|
|
eval $CMD |
|
|
|
|
echo $LOOP | grep 1 || quit |
|
|
|
|
done |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boot |
|
|
|
|
programchoicesinit $@ |
|
|
|
|
mainloop |
|
|
|
|
|
|
|
|
|
pgrep -f sxmo_appmenu.sh | grep -Ev "^${$}$" | xargs kill -9 |
|
|
|
|
pkill -9 dmenu |
|
|
|
|
mainloop $@ |
|
|
|
|