adding icons to menus

master
Maarten van Gompel 4 years ago
parent 24905884ee
commit 7669fa341e
  1. 2
      .build.yml
  2. 2
      Makefile
  3. 464
      scripts/core/sxmo_appmenu.sh
  4. 96
      scripts/core/sxmo_icons.sh
  5. 28
      scripts/modem/sxmo_modemcall.sh
  6. 26
      scripts/modem/sxmo_modemtext.sh
  7. 10
      scripts/notifications/sxmo_notificationsmenu.sh

@ -7,7 +7,7 @@ sources:
tasks: tasks:
- shellcheck: | - shellcheck: |
cd sxmo-utils cd sxmo-utils
shellcheck scripts/*/* shellcheck -x scripts/*/*
- editorconfig-check: | - editorconfig-check: |
cd sxmo-utils cd sxmo-utils
ec ec

@ -12,7 +12,7 @@ PROGRAMS = \
all: shellcheck $(PROGRAMS) all: shellcheck $(PROGRAMS)
shellcheck: shellcheck:
shellcheck scripts/*/* shellcheck -x scripts/*/*
programs/sxmo_setpineled: programs/sxmo_setpineled.c programs/sxmo_setpineled: programs/sxmo_setpineled.c
gcc -o programs/sxmo_setpineled programs/sxmo_setpineled.c gcc -o programs/sxmo_setpineled programs/sxmo_setpineled.c

@ -3,6 +3,10 @@ trap gracefulexit INT TERM
WIN=$(xdotool getwindowfocus) WIN=$(xdotool getwindowfocus)
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications
DIR=$(dirname "$0")
# shellcheck source=./sxmo_icons.sh
. "$DIR/sxmo_icons.sh"
gracefulexit() { gracefulexit() {
echo "Gracefully exiting $0">&2 echo "Gracefully exiting $0">&2
kill -9 0 kill -9 0
@ -20,25 +24,25 @@ programchoicesinit() {
if echo "$WMCLASS" | grep -i "scripts"; then if echo "$WMCLASS" | grep -i "scripts"; then
# Scripts menu # Scripts menu
CHOICES=" CHOICES="
Record ^ 0 ^ sxmo_record.sh $icon_mic Record ^ 0 ^ sxmo_record.sh
Reddit ^ 0 ^ sxmo_reddit.sh $icon_red Reddit ^ 0 ^ sxmo_reddit.sh
RSS ^ 0 ^ sxmo_rss.sh $icon_rss RSS ^ 0 ^ sxmo_rss.sh
Timer ^ 0 ^ sxmo_timer.sh $icon_tmr Timer ^ 0 ^ sxmo_timer.sh
Youtube ^ 0 ^ sxmo_youtube.sh video $icon_ytb Youtube ^ 0 ^ sxmo_youtube.sh video
Youtube (Audio) ^ 0 ^ sxmo_youtube.sh audio $icon_ytb Youtube (Audio) ^ 0 ^ sxmo_youtube.sh audio
Web Search ^ 0 ^ sxmo_websearch.sh $icon_glb Web Search ^ 0 ^ sxmo_websearch.sh
Weather ^ 0 ^ sxmo_weather.sh $icon_wtr Weather ^ 0 ^ sxmo_weather.sh
" "
if [ -x "$XDG_CONFIG_HOME/sxmo/userscripts" ]; then if [ -x "$XDG_CONFIG_HOME/sxmo/userscripts" ]; then
CHOICES=" CHOICES="
$( $(
find "$XDG_CONFIG_HOME/sxmo/userscripts" \( -type f -o -type l \) -print0 | find "$XDG_CONFIG_HOME/sxmo/userscripts" \( -type f -o -type l \) -print0 |
xargs -IF basename F | xargs -IF basename F |
awk '{printf "%s\t^ 0 ^ $XDG_CONFIG_HOME/sxmo/userscripts/%s \n", $0, $0}' | awk "{printf \"$icon_itm %s ^ 0 ^ $XDG_CONFIG_HOME/sxmo/userscripts/%s \\n\", \$0, \$0}" |
sort -f sort -f
) )
$CHOICES $CHOICES
Edit Userscripts ^ 0 ^ sxmo_files.sh $XDG_CONFIG_HOME/sxmo/userscripts $icon_cfg Edit Userscripts ^ 0 ^ sxmo_files.sh $XDG_CONFIG_HOME/sxmo/userscripts
" "
fi fi
WINNAME=Scripts WINNAME=Scripts
@ -48,144 +52,144 @@ programchoicesinit() {
CHOICES=$("$XDG_CONFIG_HOME/sxmo/hooks/apps") CHOICES=$("$XDG_CONFIG_HOME/sxmo/hooks/apps")
else else
CHOICES=" CHOICES="
$(command -v aerc >/dev/null && echo 'Aerc ^ 0 ^ st -e aerc') $(command -v aerc >/dev/null && echo "$icon_eml Aerc ^ 0 ^ st -e aerc")
$(command -v alpine >/dev/null && echo 'Alpine ^ 0 ^ st -e alpine') $(command -v alpine >/dev/null && echo "$icon_eml Alpine ^ 0 ^ st -e alpine")
$(command -v calcurse >/dev/null && echo 'Calcurse ^ 0 ^ st -e calcurse') $(command -v calcurse >/dev/null && echo "$icon_clk Calcurse ^ 0 ^ st -e calcurse")
$(command -v cmus >/dev/null && echo 'Cmus ^ 0 ^ st -e cmus') $(command -v cmus >/dev/null && echo "$icon_mus Cmus ^ 0 ^ st -e cmus")
$(command -v dino >/dev/null && echo 'Dino ^ 0 ^ GDK_SCALE=2 dino') $(command -v dino >/dev/null && echo "$icon_clk Dino ^ 0 ^ GDK_SCALE=2 dino")
$(command -v emacs >/dev/null && echo 'Emacs ^ 0 ^ st -e emacs') $(command -v emacs >/dev/null && echo "$icon_edt Emacs ^ 0 ^ st -e emacs")
$(command -v epiphany >/dev/null && echo 'Epiphany ^ 0 ^ epiphany') $(command -v epiphany >/dev/null && echo "$icon_glb Epiphany ^ 0 ^ epiphany")
$(command -v firefox >/dev/null && echo 'Firefox ^ 0 ^ firefox') $(command -v firefox >/dev/null && echo "$icon_ffx Firefox ^ 0 ^ firefox")
$(command -v foxtrotgps >/dev/null && echo 'Foxtrotgps ^ 0 ^ foxtrotgps') $(command -v foxtrotgps >/dev/null && echo "$icon_gps Foxtrotgps ^ 0 ^ foxtrotgps")
$(command -v geany >/dev/null && echo 'Geany ^ 0 ^ geany') $(command -v geany >/dev/null && echo "$icon_eml Geany ^ 0 ^ geany")
$(command -v gedit >/dev/null && echo 'Gedit ^ 0 ^ gedit') $(command -v gedit >/dev/null && echo "$icon_edt Gedit ^ 0 ^ gedit")
$(command -v geeqie >/dev/null && echo 'Geeqie ^ 0 ^ geeqie') $(command -v geeqie >/dev/null && echo "$icon_img Geeqie ^ 0 ^ geeqie")
$(command -v htop >/dev/null && echo 'Htop ^ 0 ^ st -e htop') $(command -v htop >/dev/null && echo "$icon_cfg Htop ^ 0 ^ st -e htop")
$(command -v irssi >/dev/null && echo 'Irssi ^ 0 ^ st -e irssi') $(command -v irssi >/dev/null && echo "$icon_msg Irssi ^ 0 ^ st -e irssi")
$(command -v ii >/dev/null && echo 'Ii ^ 0 ^ st -e ii') $(command -v ii >/dev/null && echo "$icon_msg Ii ^ 0 ^ st -e ii")
$(command -v ipython >/dev/null && echo 'IPython ^ 0 ^ st -e ipython') $(command -v ipython >/dev/null && echo "$icon_trm IPython ^ 0 ^ st -e ipython")
$(command -v lf >/dev/null && echo 'Lf ^ 0 ^ st -e lf') $(command -v lf >/dev/null && echo "$icon_dir Lf ^ 0 ^ st -e lf")
$(command -v midori >/dev/null && echo 'Midori ^ 0 ^ midori') $(command -v midori >/dev/null && echo "$icon_glb Midori ^ 0 ^ midori")
$(command -v mutt >/dev/null && echo 'Mutt ^ 0 ^ st -e mutt') $(command -v mutt >/dev/null && echo "$icon_eml Mutt ^ 0 ^ st -e mutt")
$(command -v nano >/dev/null && echo 'Nano ^ 0 ^ st -e nano') $(command -v nano >/dev/null && echo "$icon_edt Nano ^ 0 ^ st -e nano")
$(command -v ncmpcpp >/dev/null && echo 'Ncmpcpp ^ 0 ^ st -e ncmpcpp') $(command -v ncmpcpp >/dev/null && echo "$icon_mus Ncmpcpp ^ 0 ^ st -e ncmpcpp")
$(command -v neomutt >/dev/null && echo 'Neomutt ^ 0 ^ st -e neomutt') $(command -v neomutt >/dev/null && echo "$icon_eml Neomutt ^ 0 ^ st -e neomutt")
$(command -v neovim >/dev/null && echo 'Neovim ^ 0 ^ st -e neovim') $(command -v neovim >/dev/null && echo "$icon_vim Neovim ^ 0 ^ st -e neovim")
$(command -v netsurf >/dev/null && echo 'Netsurf ^ 0 ^ netsurf') $(command -v netsurf >/dev/null && echo "$icon_glb Netsurf ^ 0 ^ netsurf")
$(command -v newsboat >/dev/null && echo 'Newsboat ^ 0 ^ st -e newsboat') $(command -v newsboat >/dev/null && echo "$icon_rss Newsboat ^ 0 ^ st -e newsboat")
$(command -v nnn >/dev/null && echo 'Nnn ^ 0 ^ st -e nnn') $(command -v nnn >/dev/null && echo "$icon_dir Nnn ^ 0 ^ st -e nnn")
$(command -v pidgin >/dev/null && echo 'Pidgin ^ 0 ^ pidgin') $(command -v pidgin >/dev/null && echo "$icon_msg Pidgin ^ 0 ^ pidgin")
$(command -v ranger >/dev/null && echo 'Ranger ^ 0 ^ st -e ranger') $(command -v ranger >/dev/null && echo "$icon_dir Ranger ^ 0 ^ st -e ranger")
$(command -v sacc >/dev/null && echo 'Sacc ^ 0 ^ st -e sacc i-logout.cz/1/bongusta') $(command -v sacc >/dev/null && echo "$icon_itm Sacc ^ 0 ^ st -e sacc i-logout.cz/1/bongusta")
$(command -v sic >/dev/null && echo 'Sic ^ 0 ^ st -e sic') $(command -v sic >/dev/null && echo "$icon_itm Sic ^ 0 ^ st -e sic")
$(command -v st >/dev/null && echo "St ^ 0 ^ st -e $SHELL -l") $(command -v st >/dev/null && echo "$icon_trm St ^ 0 ^ st -e $SHELL -l")
$(command -v surf >/dev/null && echo 'Surf ^ 0 ^ surf') $(command -v surf >/dev/null && echo "$icon_glb Surf ^ 0 ^ surf")
$(command -v syncthing >/dev/null && echo 'Syncthing ^ 0 ^ syncthing') $(command -v syncthing >/dev/null && echo "$icon_rld Syncthing ^ 0 ^ syncthing")
$(command -v telegram-desktop >/dev/null && echo 'Telegram ^ 0 ^ telegram-desktop') $(command -v telegram-desktop >/dev/null && echo "$icon_tgm Telegram ^ 0 ^ telegram-desktop")
$(command -v thunar >/dev/null && echo 'Thunar ^ 0 ^ st -e thunar') $(command -v thunar >/dev/null && echo "$icon_dir Thunar ^ 0 ^ st -e thunar")
$(command -v thunderbird >/dev/null && echo 'Thunderbird ^ 0 ^ thunderbird') $(command -v thunderbird >/dev/null && echo "$icon_eml Thunderbird ^ 0 ^ thunderbird")
$(command -v totem >/dev/null && echo 'Totem ^ 0 ^ st -e totem') $(command -v totem >/dev/null && echo "$icon_mvi Totem ^ 0 ^ st -e totem")
$(command -v tuir >/dev/null && echo 'Tuir ^ 0 ^ st -e tuir') $(command -v tuir >/dev/null && echo "$icon_red Tuir ^ 0 ^ st -e tuir")
$(command -v weechat >/dev/null && echo 'Weechat ^ 0 ^ st -e weechat') $(command -v weechat >/dev/null && echo "$icon_msg Weechat ^ 0 ^ st -e weechat")
$(command -v w3m >/dev/null && echo 'W3m ^ 0 ^ st -e w3m duck.com') $(command -v w3m >/dev/null && echo "$icon_glb W3m ^ 0 ^ st -e w3m duck.com")
$(command -v vim >/dev/null && echo 'Vim ^ 0 ^ st -e vim') $(command -v vim >/dev/null && echo "$icon_vim Vim ^ 0 ^ st -e vim")
$(command -v vis >/dev/null && echo 'Vis ^ 0 ^ st -e vis') $(command -v vis >/dev/null && echo "$icon_vim Vis ^ 0 ^ st -e vis")
$(command -v vlc >/dev/null && echo 'Vlc ^ 0 ^ vlc') $(command -v vlc >/dev/null && echo "$icon_mvi Vlc ^ 0 ^ vlc")
$(command -v xcalc >/dev/null && echo 'Xcalc ^ 0 ^ xcalc') $(command -v xcalc >/dev/null && echo "$icon_clc Xcalc ^ 0 ^ xcalc")
" "
fi fi
WINNAME=Apps WINNAME=Apps
elif echo "$WMCLASS" | grep -i "config"; then elif echo "$WMCLASS" | grep -i "config"; then
# System Control menu # System Control menu
CHOICES=" CHOICES="
Brightness ^ 1 ^ sxmo_brightness.sh up $icon_aru Brightness ^ 1 ^ sxmo_brightness.sh up
Brightness ^ 1 ^ sxmo_brightness.sh down $icon_ard Brightness ^ 1 ^ sxmo_brightness.sh down
Modem Toggle ^ 1 ^ sxmo_modemmonitortoggle.sh $icon_phn Modem Toggle ^ 1 ^ sxmo_modemmonitortoggle.sh
Modem Info ^ 0 ^ sxmo_modeminfo.sh $icon_inf Modem Info ^ 0 ^ sxmo_modeminfo.sh
Modem Log ^ 0 ^ sxmo_modemlog.sh $icon_phl Modem Log ^ 0 ^ sxmo_modemlog.sh
Flash $( $icon_fll Flashlight $(
grep -qE '^0$' /sys/class/leds/white:flash/brightness && grep -qE '^0$' /sys/class/leds/white:flash/brightness &&
printf %b "Off → On" || printf %b "On → Off"; printf %b "Off → On" || printf %b "On → Off";
printf %b "^ 1 ^ sxmo_flashtoggle.sh" printf %b "^ 1 ^ sxmo_flashtoggle.sh"
) )
Bar Toggle ^ 1 ^ key Alt+b $icon_cfg Bar Toggle ^ 1 ^ key Alt+b
Invert Colors ^ 1 ^ xcalib -a -invert $icon_cfg Invert Colors ^ 1 ^ xcalib -a -invert
Change Timezone ^ 1 ^ sxmo_timezonechange.sh $icon_clk Change Timezone ^ 1 ^ sxmo_timezonechange.sh
Autorotate $( $icon_ror Autorotate $(
pgrep -f "$(command -v sxmo_rotateautotoggle.sh)" > /dev/null && pgrep -f "$(command -v sxmo_rotateautotoggle.sh)" > /dev/null &&
printf %b "On → Off ^ 0 ^ sxmo_rotateautotoggle.sh &" || printf %b "Off → On ^ 0 ^ sxmo_rotateautotoggle.sh &" printf %b "On → Off ^ 0 ^ sxmo_rotateautotoggle.sh &" || printf %b "Off → On ^ 0 ^ sxmo_rotateautotoggle.sh &"
) )
Rotate ^ 1 ^ sxmo_rotate.sh rotate $icon_ror Rotate ^ 1 ^ sxmo_rotate.sh rotate
Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh $icon_upc Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh
" "
WINNAME=Config WINNAME=Config
elif echo "$WMCLASS" | grep -i "audioout"; then elif echo "$WMCLASS" | grep -i "audioout"; then
# Audio Out menu # Audio Out menu
CURRENTDEV="$(sxmo_audiocurrentdevice.sh)" CURRENTDEV="$(sxmo_audiocurrentdevice.sh)"
CHOICES=" CHOICES="
Headphones $([ "$CURRENTDEV" = "Headphone" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Headphones $icon_hdp Headphones $([ "$CURRENTDEV" = "Headphone" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Headphones
Speaker $([ "$CURRENTDEV" = "Line Out" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Speaker $icon_spk Speaker $([ "$CURRENTDEV" = "Line Out" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Speaker
Earpiece $([ "$CURRENTDEV" = "Earpiece" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Earpiece $icon_phn Earpiece $([ "$CURRENTDEV" = "Earpiece" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Earpiece
None $([ "$CURRENTDEV" = "None" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh None $icon_mut None $([ "$CURRENTDEV" = "None" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh None
Volume ↑ ^ 1 ^ sxmo_vol.sh up $icon_aru Volume up ^ 1 ^ sxmo_vol.sh up
Volume ↓ ^ 1 ^ sxmo_vol.sh down $icon_ard Volume down ^ 1 ^ sxmo_vol.sh down
" "
WINNAME="Audio" WINNAME="Audio"
elif echo "$WMCLASS" | grep -i "power"; then elif echo "$WMCLASS" | grep -i "power"; then
# Power menu # Power menu
CHOICES=" CHOICES="
Lock ^ 0 ^ sxmo_lock.sh $icon_lck Lock ^ 0 ^ sxmo_lock.sh
Lock (Screen off) ^ 0 ^ sxmo_lock.sh --screen-off $icon_lck Lock (Screen off) ^ 0 ^ sxmo_lock.sh --screen-off
Suspend ^ 0 ^ sxmo_lock.sh --suspend $icon_zzz Suspend ^ 0 ^ sxmo_lock.sh --suspend
Logout ^ 0 ^ pkill -9 dwm $icon_out Logout ^ 0 ^ pkill -9 dwm
Reboot ^ 0 ^ st -e sudo reboot $icon_rld Reboot ^ 0 ^ st -e sudo reboot
Poweroff ^ 0 ^ st -e sudo halt $icon_pwr Poweroff ^ 0 ^ st -e sudo halt
" "
WINNAME="Power" WINNAME="Power"
elif echo "$WMCLASS" | grep -i "mpv"; then elif echo "$WMCLASS" | grep -i "mpv"; then
# MPV # MPV
CHOICES=" CHOICES="
Pause ^ 0 ^ key space $icon_pau Pause ^ 0 ^ key space
Seek ^ 1 ^ key Left $icon_fbw Seek ^ 1 ^ key Left
Seek ^ 1 ^ key Right $icon_ffw Seek ^ 1 ^ key Right
App Volume ↑ ^ 1 ^ key 0 $icon_aru App Volume ↑ ^ 1 ^ key 0
App Volume ↓ ^ 1 ^ key 9 $icon_ard App Volume ↓ ^ 1 ^ key 9
Speed ↑ ^ 1 ^ key bracketright $icon_aru Speed up ^ 1 ^ key bracketright
Speed ↓ ^ 1 ^ key bracketleft $icon_ard Speed down ^ 1 ^ key bracketleft
Screenshot ^ 1 ^ key s $icon_cam Screenshot ^ 1 ^ key s
Loopmark ^ 1 ^ key l $icon_itm Loopmark ^ 1 ^ key l
Info ^ 1 ^ key i $icon_inf Info ^ 1 ^ key i
Seek Info ^ 1 ^ key o $icon_inf Seek Info ^ 1 ^ key o
" "
WINNAME=Mpv && return WINNAME=Mpv && return
elif echo "$WMCLASS" | grep -i "feh"; then elif echo "$WMCLASS" | grep -i "feh"; then
# Feh # Feh
CHOICES=" CHOICES="
Next ^ 1 ^ key space $icon_arr Next ^ 1 ^ key space
Previous ^ 1 ^ key BackSpace $icon_arl Previous ^ 1 ^ key BackSpace
Zoom + ^ 1 ^ key up $icon_zmi Zoom in ^ 1 ^ key up
Zoom - ^ 1 ^ key down $icon_zmo Zoom out ^ 1 ^ key down
Zoom to fit ^ 1 ^ key slash $icon_exp Zoom to fit ^ 1 ^ key slash
Zoom to fill ^ 1 ^ key exlam $icon_shr Zoom to fill ^ 1 ^ key exlam
Rotate ^ 1 ^ key less $icon_rol Rotate ^ 1 ^ key less
Rotate ^ 1 ^ key greater $icon_ror Rotate ^ 1 ^ key greater
Flip ⇅ ^ 1 ^ key underscore $icon_a2y Flip ^ 1 ^ key underscore
Mirror ^ 1 ^ key bar $icon_a2x Mirror ^ 1 ^ key bar
Toggle filename ^ 1 ^ key d $icon_inf Toggle filename ^ 1 ^ key d
" "
WINNAME=Feh && return WINNAME=Feh && return
elif echo "$WMCLASS" | grep -i "sxiv"; then elif echo "$WMCLASS" | grep -i "sxiv"; then
# Sxiv # Sxiv
CHOICES=" CHOICES="
Next ^ 1 ^ key space $icon_arr Next ^ 1 ^ key space
Previous ^ 1 ^ key BackSpace $icon_arl Previous ^ 1 ^ key BackSpace
Zoom + ^ 1 ^ key equal $icon_zmi Zoom in ^ 1 ^ key equal
Zoom - ^ 1 ^ key minus $icon_zmo Zoom out ^ 1 ^ key minus
Rotate ^ 1 ^ key less $icon_rol Rotate ^ 1 ^ key less
Rotate ^ 1 ^ key greater $icon_ror Rotate ^ 1 ^ key greater
Flip ⇄ ^ 1 ^ key question $icon_a2y Flip ^ 1 ^ key question
Flip ⇅ ^ 1 ^ key bar $icon_a2x Mirror ^ 1 ^ key bar
Thumbnail ^ 0 ^ key Return $icon_grd Thumbnail ^ 0 ^ key Return
" "
WINNAME=Sxiv && return WINNAME=Sxiv && return
elif echo "$WMCLASS" | grep -i "st-256color"; then elif echo "$WMCLASS" | grep -i "st-256color"; then
@ -195,82 +199,82 @@ programchoicesinit() {
if echo "$WMNAME" | grep -i -E "\"(vi|vim|vis|nvim|neovim)\""; then if echo "$WMNAME" | grep -i -E "\"(vi|vim|vis|nvim|neovim)\""; then
#Vim in st #Vim in st
CHOICES=" CHOICES="
Scroll ↑ ^ 1 ^ key Ctrl+Shift+u $icon_aru Scroll up ^ 1 ^ key Ctrl+Shift+u
Scroll ↓ ^ 1 ^ key Ctrl+Shift+d $icon_ard Scroll down ^ 1 ^ key Ctrl+Shift+d
Command prompt ^ 0 ^ key Escape Shift+semicolon $icon_trm Command prompt ^ 0 ^ key Escape Shift+semicolon
Save ^ 0 ^ key Escape Shift+semicolon w Return $icon_cls Save ^ 0 ^ key Escape Shift+semicolon w Return
Quit ^ 0 ^ key Escape Shift+semicolon q Return $icon_cls Quit ^ 0 ^ key Escape Shift+semicolon q Return
Paste Selection ^ 0 ^ key Escape quotedbl asterisk p $icon_pst Paste Selection ^ 0 ^ key Escape quotedbl asterisk p
Paste Clipboard ^ 0 ^ key Escape quotedbl plus p $icon_pst Paste Clipboard ^ 0 ^ key Escape quotedbl plus p
Search ^ 0 ^ key Escape / $icon_fnd Search ^ 0 ^ key Escape /
Zoom + ^ 1 ^ key Ctrl+Shift+Prior $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior
Zoom - ^ 1 ^ key Ctrl+Shift+Next $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next
St menu ^ 0 ^ sxmo_appmenu.sh st-256color $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color
" "
WINNAME=Vim WINNAME=Vim
elif echo "$WMNAME" | grep -i -w "nano"; then elif echo "$WMNAME" | grep -i -w "nano"; then
#Nano in st #Nano in st
CHOICES=" CHOICES="
Scroll ↑ ^ 1 ^ key Prior $icon_aru Scroll up ^ 1 ^ key Prior
Scroll ↓ ^ 1 ^ key Next $icon_ard Scroll down ^ 1 ^ key Next
Save ^ 0 ^ key Ctrl+O $icon_sav Save ^ 0 ^ key Ctrl+O
Quit ^ 0 ^ key Ctrl+X $icon_cls Quit ^ 0 ^ key Ctrl+X
Paste ^ 0 ^ key Ctrl+U $icon_pst Paste ^ 0 ^ key Ctrl+U
Type complete ^ 0 ^ key Ctrl+Shift+u $icon_itm Type complete ^ 0 ^ key Ctrl+Shift+u
Copy complete ^ 0 ^ key Ctrl+Shift+i $icon_cpy Copy complete ^ 0 ^ key Ctrl+Shift+i
Zoom + ^ 1 ^ key Ctrl+Shift+Prior $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior
Zoom - ^ 1 ^ key Ctrl+Shift+Next $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next
St menu ^ 0 ^ sxmo_appmenu.sh st-256color $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color
" "
WINNAME=Nano WINNAME=Nano
elif echo "$WMNAME" | grep -i -w "tuir"; then elif echo "$WMNAME" | grep -i -w "tuir"; then
#tuir (reddit client) in st #tuir (reddit client) in st
CHOICES=" CHOICES="
Previous ^ 1 ^ key k $icon_aru Previous ^ 1 ^ key k
Next ^ 1 ^ key j $icon_ard Next ^ 1 ^ key j
Scroll ↑ ^ 1 ^ key Prior $icon_aru Scroll up ^ 1 ^ key Prior
Scroll ↓ ^ 1 ^ key Next $icon_ard Scroll down ^ 1 ^ key Next
Open ^ 0 ^ key o $icon_ret Open ^ 0 ^ key o
Back ^ 0 ^ key h $icon_arl Back ^ 0 ^ key h
Comments ^ 0 ^ key l $icon_arr Comments ^ 0 ^ key l
Post ^ 0 ^ key c $icon_edt Post ^ 0 ^ key c
Refresh ^ 0 ^ key r $icon_rld Refresh ^ 0 ^ key r
Quit ^ 0 ^ key q $icon_cls Quit ^ 0 ^ key q
Zoom + ^ 1 ^ key Ctrl+Shift+Prior $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior
Zoom - ^ 1 ^ key Ctrl+Shift+Next $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next
St menu ^ 0 ^ sxmo_appmenu.sh st-256color $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color
" "
WINNAME=tuir WINNAME=tuir
elif echo "$WMNAME" | grep -i -w "w3m"; then elif echo "$WMNAME" | grep -i -w "w3m"; then
#w3m #w3m
CHOICES=" CHOICES="
Back ^ 1 ^ key B $icon_arl Back ^ 1 ^ key B
Goto URL ^ 1 ^ key U $icon_glb Goto URL ^ 1 ^ key U
Next Link ^ 1 ^ key Tab $icon_arr Next Link ^ 1 ^ key Tab
Previous Link ^ 1 ^ key Shift+Tab $icon_arl Previous Link ^ 1 ^ key Shift+Tab
Open tab ^ 0 ^ key T $icon_tab Open tab ^ 0 ^ key T
Close tab ^ 0 ^ Ctrl+q $icon_cls Close tab ^ 0 ^ Ctrl+q
Next tab ^ 1 ^ key braceright $icon_itm Next tab ^ 1 ^ key braceright
Previous tab ^ 1 ^ key braceleft $icon_itm Previous tab ^ 1 ^ key braceleft
Zoom + ^ 1 ^ key Ctrl+Shift+Prior $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior
Zoom - ^ 1 ^ key Ctrl+Shift+Next $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next
St menu ^ 0 ^ sxmo_appmenu.sh st-256color $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color
" "
WINNAME=w3m WINNAME=w3m
elif echo "$WMNAME" | grep -i -w "ncmpcpp"; then elif echo "$WMNAME" | grep -i -w "ncmpcpp"; then
#ncmpcpp #ncmpcpp
CHOICES=" CHOICES="
Playlist ^ 0 ^ key 1 $icon_lst Playlist ^ 0 ^ key 1
Browser ^ 0 ^ key 2 $icon_fnd Browser ^ 0 ^ key 2
Search ^ 0 ^ key 2 $icon_fnd Search ^ 0 ^ key 3
Next track ^ 0 ^ key greater $icon_nxt Next track ^ 0 ^ key greater
Previous track ^ 0 ^ key less $icon_prv Previous track ^ 0 ^ key less
Pause ^ 0 ^ key p $icon_pau Pause ^ 0 ^ key p
Stop ^ 0 ^ key s $icon_stp Stop ^ 0 ^ key s
Toggle repeat ^ 0 ^ key r $icon_rld Toggle repeat ^ 0 ^ key r
Toggle random ^ 0 ^ key z $icon_sfl Toggle random ^ 0 ^ key z
Toggle consume ^ 0 ^ key R $icon_itm Toggle consume ^ 0 ^ key R
St menu ^ 0 ^ sxmo_appmenu.sh st-256color $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color
" "
WINNAME=ncmpcpp WINNAME=ncmpcpp
else else
@ -278,22 +282,22 @@ programchoicesinit() {
echo "$XPROPOUT" | grep -E '^_ST_SELMODE.+=' | cut -d= -f2 | tr -d ' ' echo "$XPROPOUT" | grep -E '^_ST_SELMODE.+=' | cut -d= -f2 | tr -d ' '
)" )"
CHOICES=" CHOICES="
Type complete ^ 0 ^ key Ctrl+Shift+u $icon_itm Type complete ^ 0 ^ key Ctrl+Shift+u
Copy complete ^ 0 ^ key Ctrl+Shift+i $icon_cpy Copy complete ^ 0 ^ key Ctrl+Shift+i
Selmode $( $icon_itm Selmode $(
[ "$STSELMODEON" = 1 ] && [ "$STSELMODEON" = 1 ] &&
printf %b 'On → Off' || printf %b 'On → Off' ||
printf %b 'Off → On' printf %b 'Off → On'
printf %b '^ 0 ^ key Ctrl+Shift+s' printf %b '^ 0 ^ key Ctrl+Shift+s'
) )
$([ "$STSELMODEON" = 1 ] && echo 'Copy selection ^ 0 ^ key Ctrl+Shift+c') $([ "$STSELMODEON" = 1 ] && echo 'Copy selection ^ 0 ^ key Ctrl+Shift+c')
Paste ^ 0 ^ key Ctrl+Shift+v $icon_pst Paste ^ 0 ^ key Ctrl+Shift+v
Zoom + ^ 1 ^ key Ctrl+Shift+Prior $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior
Zoom - ^ 1 ^ key Ctrl+Shift+Next $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next
Scroll ↑ ^ 1 ^ key Ctrl+Shift+b $icon_aru Scroll up ^ 1 ^ key Ctrl+Shift+b
Scroll ↓ ^ 1 ^ key Ctrl+Shift+f $icon_ard Scroll down ^ 1 ^ key Ctrl+Shift+f
Invert ^ 1 ^ key Ctrl+Shift+x $icon_a2x Invert ^ 1 ^ key Ctrl+Shift+x
Hotkeys ^ 0 ^ sxmo_appmenu.sh sthotkeys $icon_kbd Hotkeys ^ 0 ^ sxmo_appmenu.sh sthotkeys
" "
WINNAME=St WINNAME=St
fi fi
@ -311,75 +315,75 @@ programchoicesinit() {
elif echo "$WMCLASS" | grep -i netsurf; then elif echo "$WMCLASS" | grep -i netsurf; then
# Netsurf # Netsurf
CHOICES=" CHOICES="
Pipe URL ^ 0 ^ sxmo_urlhandler.sh $icon_flt Pipe URL ^ 0 ^ sxmo_urlhandler.sh
Zoom + ^ 1 ^ key Ctrl+plus $icon_zmi Zoom ^ 1 ^ key Ctrl+plus
Zoom - ^ 1 ^ key Ctrl+minus $icon_zmo Zoom ^ 1 ^ key Ctrl+minus
History ^ 1 ^ key Alt+Left $icon_arl History ^ 1 ^ key Alt+Left
History ^ 1 ^ key Alt+Right $icon_arr History ^ 1 ^ key Alt+Right
" "
WINNAME=Netsurf WINNAME=Netsurf
elif echo "$WMCLASS" | grep surf; then elif echo "$WMCLASS" | grep surf; then
# Surf # Surf
CHOICES=" CHOICES="
Navigate ^ 0 ^ key Ctrl+g $icon_glb Navigate ^ 0 ^ key Ctrl+g
Link Menu ^ 0 ^ key Ctrl+d $icon_lnk Link Menu ^ 0 ^ key Ctrl+d
Pipe URL ^ 0 ^ sxmo_urlhandler.sh $icon_flt Pipe URL ^ 0 ^ sxmo_urlhandler.sh
Search Page ^ 0 ^ key Ctrl+f $icon_fnd Search Page ^ 0 ^ key Ctrl+f
Find Next ^ 0 ^ key Ctrl+n $icon_fnd Find Next ^ 0 ^ key Ctrl+n
Zoom + ^ 1 ^ key Ctrl+Shift+k $icon_zmi Zoom ^ 1 ^ key Ctrl+Shift+k
Zoom - ^ 1 ^ key Ctrl+Shift+j $icon_zmo Zoom ^ 1 ^ key Ctrl+Shift+j
Scroll ^ 1 ^ key Shift+space $icon_aru Scroll ^ 1 ^ key Shift+space
Scroll ^ 1 ^ key space $icon_ard Scroll ^ 1 ^ key space
JS Toggle ^ 1 ^ key Ctrl+Shift+s $icon_itm JS Toggle ^ 1 ^ key Ctrl+Shift+s
History ^ 1 ^ key Ctrl+h $icon_arl History ^ 1 ^ key Ctrl+h
History ^ 1 ^ key Ctrl+l $icon_arr History ^ 1 ^ key Ctrl+l
Refresh ^ 0 ^ key Ctrl+Shift+r $icon_rld Refresh ^ 0 ^ key Ctrl+Shift+r
" "
WINNAME=Surf WINNAME=Surf
elif echo "$WMCLASS" | grep -i firefox; then elif echo "$WMCLASS" | grep -i firefox; then
# Firefox # Firefox
CHOICES=" CHOICES="
Pipe URL ^ 0 ^ sxmo_urlhandler.sh $icon_flt Pipe URL ^ 0 ^ sxmo_urlhandler.sh
New Tab ^ 0 ^ key Ctrl+t $icon_tab New Tab ^ 0 ^ key Ctrl+t
New Window ^ 0 ^ key Ctrl+n $icon_win New Window ^ 0 ^ key Ctrl+n
Zoom + ^ 1 ^ key Ctrl+plus $icon_zmi Zoom ^ 1 ^ key Ctrl+plus
Zoom - ^ 1 ^ key Ctrl+minus $icon_zmo Zoom ^ 1 ^ key Ctrl+minus
History ^ 1 ^ key Alt+Left $icon_arl History ^ 1 ^ key Alt+Left
History ^ 1 ^ key Alt+Right $icon_arr History ^ 1 ^ key Alt+Right
Refresh ^ 0 ^ key Ctrl+Shift+r $icon_rld Refresh ^ 0 ^ key Ctrl+Shift+r
" "
WINNAME=Firefox WINNAME=Firefox
elif echo "$WMCLASS" | grep -i foxtrot; then elif echo "$WMCLASS" | grep -i foxtrot; then
# Foxtrot GPS # Foxtrot GPS
CHOICES=' CHOICES="
Locations ^ 0 ^ sxmo_gpsutil.sh menulocations $icon_itm Locations ^ 0 ^ sxmo_gpsutil.sh menulocations
Copy ^ 1 ^ sxmo_gpsutil.sh copy $icon_cpy Copy ^ 1 ^ sxmo_gpsutil.sh copy
Paste ^ 0 ^ sxmo_gpsutil.sh paste $icon_pst Paste ^ 0 ^ sxmo_gpsutil.sh paste
Drop Pin ^ 0 ^ sxmo_gpsutil.sh droppin $icon_itm Drop Pin ^ 0 ^ sxmo_gpsutil.sh droppin
Region Search ^ 0 ^ sxmo_gpsutil.sh menuregionsearch $icon_fnd Region Search ^ 0 ^ sxmo_gpsutil.sh menuregionsearch
Region Details ^ 0 ^ sxmo_gpsutil.sh details $icon_itm Region Details ^ 0 ^ sxmo_gpsutil.sh details
Zoom + ^ 1 ^ key i $icon_zmi Zoom ^ 1 ^ key i
Zoom - ^ 1 ^ key o $icon_zmo Zoom ^ 1 ^ key o
Map Type ^ 0 ^ sxmo_gpsutil.sh menumaptype $icon_itm Map Type ^ 0 ^ sxmo_gpsutil.sh menumaptype
Panel Toggle ^ 1 ^ key m $icon_itm Panel Toggle ^ 1 ^ key m
GPSD Toggle ^ 1 ^ key a $icon_itm GPSD Toggle ^ 1 ^ key a
Locate Me ^ 0 ^ sxmo_gpsutil.sh gpsgeoclueset $icon_usr Locate Me ^ 0 ^ sxmo_gpsutil.sh gpsgeoclueset
' "
WINNAME=Maps WINNAME=Maps
else else
# Default system menu (no matches) # Default system menu (no matches)
CHOICES=" CHOICES="
Scripts ^ 0 ^ sxmo_appmenu.sh scripts $icon_grd Scripts ^ 0 ^ sxmo_appmenu.sh scripts
Apps ^ 0 ^ sxmo_appmenu.sh applications $icon_grd Apps ^ 0 ^ sxmo_appmenu.sh applications
Files ^ 0 ^ sxmo_files.sh $icon_dir Files ^ 0 ^ sxmo_files.sh
$(command -v foxtrotgps >/dev/null && echo 'Maps ^ 0 ^ foxtrotgps') $(command -v foxtrotgps >/dev/null && echo "$icon_gps Maps ^ 0 ^ foxtrotgps")
Dialer ^ 0 ^ sxmo_modemdial.sh $icon_phn Dialer ^ 0 ^ sxmo_modemdial.sh
Texts ^ 0 ^ sxmo_modemtext.sh $icon_msg Texts ^ 0 ^ sxmo_modemtext.sh
$(command -v megapixels >/dev/null && echo 'Camera ^ 0 ^ GDK_SCALE=2 megapixels') $(command -v megapixels >/dev/null && echo "$icon_cam Camera ^ 0 ^ GDK_SCALE=2 megapixels")
Networks ^ 0 ^ sxmo_networks.sh $icon_net Networks ^ 0 ^ sxmo_networks.sh
Audio ^ 0 ^ sxmo_appmenu.sh audioout $icon_mus Audio ^ 0 ^ sxmo_appmenu.sh audioout
Config ^ 0 ^ sxmo_appmenu.sh config $icon_cfg Config ^ 0 ^ sxmo_appmenu.sh config
Power ^ 0 ^ sxmo_appmenu.sh power $icon_pwr Power ^ 0 ^ sxmo_appmenu.sh power
" "
WINNAME=Sys WINNAME=Sys
fi fi
@ -395,7 +399,7 @@ getprogchoices() {
NNOTIFICATIONS="$(find "$NOTIFDIR" -type f | wc -l)" NNOTIFICATIONS="$(find "$NOTIFDIR" -type f | wc -l)"
if [ "$NNOTIFICATIONS" -gt 0 ]; then if [ "$NNOTIFICATIONS" -gt 0 ]; then
CHOICES=" CHOICES="
Notifications ($NNOTIFICATIONS) ^ 0 ^ sxmo_notificationsmenu.sh $icon_bel Notifications ($NNOTIFICATIONS) ^ 0 ^ sxmo_notificationsmenu.sh
$CHOICES $CHOICES
" "
fi fi
@ -405,7 +409,7 @@ getprogchoices() {
for NOTIFFILE in $(find "$NOTIFDIR" -name 'incomingcall*'); do for NOTIFFILE in $(find "$NOTIFDIR" -name 'incomingcall*'); do
NOTIFACTION="$(head -n1 "$NOTIFFILE")" NOTIFACTION="$(head -n1 "$NOTIFFILE")"
CHOICES=" CHOICES="
Pick up incoming call ^ 0 ^ $NOTIFACTION $icon_phn Pick up incoming call ^ 0 ^ $NOTIFACTION
$CHOICES $CHOICES
" "
break break
@ -414,13 +418,13 @@ getprogchoices() {
# Decorate menu at bottom w/ system menu entry if not system menu # Decorate menu at bottom w/ system menu entry if not system menu
echo $WINNAME | grep -v Sys && CHOICES=" echo $WINNAME | grep -v Sys && CHOICES="
$CHOICES $CHOICES
System Menu ^ 0 ^ sxmo_appmenu.sh sys $icon_mnu System Menu ^ 0 ^ sxmo_appmenu.sh sys
" "
# Decorate menu at bottom w/ close menu entry # Decorate menu at bottom w/ close menu entry
CHOICES=" CHOICES="
$CHOICES $CHOICES
Close Menu ^ 0 ^ quit $icon_cls Close Menu ^ 0 ^ quit
" "
PROGCHOICES="$(echo "$CHOICES" | xargs -0 echo | sed '/^[[:space:]]*$/d' | awk '{$1=$1};1')" PROGCHOICES="$(echo "$CHOICES" | xargs -0 echo | sed '/^[[:space:]]*$/d' | awk '{$1=$1};1')"

@ -0,0 +1,96 @@
#this script is meant to be sourced
#the glyphs are often in the private use area and
#therefore require a font like those in https://github.com/ryanoasis/nerd-fonts/ for proper display
if [ -z "$SXMO_NO_ICONS" ] || [ "$SXMO_NO_ICONS" -eq 0 ]; then
icon_itm="" #item (default)
icon_trm='' #terminal
icon_vim=''
icon_tgm='' #telegram
icon_gps='' #gps
icon_msg="" #text
icon_pwr="⏻" #power
icon_cfg="" #configuration cog
icon_cls="" #close
icon_phn="" #phone
icon_dir="" #directory folder
icon_fil="" #file
icon_grd=""
icon_mnu=""
icon_cam=""
icon_net=""
icon_bel=""
icon_mic=""
icon_mmc=""
icon_mus=""
icon_mut="" #mute
icon_spk="" #speaker
icon_img=""
icon_usr=""
icon_tmr="" #timer
icon_arl=""
icon_arr=""
icon_aru=""
icon_ard=""
icon_ac1=""
icon_ac2=""
icon_ac3=""
icon_ac4=""
icon_mov=""
icon_shr="" #shrink
icon_exp="" #expand
icon_zmi=""
icon_zmo=""
icon_hom=""
icon_rld=""
icon_hdp="" #headphones
icon_lck=""
icon_rss=""
icon_lnk=""
icon_cpy=""
icon_pst=""
icon_fnd="" #search/find
icon_win="" #window
icon_tab=""
icon_flt="" #filter/pipe
icon_glb="" #globe
icon_phl="'" #phonelog
icon_inf="" #info
icon_fll="" #flashlight
icon_clk=""
icon_rol="" #rotate left
icon_ror="" #rotate right
icon_upc="" #up in circle
icon_zzz="" #sleep/suspend/crust
icon_out="" #logout
icon_ytb="" #youtube
icon_wtr="" #weather
icon_red="" #reddit
icon_vid="" #video
icon_mvi="" #movie
icon_clc="" #calculator
icon_eml="" #email
icon_edt="" #editor
icon_ffx="" #firefox
icon_ffw="'" #fast forward
icon_fbw=""
icon_pau=""
icon_a2y="⇅"
icon_a2x="⇄"
icon_sav="" #save
icon_ret="" #return
icon_nxt="" #next
icon_prv="" #previous
icon_stp="" #stop
icon_sfl="" #shuffle, random
icon_lst="" #list
icon_kbd="" #keyboard
icon_del="﫧" #delete
icon_grp="" #group
icon_snd="" #send
icon_phx="" #hangup
icon_wn2=""
fi
#allow the user to override icons
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/icons" ]; then
"$XDG_CONFIG_HOME/sxmo/hooks/icons"
fi

@ -5,6 +5,10 @@ ALSASTATEFILE="$XDG_CACHE_HOME"/precall.alsa.state
CACHEDIR="$XDG_CACHE_HOME"/sxmo CACHEDIR="$XDG_CACHE_HOME"/sxmo
trap "gracefulexit" INT TERM trap "gracefulexit" INT TERM
DIR=$(dirname "$0")
# shellcheck source=./sxmo_icons.sh
. "$DIR/sxmo_icons.sh"
modem_n() { modem_n() {
MODEMS="$(mmcli -L)" MODEMS="$(mmcli -L)"
echo "$MODEMS" | grep -qoE 'Modem\/([0-9]+)' || finish "Couldn't find modem - is your modem enabled?" echo "$MODEMS" | grep -qoE 'Modem\/([0-9]+)' || finish "Couldn't find modem - is your modem enabled?"
@ -172,18 +176,18 @@ incallmonitor() {
incallmenuloop() { incallmenuloop() {
echo "sxmo_modemcall: Current flags are $FLAGS">&2 echo "sxmo_modemcall: Current flags are $FLAGS">&2
CHOICES=" CHOICES="
$([ "$WINDOWIFIED" = 0 ] && echo Windowify || echo Unwindowify) ^ togglewindowify $([ "$WINDOWIFIED" = 0 ] && echo "$icon_wn2 Windowify" || echo "$icon_wn2 Unwindowify") ^ togglewindowify
$([ "$WINDOWIFIED" = 0 ] && echo 'Screenlock ^ togglewindowify; sxmo_screenlock &') $([ "$WINDOWIFIED" = 0 ] && echo "$icon_lck Screenlock ^ togglewindowify; sxmo_screenlock &")
Volume ↑ ^ sxmo_vol.sh up $icon_aru Volume up ^ sxmo_vol.sh up
Volume ↓ ^ sxmo_vol.sh down $icon_ard Volume down ^ sxmo_vol.sh down
Earpiece $(echo -- "$FLAGS" | grep -q -- -e && echo) ^ toggleflagset -e $icon_phn Earpiece $(echo -- "$FLAGS" | grep -q -- -e && echo) ^ toggleflagset -e
Mic $(echo -- "$FLAGS" | grep -q -- -m && echo) ^ toggleflagset -m $icon_mic Mic $(echo -- "$FLAGS" | grep -q -- -m && echo) ^ toggleflagset -m
Linejack $(echo -- "$FLAGS" | grep -q -- -h && echo) ^ toggleflagset -h $icon_itm Linejack $(echo -- "$FLAGS" | grep -q -- -h && echo) ^ toggleflagset -h
Linemic $(echo -- "$FLAGS" | grep -q -- -l && echo) ^ toggleflagset -l $icon_itm Linemic $(echo -- "$FLAGS" | grep -q -- -l && echo) ^ toggleflagset -l
Speakerphone $(echo -- "$FLAGS" | grep -q -- -s && echo) ^ toggleflagset -s $icon_spk Speakerphone $(echo -- "$FLAGS" | grep -q -- -s && echo) ^ toggleflagset -s
Echomic $(echo -- "$FLAGS" | grep -q -- -z && echo) ^ toggleflagset -z $icon_itm Echomic $(echo -- "$FLAGS" | grep -q -- -z && echo) ^ toggleflagset -z
DTMF Tones ^ dtmfmenu $CALLID $icon_mus DTMF Tones ^ dtmfmenu $CALLID
Hangup ^ hangup $CALLID $icon_phx Hangup ^ hangup $CALLID
" "
pkill -9 dmenu # E.g. just incase user is playing with btns or hits a menu by mistake pkill -9 dmenu # E.g. just incase user is playing with btns or hits a menu by mistake

@ -3,6 +3,10 @@ LOGDIR="$XDG_DATA_HOME"/sxmo/modem
TERMMODE=$([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "true") TERMMODE=$([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "true")
DRAFT_DIR="$XDG_DATA_HOME/sxmo/modem/draft" DRAFT_DIR="$XDG_DATA_HOME/sxmo/modem/draft"
DIR=$(dirname "$0")
# shellcheck source=./sxmo_icons.sh
. "$DIR/sxmo_icons.sh"
menu() { menu() {
if [ "$TERMMODE" != "true" ]; then if [ "$TERMMODE" != "true" ]; then
"$@" "$@"
@ -39,20 +43,20 @@ choosenumbermenu() {
# Prompt for number # Prompt for number
NUMBER="$( NUMBER="$(
printf %b "\nCancel\nMore contacts\n$(sxmo_contacts.sh | grep -E "^\+?[0-9]+:")" | printf %b "\n$icon_cls Cancel\n$icon_grp More contacts\n$(sxmo_contacts.sh | grep -E "^\+?[0-9]+:")" |
awk NF | awk NF |
menu sxmo_dmenu_with_kb.sh -p "Number" -l 10 -c -i | menu sxmo_dmenu_with_kb.sh -p "Number" -l 10 -c -i |
cut -d: -f1 | cut -d: -f1 |
tr -d -- '- ' tr -d -- '- '
)" )"
echo "$NUMBER" | grep -qE "^Morecontacts$" && NUMBER="$( #joined words without space is not a bug echo "$NUMBER" | grep -q "Morecontacts" && NUMBER="$( #joined words without space is not a bug
printf %b "\nCancel\n$(sxmo_contacts.sh --all)" | printf %b "\nCancel\n$(sxmo_contacts.sh --all)" |
grep . | grep . |
menu sxmo_dmenu_with_kb.sh -l 10 -p "Number" -c -i | menu sxmo_dmenu_with_kb.sh -l 10 -p "Number" -c -i |
cut -d: -f1 | cut -d: -f1 |
tr -d -- '- ' tr -d -- '- '
)" )"
echo "$NUMBER" | grep -qE "^Cancel$" && exit 1 echo "$NUMBER" | grep -q "Cancel" && exit 1
echo "$NUMBER" | grep -qE '^[+0-9]+$' || err "That doesn't seem like a valid number" echo "$NUMBER" | grep -qE '^[+0-9]+$' || err "That doesn't seem like a valid number"
echo "$NUMBER" echo "$NUMBER"
} }
@ -70,13 +74,13 @@ sendtextmenu() {
while true while true
do do
CONFIRM="$( CONFIRM="$(
printf %b "Edit Message ($(echo "$TEXT" | head -n1))\nSend to → $NUMBER\nSave as Draft\nCancel" | printf %b "$icon_edt Edit Message ($(echo "$TEXT" | head -n1))\n$icon_snd Send to → $NUMBER\n$icon_sav Save as Draft\n$icon_cls Cancel" |
menu dmenu -c -idx 1 -p "Confirm" -l 10 menu dmenu -c -idx 1 -p "Confirm" -l 10
)" )"
echo "$CONFIRM" | grep -E "^Send" && (echo "$TEXT" | sxmo_modemsendsms.sh "$NUMBER" -) && echo "Sent text to $NUMBER">&2 && exit 0 echo "$CONFIRM" | grep -E "Send to" && (echo "$TEXT" | sxmo_modemsendsms.sh "$NUMBER" -) && echo "Sent text to $NUMBER">&2 && exit 0
echo "$CONFIRM" | grep -E "^Cancel$" && exit 1 echo "$CONFIRM" | grep -E "Cancel$" && exit 1
echo "$CONFIRM" | grep -E "^Edit Message" && TEXT="$(editmsg "$NUMBER" "$TEXT")" echo "$CONFIRM" | grep -E "Edit Message" && TEXT="$(editmsg "$NUMBER" "$TEXT")"
echo "$CONFIRM" | grep -E "^Save as Draft$" && err "Draft saved to $(draft "$NUMBER" "$TEXT")" echo "$CONFIRM" | grep -E "Save as Draft$" && err "Draft saved to $(draft "$NUMBER" "$TEXT")"
done done
} }
@ -91,10 +95,10 @@ draft() {
senddrafttextmenu() { senddrafttextmenu() {
CONFIRM="$( CONFIRM="$(
printf %b "Cancel\n$(ls "$DRAFT_DIR")" | printf %b "$icon_cls Cancel\n$(ls "$DRAFT_DIR")" |
menu sxmo_dmenu_with_kb.sh -p "Draft Message" -l 10 -c -i menu sxmo_dmenu_with_kb.sh -p "Draft Message" -l 10 -c -i
)" )"
echo "$CONFIRM" | grep -E "^Cancel$" && exit 1 echo "$CONFIRM" | grep -E "Cancel$" && exit 1
FILE="$DRAFT_DIR/$CONFIRM" FILE="$DRAFT_DIR/$CONFIRM"
NUMBER="$(head -n1 "$FILE")" NUMBER="$(head -n1 "$FILE")"
TEXT="$(tail -n +2 "$FILE")" TEXT="$(tail -n +2 "$FILE")"
@ -114,7 +118,7 @@ main() {
[ ! -d "$DRAFT_DIR" ] && mkdir -p "$DRAFT_DIR" [ ! -d "$DRAFT_DIR" ] && mkdir -p "$DRAFT_DIR"
# E.g. only display logfiles for directories that exist and join w contact name # E.g. only display logfiles for directories that exist and join w contact name
ENTRIES="$( ENTRIES="$(
printf %b "Close Menu\nSend a Text$( [ "$(ls -A "$DRAFT_DIR")" ] && printf %b "\nSend a Draft Text")\n"; printf %b "$icon_cls Close Menu\n$icon_edt Send a Text$( [ "$(ls -A "$DRAFT_DIR")" ] && printf %b "\n$icon_edt Send a Draft Text")\n";
sxmo_contacts.sh | while read -r CONTACT; do sxmo_contacts.sh | while read -r CONTACT; do
[ -d "$LOGDIR"/"$(printf %b "$CONTACT" | cut -d: -f1)" ] || continue [ -d "$LOGDIR"/"$(printf %b "$CONTACT" | cut -d: -f1)" ] || continue
printf %b "$CONTACT" | xargs -IL echo "L logfile" printf %b "$CONTACT" | xargs -IL echo "L logfile"

@ -1,8 +1,12 @@
#!/usr/bin/env sh #!/usr/bin/env sh
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications
DIR=$(dirname "$0")
# shellcheck source=./sxmo_icons.sh
. "$DIR/sxmo_icons.sh"
notificationmenu() { notificationmenu() {
CHOICES="Close Menu\nClear Notifications" CHOICES="$icon_cls Close Menu\n$icon_del Clear Notifications"
# shellcheck disable=SC2045 # shellcheck disable=SC2045
for NOTIFFILE in $(ls -tr "$NOTIFDIR"); do for NOTIFFILE in $(ls -tr "$NOTIFDIR"); do
NOTIFMSG="$(tail -n+3 "$NOTIFDIR/$NOTIFFILE" | tr "\n^" " ")" NOTIFMSG="$(tail -n+3 "$NOTIFDIR/$NOTIFFILE" | tr "\n^" " ")"
@ -22,8 +26,8 @@ notificationmenu() {
dmenu -c -i -p "Notifs" -l 20 dmenu -c -i -p "Notifs" -l 20
)" )"
[ "$PICKEDCONTENT" = "Close Menu" ] && exit 1 echo "$PICKEDCONTENT" | grep -q "Close Menu" && exit 1
[ "$PICKEDCONTENT" = "Clear Notifications" ] && rm "$NOTIFDIR"/* && exit 1 echo "$PICKEDCONTENT" | grep -q "Clear Notifications" && rm "$NOTIFDIR"/* && exit 1
PICKEDNOTIFFILE="$(echo "$CHOICES" | tr -s ' ' | grep -F "$PICKEDCONTENT" | cut -d^ -f2 | tr -d ' ')" PICKEDNOTIFFILE="$(echo "$CHOICES" | tr -s ' ' | grep -F "$PICKEDCONTENT" | cut -d^ -f2 | tr -d ' ')"
NOTIFACTION="$(head -n1 "$PICKEDNOTIFFILE")" NOTIFACTION="$(head -n1 "$PICKEDNOTIFFILE")"

Loading…
Cancel
Save