In sxmo_appmenu.sh & sxmo_urlhandler.sh only show entries if program installed

E.g. so if you don't have firefox installed it won't show up in menus
master
Miles Alan 4 years ago
parent 4362eacde2
commit a203bbfe85
  1. 18
      scripts/core/sxmo_appmenu.sh
  2. 30
      scripts/core/sxmo_urlhandler.sh

@ -35,14 +35,14 @@ programchoicesinit() {
elif echo "$WMCLASS" | grep -i "applications"; then
# Apps menu
CHOICES="
Surf ^ 0 ^ surf
Netsurf ^ 0 ^ netsurf
Firefox ^ 0 ^ firefox
Sacc ^ 0 ^ st -e sacc i-logout.cz/1/bongusta
W3m ^ 0 ^ st -e w3m duck.com
Xcalc ^ 0 ^ xcalc
St ^ 0 ^ st
Foxtrotgps ^ 0 ^ foxtrotgps
$(command -v surf >/dev/null && echo 'Surf ^ 0 ^ surf')
$(command -v netsurf >/dev/null && echo 'Netsurf ^ 0 ^ netsurf')
$(command -v firefox >/dev/null && echo 'Firefox ^ 0 ^ firefox')
$(command -v sacc >/dev/null && echo 'Sacc ^ 0 ^ st -e sacc i-logout.cz/1/bongusta')
$(command -v w3m >/dev/null && echo 'W3m ^ 0 ^ st -e w3m duck.com')
$(command -v xcalc >/dev/null && echo 'Xcalc ^ 0 ^ xcalc')
$(command -v st >/dev/null && echo 'St ^ 0 ^ st')
$(command -v foxtrotgps >/dev/null && echo 'Foxtrotgps ^ 0 ^ foxtrotgps')
"
WINNAME=Apps
elif echo "$WMCLASS" | grep -i "config"; then
@ -320,7 +320,7 @@ programchoicesinit() {
Scripts ^ 0 ^ sxmo_appmenu.sh scripts
Apps ^ 0 ^ sxmo_appmenu.sh applications
Files ^ 0 ^ sxmo_files.sh
Maps ^ 0 ^ foxtrotgps
$(command -v foxtrotgps >/dev/null && echo 'Maps ^ 0 ^ foxtrotgps')
Dialer ^ 0 ^ sxmo_modemdial.sh
Texts ^ 0 ^ sxmo_modemtext.sh
Camera ^ 0 ^ sxmo_camera.sh

@ -24,19 +24,23 @@ fi
COMMAND=$(
echo "
w3m URL
mpv -ao=alsa -v URL
mpv -ao=alsa -v --ytdl-format='[height<420]' URL
firefox -new-window URL
netsurf URL
surf URL
echo URL | xsel -i
youtube-dl -o- URL | mpv -ao=alsa -v -
youtube-dl URL
curl URL | vis -
wget URL
aria2c URL
" | sed "s/URL/'URL'/g" | sed -e '/^\s*$/d' | sed -e 's/^\s*//' | dmenu -fn Terminus-15 -p "Pipe URL" -c -l 20
$(command -v w3m >/dev/null && echo 'w3m URL')
$(command -v mpv >/dev/null && echo 'mpv -ao=alsa -v URL')
$(command -v mpv >/dev/null && echo 'mpv -ao=alsa -v --ytdl-format='[height<420]' URL')
$(command -v firefox >/dev/null && echo 'firefox -new-window URL')
$(command -v netsurf >/dev/null && echo 'netsurf URL')
$(command -v surf >/dev/null && echo 'surf URL')
$(command -v echo >/dev/null && echo 'echo URL | xsel -i')
$(command -v youtube-dl >/dev/null && echo 'youtube-dl -o- URL | mpv -ao=alsa -v -')
$(command -v youtube-dl >/dev/null && echo 'youtube-dl URL')
$(command -v curl >/dev/null && echo 'curl URL | vis -')
$(command -v wget >/dev/null && echo 'wget URL')
$(command -v aria2c >/dev/null && echo 'aria2c URL')
" |
sed "s/URL/'URL'/g" |
sed -e '/^\s*$/d' |
sed -e 's/^\s*//' |
dmenu -fn Terminus-15 -p "Pipe URL" -c -l 20
)
[ -z "$COMMAND" ] && exit 1

Loading…
Cancel
Save