From 7669fa341e084ad84b7128057ca2105bfe1eca9c Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sun, 31 Jan 2021 15:37:20 +0100 Subject: [PATCH] adding icons to menus --- .build.yml | 2 +- Makefile | 2 +- scripts/core/sxmo_appmenu.sh | 464 +++++++++--------- scripts/core/sxmo_icons.sh | 96 ++++ scripts/modem/sxmo_modemcall.sh | 28 +- scripts/modem/sxmo_modemtext.sh | 26 +- .../notifications/sxmo_notificationsmenu.sh | 10 +- 7 files changed, 370 insertions(+), 258 deletions(-) create mode 100644 scripts/core/sxmo_icons.sh diff --git a/.build.yml b/.build.yml index 73aa129..2187c76 100644 --- a/.build.yml +++ b/.build.yml @@ -7,7 +7,7 @@ sources: tasks: - shellcheck: | cd sxmo-utils - shellcheck scripts/*/* + shellcheck -x scripts/*/* - editorconfig-check: | cd sxmo-utils ec diff --git a/Makefile b/Makefile index 307c4ee..261e52f 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PROGRAMS = \ all: shellcheck $(PROGRAMS) shellcheck: - shellcheck scripts/*/* + shellcheck -x scripts/*/* programs/sxmo_setpineled: programs/sxmo_setpineled.c gcc -o programs/sxmo_setpineled programs/sxmo_setpineled.c diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index 30fd3b1..cc12f14 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -3,6 +3,10 @@ trap gracefulexit INT TERM WIN=$(xdotool getwindowfocus) NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications +DIR=$(dirname "$0") +# shellcheck source=./sxmo_icons.sh +. "$DIR/sxmo_icons.sh" + gracefulexit() { echo "Gracefully exiting $0">&2 kill -9 0 @@ -20,25 +24,25 @@ programchoicesinit() { if echo "$WMCLASS" | grep -i "scripts"; then # Scripts menu CHOICES=" - Record ^ 0 ^ sxmo_record.sh - Reddit ^ 0 ^ sxmo_reddit.sh - RSS ^ 0 ^ sxmo_rss.sh - Timer ^ 0 ^ sxmo_timer.sh - Youtube ^ 0 ^ sxmo_youtube.sh video - Youtube (Audio) ^ 0 ^ sxmo_youtube.sh audio - Web Search ^ 0 ^ sxmo_websearch.sh - Weather ^ 0 ^ sxmo_weather.sh + $icon_mic Record ^ 0 ^ sxmo_record.sh + $icon_red Reddit ^ 0 ^ sxmo_reddit.sh + $icon_rss RSS ^ 0 ^ sxmo_rss.sh + $icon_tmr Timer ^ 0 ^ sxmo_timer.sh + $icon_ytb Youtube ^ 0 ^ sxmo_youtube.sh video + $icon_ytb Youtube (Audio) ^ 0 ^ sxmo_youtube.sh audio + $icon_glb Web Search ^ 0 ^ sxmo_websearch.sh + $icon_wtr Weather ^ 0 ^ sxmo_weather.sh " if [ -x "$XDG_CONFIG_HOME/sxmo/userscripts" ]; then CHOICES=" $( find "$XDG_CONFIG_HOME/sxmo/userscripts" \( -type f -o -type l \) -print0 | 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 ) $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 WINNAME=Scripts @@ -48,144 +52,144 @@ programchoicesinit() { CHOICES=$("$XDG_CONFIG_HOME/sxmo/hooks/apps") else CHOICES=" - $(command -v aerc >/dev/null && echo 'Aerc ^ 0 ^ st -e aerc') - $(command -v alpine >/dev/null && echo 'Alpine ^ 0 ^ st -e alpine') - $(command -v calcurse >/dev/null && echo 'Calcurse ^ 0 ^ st -e calcurse') - $(command -v cmus >/dev/null && echo 'Cmus ^ 0 ^ st -e cmus') - $(command -v dino >/dev/null && echo 'Dino ^ 0 ^ GDK_SCALE=2 dino') - $(command -v emacs >/dev/null && echo 'Emacs ^ 0 ^ st -e emacs') - $(command -v epiphany >/dev/null && echo 'Epiphany ^ 0 ^ epiphany') - $(command -v firefox >/dev/null && echo 'Firefox ^ 0 ^ firefox') - $(command -v foxtrotgps >/dev/null && echo 'Foxtrotgps ^ 0 ^ foxtrotgps') - $(command -v geany >/dev/null && echo 'Geany ^ 0 ^ geany') - $(command -v gedit >/dev/null && echo 'Gedit ^ 0 ^ gedit') - $(command -v geeqie >/dev/null && echo 'Geeqie ^ 0 ^ geeqie') - $(command -v htop >/dev/null && echo 'Htop ^ 0 ^ st -e htop') - $(command -v irssi >/dev/null && echo 'Irssi ^ 0 ^ st -e irssi') - $(command -v ii >/dev/null && echo 'Ii ^ 0 ^ st -e ii') - $(command -v ipython >/dev/null && echo 'IPython ^ 0 ^ st -e ipython') - $(command -v lf >/dev/null && echo 'Lf ^ 0 ^ st -e lf') - $(command -v midori >/dev/null && echo 'Midori ^ 0 ^ midori') - $(command -v mutt >/dev/null && echo 'Mutt ^ 0 ^ st -e mutt') - $(command -v nano >/dev/null && echo 'Nano ^ 0 ^ st -e nano') - $(command -v ncmpcpp >/dev/null && echo 'Ncmpcpp ^ 0 ^ st -e ncmpcpp') - $(command -v neomutt >/dev/null && echo 'Neomutt ^ 0 ^ st -e neomutt') - $(command -v neovim >/dev/null && echo 'Neovim ^ 0 ^ st -e neovim') - $(command -v netsurf >/dev/null && echo 'Netsurf ^ 0 ^ netsurf') - $(command -v newsboat >/dev/null && echo 'Newsboat ^ 0 ^ st -e newsboat') - $(command -v nnn >/dev/null && echo 'Nnn ^ 0 ^ st -e nnn') - $(command -v pidgin >/dev/null && echo 'Pidgin ^ 0 ^ pidgin') - $(command -v ranger >/dev/null && echo 'Ranger ^ 0 ^ st -e ranger') - $(command -v sacc >/dev/null && echo 'Sacc ^ 0 ^ st -e sacc i-logout.cz/1/bongusta') - $(command -v sic >/dev/null && echo 'Sic ^ 0 ^ st -e sic') - $(command -v st >/dev/null && echo "St ^ 0 ^ st -e $SHELL -l") - $(command -v surf >/dev/null && echo 'Surf ^ 0 ^ surf') - $(command -v syncthing >/dev/null && echo 'Syncthing ^ 0 ^ syncthing') - $(command -v telegram-desktop >/dev/null && echo 'Telegram ^ 0 ^ telegram-desktop') - $(command -v thunar >/dev/null && echo 'Thunar ^ 0 ^ st -e thunar') - $(command -v thunderbird >/dev/null && echo 'Thunderbird ^ 0 ^ thunderbird') - $(command -v totem >/dev/null && echo 'Totem ^ 0 ^ st -e totem') - $(command -v tuir >/dev/null && echo 'Tuir ^ 0 ^ st -e tuir') - $(command -v weechat >/dev/null && echo 'Weechat ^ 0 ^ st -e weechat') - $(command -v w3m >/dev/null && echo 'W3m ^ 0 ^ st -e w3m duck.com') - $(command -v vim >/dev/null && echo 'Vim ^ 0 ^ st -e vim') - $(command -v vis >/dev/null && echo 'Vis ^ 0 ^ st -e vis') - $(command -v vlc >/dev/null && echo 'Vlc ^ 0 ^ vlc') - $(command -v xcalc >/dev/null && echo 'Xcalc ^ 0 ^ xcalc') + $(command -v aerc >/dev/null && echo "$icon_eml Aerc ^ 0 ^ st -e aerc") + $(command -v alpine >/dev/null && echo "$icon_eml Alpine ^ 0 ^ st -e alpine") + $(command -v calcurse >/dev/null && echo "$icon_clk Calcurse ^ 0 ^ st -e calcurse") + $(command -v cmus >/dev/null && echo "$icon_mus Cmus ^ 0 ^ st -e cmus") + $(command -v dino >/dev/null && echo "$icon_clk Dino ^ 0 ^ GDK_SCALE=2 dino") + $(command -v emacs >/dev/null && echo "$icon_edt Emacs ^ 0 ^ st -e emacs") + $(command -v epiphany >/dev/null && echo "$icon_glb Epiphany ^ 0 ^ epiphany") + $(command -v firefox >/dev/null && echo "$icon_ffx Firefox ^ 0 ^ firefox") + $(command -v foxtrotgps >/dev/null && echo "$icon_gps Foxtrotgps ^ 0 ^ foxtrotgps") + $(command -v geany >/dev/null && echo "$icon_eml Geany ^ 0 ^ geany") + $(command -v gedit >/dev/null && echo "$icon_edt Gedit ^ 0 ^ gedit") + $(command -v geeqie >/dev/null && echo "$icon_img Geeqie ^ 0 ^ geeqie") + $(command -v htop >/dev/null && echo "$icon_cfg Htop ^ 0 ^ st -e htop") + $(command -v irssi >/dev/null && echo "$icon_msg Irssi ^ 0 ^ st -e irssi") + $(command -v ii >/dev/null && echo "$icon_msg Ii ^ 0 ^ st -e ii") + $(command -v ipython >/dev/null && echo "$icon_trm IPython ^ 0 ^ st -e ipython") + $(command -v lf >/dev/null && echo "$icon_dir Lf ^ 0 ^ st -e lf") + $(command -v midori >/dev/null && echo "$icon_glb Midori ^ 0 ^ midori") + $(command -v mutt >/dev/null && echo "$icon_eml Mutt ^ 0 ^ st -e mutt") + $(command -v nano >/dev/null && echo "$icon_edt Nano ^ 0 ^ st -e nano") + $(command -v ncmpcpp >/dev/null && echo "$icon_mus Ncmpcpp ^ 0 ^ st -e ncmpcpp") + $(command -v neomutt >/dev/null && echo "$icon_eml Neomutt ^ 0 ^ st -e neomutt") + $(command -v neovim >/dev/null && echo "$icon_vim Neovim ^ 0 ^ st -e neovim") + $(command -v netsurf >/dev/null && echo "$icon_glb Netsurf ^ 0 ^ netsurf") + $(command -v newsboat >/dev/null && echo "$icon_rss Newsboat ^ 0 ^ st -e newsboat") + $(command -v nnn >/dev/null && echo "$icon_dir Nnn ^ 0 ^ st -e nnn") + $(command -v pidgin >/dev/null && echo "$icon_msg Pidgin ^ 0 ^ pidgin") + $(command -v ranger >/dev/null && echo "$icon_dir Ranger ^ 0 ^ st -e ranger") + $(command -v sacc >/dev/null && echo "$icon_itm Sacc ^ 0 ^ st -e sacc i-logout.cz/1/bongusta") + $(command -v sic >/dev/null && echo "$icon_itm Sic ^ 0 ^ st -e sic") + $(command -v st >/dev/null && echo "$icon_trm St ^ 0 ^ st -e $SHELL -l") + $(command -v surf >/dev/null && echo "$icon_glb Surf ^ 0 ^ surf") + $(command -v syncthing >/dev/null && echo "$icon_rld Syncthing ^ 0 ^ syncthing") + $(command -v telegram-desktop >/dev/null && echo "$icon_tgm Telegram ^ 0 ^ telegram-desktop") + $(command -v thunar >/dev/null && echo "$icon_dir Thunar ^ 0 ^ st -e thunar") + $(command -v thunderbird >/dev/null && echo "$icon_eml Thunderbird ^ 0 ^ thunderbird") + $(command -v totem >/dev/null && echo "$icon_mvi Totem ^ 0 ^ st -e totem") + $(command -v tuir >/dev/null && echo "$icon_red Tuir ^ 0 ^ st -e tuir") + $(command -v weechat >/dev/null && echo "$icon_msg Weechat ^ 0 ^ st -e weechat") + $(command -v w3m >/dev/null && echo "$icon_glb W3m ^ 0 ^ st -e w3m duck.com") + $(command -v vim >/dev/null && echo "$icon_vim Vim ^ 0 ^ st -e vim") + $(command -v vis >/dev/null && echo "$icon_vim Vis ^ 0 ^ st -e vis") + $(command -v vlc >/dev/null && echo "$icon_mvi Vlc ^ 0 ^ vlc") + $(command -v xcalc >/dev/null && echo "$icon_clc Xcalc ^ 0 ^ xcalc") " fi WINNAME=Apps elif echo "$WMCLASS" | grep -i "config"; then # System Control menu CHOICES=" - Brightness ↑ ^ 1 ^ sxmo_brightness.sh up - Brightness ↓ ^ 1 ^ sxmo_brightness.sh down - Modem Toggle ^ 1 ^ sxmo_modemmonitortoggle.sh - Modem Info ^ 0 ^ sxmo_modeminfo.sh - Modem Log ^ 0 ^ sxmo_modemlog.sh - Flash $( + $icon_aru Brightness ^ 1 ^ sxmo_brightness.sh up + $icon_ard Brightness ^ 1 ^ sxmo_brightness.sh down + $icon_phn Modem Toggle ^ 1 ^ sxmo_modemmonitortoggle.sh + $icon_inf Modem Info ^ 0 ^ sxmo_modeminfo.sh + $icon_phl Modem Log ^ 0 ^ sxmo_modemlog.sh + $icon_fll Flashlight $( grep -qE '^0$' /sys/class/leds/white:flash/brightness && printf %b "Off → On" || printf %b "On → Off"; printf %b "^ 1 ^ sxmo_flashtoggle.sh" ) - Bar Toggle ^ 1 ^ key Alt+b - Invert Colors ^ 1 ^ xcalib -a -invert - Change Timezone ^ 1 ^ sxmo_timezonechange.sh - Autorotate $( + $icon_cfg Bar Toggle ^ 1 ^ key Alt+b + $icon_cfg Invert Colors ^ 1 ^ xcalib -a -invert + $icon_clk Change Timezone ^ 1 ^ sxmo_timezonechange.sh + $icon_ror Autorotate $( 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 &" ) - Rotate ^ 1 ^ sxmo_rotate.sh rotate - Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh + $icon_ror Rotate ^ 1 ^ sxmo_rotate.sh rotate + $icon_upc Upgrade Pkgs ^ 0 ^ st -e sxmo_upgrade.sh " WINNAME=Config elif echo "$WMCLASS" | grep -i "audioout"; then # Audio Out menu CURRENTDEV="$(sxmo_audiocurrentdevice.sh)" CHOICES=" - Headphones $([ "$CURRENTDEV" = "Headphone" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Headphones - Speaker $([ "$CURRENTDEV" = "Line Out" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Speaker - Earpiece $([ "$CURRENTDEV" = "Earpiece" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Earpiece - None $([ "$CURRENTDEV" = "None" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh None - Volume ↑ ^ 1 ^ sxmo_vol.sh up - Volume ↓ ^ 1 ^ sxmo_vol.sh down + $icon_hdp Headphones $([ "$CURRENTDEV" = "Headphone" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Headphones + $icon_spk Speaker $([ "$CURRENTDEV" = "Line Out" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Speaker + $icon_phn Earpiece $([ "$CURRENTDEV" = "Earpiece" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh Earpiece + $icon_mut None $([ "$CURRENTDEV" = "None" ] && echo "✓") ^ 1 ^ sxmo_audioout.sh None + $icon_aru Volume up ^ 1 ^ sxmo_vol.sh up + $icon_ard Volume down ^ 1 ^ sxmo_vol.sh down " WINNAME="Audio" elif echo "$WMCLASS" | grep -i "power"; then # Power menu CHOICES=" - Lock ^ 0 ^ sxmo_lock.sh - Lock (Screen off) ^ 0 ^ sxmo_lock.sh --screen-off - Suspend ^ 0 ^ sxmo_lock.sh --suspend - Logout ^ 0 ^ pkill -9 dwm - Reboot ^ 0 ^ st -e sudo reboot - Poweroff ^ 0 ^ st -e sudo halt + $icon_lck Lock ^ 0 ^ sxmo_lock.sh + $icon_lck Lock (Screen off) ^ 0 ^ sxmo_lock.sh --screen-off + $icon_zzz Suspend ^ 0 ^ sxmo_lock.sh --suspend + $icon_out Logout ^ 0 ^ pkill -9 dwm + $icon_rld Reboot ^ 0 ^ st -e sudo reboot + $icon_pwr Poweroff ^ 0 ^ st -e sudo halt " WINNAME="Power" elif echo "$WMCLASS" | grep -i "mpv"; then # MPV CHOICES=" - Pause ^ 0 ^ key space - Seek ← ^ 1 ^ key Left - Seek → ^ 1 ^ key Right - App Volume ↑ ^ 1 ^ key 0 - App Volume ↓ ^ 1 ^ key 9 - Speed ↑ ^ 1 ^ key bracketright - Speed ↓ ^ 1 ^ key bracketleft - Screenshot ^ 1 ^ key s - Loopmark ^ 1 ^ key l - Info ^ 1 ^ key i - Seek Info ^ 1 ^ key o + $icon_pau Pause ^ 0 ^ key space + $icon_fbw Seek ^ 1 ^ key Left + $icon_ffw Seek ^ 1 ^ key Right + $icon_aru App Volume ↑ ^ 1 ^ key 0 + $icon_ard App Volume ↓ ^ 1 ^ key 9 + $icon_aru Speed up ^ 1 ^ key bracketright + $icon_ard Speed down ^ 1 ^ key bracketleft + $icon_cam Screenshot ^ 1 ^ key s + $icon_itm Loopmark ^ 1 ^ key l + $icon_inf Info ^ 1 ^ key i + $icon_inf Seek Info ^ 1 ^ key o " WINNAME=Mpv && return elif echo "$WMCLASS" | grep -i "feh"; then # Feh CHOICES=" - Next → ^ 1 ^ key space - Previous ← ^ 1 ^ key BackSpace - Zoom + ^ 1 ^ key up - Zoom - ^ 1 ^ key down - Zoom to fit ^ 1 ^ key slash - Zoom to fill ^ 1 ^ key exlam - Rotate ↺ ^ 1 ^ key less - Rotate ↻ ^ 1 ^ key greater - Flip ⇅ ^ 1 ^ key underscore - Mirror ⇄ ^ 1 ^ key bar - Toggle filename ^ 1 ^ key d + $icon_arr Next ^ 1 ^ key space + $icon_arl Previous ^ 1 ^ key BackSpace + $icon_zmi Zoom in ^ 1 ^ key up + $icon_zmo Zoom out ^ 1 ^ key down + $icon_exp Zoom to fit ^ 1 ^ key slash + $icon_shr Zoom to fill ^ 1 ^ key exlam + $icon_rol Rotate ^ 1 ^ key less + $icon_ror Rotate ^ 1 ^ key greater + $icon_a2y Flip ^ 1 ^ key underscore + $icon_a2x Mirror ^ 1 ^ key bar + $icon_inf Toggle filename ^ 1 ^ key d " WINNAME=Feh && return elif echo "$WMCLASS" | grep -i "sxiv"; then # Sxiv CHOICES=" - Next → ^ 1 ^ key space - Previous ← ^ 1 ^ key BackSpace - Zoom + ^ 1 ^ key equal - Zoom - ^ 1 ^ key minus - Rotate ↺ ^ 1 ^ key less - Rotate ↻ ^ 1 ^ key greater - Flip ⇄ ^ 1 ^ key question - Flip ⇅ ^ 1 ^ key bar - Thumbnail ⊡ ^ 0 ^ key Return + $icon_arr Next ^ 1 ^ key space + $icon_arl Previous ^ 1 ^ key BackSpace + $icon_zmi Zoom in ^ 1 ^ key equal + $icon_zmo Zoom out ^ 1 ^ key minus + $icon_rol Rotate ^ 1 ^ key less + $icon_ror Rotate ^ 1 ^ key greater + $icon_a2y Flip ^ 1 ^ key question + $icon_a2x Mirror ^ 1 ^ key bar + $icon_grd Thumbnail ^ 0 ^ key Return " WINNAME=Sxiv && return 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 #Vim in st CHOICES=" - Scroll ↑ ^ 1 ^ key Ctrl+Shift+u - Scroll ↓ ^ 1 ^ key Ctrl+Shift+d - Command prompt ^ 0 ^ key Escape Shift+semicolon - Save ^ 0 ^ key Escape Shift+semicolon w Return - Quit ^ 0 ^ key Escape Shift+semicolon q Return - Paste Selection ^ 0 ^ key Escape quotedbl asterisk p - Paste Clipboard ^ 0 ^ key Escape quotedbl plus p - Search ^ 0 ^ key Escape / - Zoom + ^ 1 ^ key Ctrl+Shift+Prior - Zoom - ^ 1 ^ key Ctrl+Shift+Next - St menu ^ 0 ^ sxmo_appmenu.sh st-256color + $icon_aru Scroll up ^ 1 ^ key Ctrl+Shift+u + $icon_ard Scroll down ^ 1 ^ key Ctrl+Shift+d + $icon_trm Command prompt ^ 0 ^ key Escape Shift+semicolon + $icon_cls Save ^ 0 ^ key Escape Shift+semicolon w Return + $icon_cls Quit ^ 0 ^ key Escape Shift+semicolon q Return + $icon_pst Paste Selection ^ 0 ^ key Escape quotedbl asterisk p + $icon_pst Paste Clipboard ^ 0 ^ key Escape quotedbl plus p + $icon_fnd Search ^ 0 ^ key Escape / + $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior + $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next + $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color " WINNAME=Vim elif echo "$WMNAME" | grep -i -w "nano"; then #Nano in st CHOICES=" - Scroll ↑ ^ 1 ^ key Prior - Scroll ↓ ^ 1 ^ key Next - Save ^ 0 ^ key Ctrl+O - Quit ^ 0 ^ key Ctrl+X - Paste ^ 0 ^ key Ctrl+U - Type complete ^ 0 ^ key Ctrl+Shift+u - Copy complete ^ 0 ^ key Ctrl+Shift+i - Zoom + ^ 1 ^ key Ctrl+Shift+Prior - Zoom - ^ 1 ^ key Ctrl+Shift+Next - St menu ^ 0 ^ sxmo_appmenu.sh st-256color + $icon_aru Scroll up ^ 1 ^ key Prior + $icon_ard Scroll down ^ 1 ^ key Next + $icon_sav Save ^ 0 ^ key Ctrl+O + $icon_cls Quit ^ 0 ^ key Ctrl+X + $icon_pst Paste ^ 0 ^ key Ctrl+U + $icon_itm Type complete ^ 0 ^ key Ctrl+Shift+u + $icon_cpy Copy complete ^ 0 ^ key Ctrl+Shift+i + $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior + $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next + $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color " WINNAME=Nano elif echo "$WMNAME" | grep -i -w "tuir"; then #tuir (reddit client) in st CHOICES=" - Previous ↑ ^ 1 ^ key k - Next ↓ ^ 1 ^ key j - Scroll ↑ ^ 1 ^ key Prior - Scroll ↓ ^ 1 ^ key Next - Open ^ 0 ^ key o - Back ← ^ 0 ^ key h - Comments → ^ 0 ^ key l - Post ^ 0 ^ key c - Refresh ^ 0 ^ key r - Quit ^ 0 ^ key q - Zoom + ^ 1 ^ key Ctrl+Shift+Prior - Zoom - ^ 1 ^ key Ctrl+Shift+Next - St menu ^ 0 ^ sxmo_appmenu.sh st-256color + $icon_aru Previous ^ 1 ^ key k + $icon_ard Next ^ 1 ^ key j + $icon_aru Scroll up ^ 1 ^ key Prior + $icon_ard Scroll down ^ 1 ^ key Next + $icon_ret Open ^ 0 ^ key o + $icon_arl Back ^ 0 ^ key h + $icon_arr Comments ^ 0 ^ key l + $icon_edt Post ^ 0 ^ key c + $icon_rld Refresh ^ 0 ^ key r + $icon_cls Quit ^ 0 ^ key q + $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior + $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next + $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color " WINNAME=tuir elif echo "$WMNAME" | grep -i -w "w3m"; then #w3m CHOICES=" - Back ← ^ 1 ^ key B - Goto URL ^ 1 ^ key U - Next Link ^ 1 ^ key Tab - Previous Link ^ 1 ^ key Shift+Tab - Open tab ^ 0 ^ key T - Close tab ^ 0 ^ Ctrl+q - Next tab ^ 1 ^ key braceright - Previous tab ^ 1 ^ key braceleft - Zoom + ^ 1 ^ key Ctrl+Shift+Prior - Zoom - ^ 1 ^ key Ctrl+Shift+Next - St menu ^ 0 ^ sxmo_appmenu.sh st-256color + $icon_arl Back ^ 1 ^ key B + $icon_glb Goto URL ^ 1 ^ key U + $icon_arr Next Link ^ 1 ^ key Tab + $icon_arl Previous Link ^ 1 ^ key Shift+Tab + $icon_tab Open tab ^ 0 ^ key T + $icon_cls Close tab ^ 0 ^ Ctrl+q + $icon_itm Next tab ^ 1 ^ key braceright + $icon_itm Previous tab ^ 1 ^ key braceleft + $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior + $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next + $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color " WINNAME=w3m elif echo "$WMNAME" | grep -i -w "ncmpcpp"; then #ncmpcpp CHOICES=" - Playlist ^ 0 ^ key 1 - Browser ^ 0 ^ key 2 - Search ^ 0 ^ key 2 - Next track ^ 0 ^ key greater - Previous track ^ 0 ^ key less - Pause ^ 0 ^ key p - Stop ^ 0 ^ key s - Toggle repeat ^ 0 ^ key r - Toggle random ^ 0 ^ key z - Toggle consume ^ 0 ^ key R - St menu ^ 0 ^ sxmo_appmenu.sh st-256color + $icon_lst Playlist ^ 0 ^ key 1 + $icon_fnd Browser ^ 0 ^ key 2 + $icon_fnd Search ^ 0 ^ key 3 + $icon_nxt Next track ^ 0 ^ key greater + $icon_prv Previous track ^ 0 ^ key less + $icon_pau Pause ^ 0 ^ key p + $icon_stp Stop ^ 0 ^ key s + $icon_rld Toggle repeat ^ 0 ^ key r + $icon_sfl Toggle random ^ 0 ^ key z + $icon_itm Toggle consume ^ 0 ^ key R + $icon_mnu St menu ^ 0 ^ sxmo_appmenu.sh st-256color " WINNAME=ncmpcpp else @@ -278,22 +282,22 @@ programchoicesinit() { echo "$XPROPOUT" | grep -E '^_ST_SELMODE.+=' | cut -d= -f2 | tr -d ' ' )" CHOICES=" - Type complete ^ 0 ^ key Ctrl+Shift+u - Copy complete ^ 0 ^ key Ctrl+Shift+i - Selmode $( + $icon_itm Type complete ^ 0 ^ key Ctrl+Shift+u + $icon_cpy Copy complete ^ 0 ^ key Ctrl+Shift+i + $icon_itm Selmode $( [ "$STSELMODEON" = 1 ] && printf %b 'On → Off' || printf %b 'Off → On' printf %b '^ 0 ^ key Ctrl+Shift+s' ) $([ "$STSELMODEON" = 1 ] && echo 'Copy selection ^ 0 ^ key Ctrl+Shift+c') - Paste ^ 0 ^ key Ctrl+Shift+v - Zoom + ^ 1 ^ key Ctrl+Shift+Prior - Zoom - ^ 1 ^ key Ctrl+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 + $icon_pst Paste ^ 0 ^ key Ctrl+Shift+v + $icon_zmi Zoom in ^ 1 ^ key Ctrl+Shift+Prior + $icon_zmo Zoom out ^ 1 ^ key Ctrl+Shift+Next + $icon_aru Scroll up ^ 1 ^ key Ctrl+Shift+b + $icon_ard Scroll down ^ 1 ^ key Ctrl+Shift+f + $icon_a2x Invert ^ 1 ^ key Ctrl+Shift+x + $icon_kbd Hotkeys ^ 0 ^ sxmo_appmenu.sh sthotkeys " WINNAME=St fi @@ -311,75 +315,75 @@ programchoicesinit() { elif echo "$WMCLASS" | grep -i netsurf; then # Netsurf CHOICES=" - 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 + $icon_flt Pipe URL ^ 0 ^ sxmo_urlhandler.sh + $icon_zmi Zoom ^ 1 ^ key Ctrl+plus + $icon_zmo Zoom ^ 1 ^ key Ctrl+minus + $icon_arl History ^ 1 ^ key Alt+Left + $icon_arr History ^ 1 ^ key Alt+Right " WINNAME=Netsurf elif echo "$WMCLASS" | grep surf; then # Surf CHOICES=" - Navigate ^ 0 ^ key Ctrl+g - Link Menu ^ 0 ^ key Ctrl+d - Pipe URL ^ 0 ^ sxmo_urlhandler.sh - Search Page ^ 0 ^ key Ctrl+f - Find Next ^ 0 ^ key Ctrl+n - Zoom + ^ 1 ^ key Ctrl+Shift+k - Zoom - ^ 1 ^ key Ctrl+Shift+j - Scroll ↑ ^ 1 ^ key Shift+space - Scroll ↓ ^ 1 ^ key space - JS Toggle ^ 1 ^ key Ctrl+Shift+s - History ← ^ 1 ^ key Ctrl+h - History → ^ 1 ^ key Ctrl+l - Refresh ^ 0 ^ key Ctrl+Shift+r + $icon_glb Navigate ^ 0 ^ key Ctrl+g + $icon_lnk Link Menu ^ 0 ^ key Ctrl+d + $icon_flt Pipe URL ^ 0 ^ sxmo_urlhandler.sh + $icon_fnd Search Page ^ 0 ^ key Ctrl+f + $icon_fnd Find Next ^ 0 ^ key Ctrl+n + $icon_zmi Zoom ^ 1 ^ key Ctrl+Shift+k + $icon_zmo Zoom ^ 1 ^ key Ctrl+Shift+j + $icon_aru Scroll ^ 1 ^ key Shift+space + $icon_ard Scroll ^ 1 ^ key space + $icon_itm JS Toggle ^ 1 ^ key Ctrl+Shift+s + $icon_arl History ^ 1 ^ key Ctrl+h + $icon_arr History ^ 1 ^ key Ctrl+l + $icon_rld Refresh ^ 0 ^ key Ctrl+Shift+r " WINNAME=Surf elif echo "$WMCLASS" | grep -i firefox; then # Firefox CHOICES=" - Pipe URL ^ 0 ^ sxmo_urlhandler.sh - New Tab ^ 0 ^ key Ctrl+t - New Window ^ 0 ^ key Ctrl+n - Zoom + ^ 1 ^ key Ctrl+plus - Zoom - ^ 1 ^ key Ctrl+minus - History ← ^ 1 ^ key Alt+Left - History → ^ 1 ^ key Alt+Right - Refresh ^ 0 ^ key Ctrl+Shift+r + $icon_flt Pipe URL ^ 0 ^ sxmo_urlhandler.sh + $icon_tab New Tab ^ 0 ^ key Ctrl+t + $icon_win New Window ^ 0 ^ key Ctrl+n + $icon_zmi Zoom ^ 1 ^ key Ctrl+plus + $icon_zmo Zoom ^ 1 ^ key Ctrl+minus + $icon_arl History ^ 1 ^ key Alt+Left + $icon_arr History ^ 1 ^ key Alt+Right + $icon_rld Refresh ^ 0 ^ key Ctrl+Shift+r " WINNAME=Firefox elif echo "$WMCLASS" | grep -i foxtrot; then # Foxtrot GPS - CHOICES=' - Locations ^ 0 ^ sxmo_gpsutil.sh menulocations - Copy ^ 1 ^ sxmo_gpsutil.sh copy - Paste ^ 0 ^ sxmo_gpsutil.sh paste - Drop Pin ^ 0 ^ sxmo_gpsutil.sh droppin - Region Search ^ 0 ^ sxmo_gpsutil.sh menuregionsearch - Region Details ^ 0 ^ sxmo_gpsutil.sh details - Zoom + ^ 1 ^ key i - Zoom - ^ 1 ^ key o - Map Type ^ 0 ^ sxmo_gpsutil.sh menumaptype - Panel Toggle ^ 1 ^ key m - GPSD Toggle ^ 1 ^ key a - Locate Me ^ 0 ^ sxmo_gpsutil.sh gpsgeoclueset - ' + CHOICES=" + $icon_itm Locations ^ 0 ^ sxmo_gpsutil.sh menulocations + $icon_cpy Copy ^ 1 ^ sxmo_gpsutil.sh copy + $icon_pst Paste ^ 0 ^ sxmo_gpsutil.sh paste + $icon_itm Drop Pin ^ 0 ^ sxmo_gpsutil.sh droppin + $icon_fnd Region Search ^ 0 ^ sxmo_gpsutil.sh menuregionsearch + $icon_itm Region Details ^ 0 ^ sxmo_gpsutil.sh details + $icon_zmi Zoom ^ 1 ^ key i + $icon_zmo Zoom ^ 1 ^ key o + $icon_itm Map Type ^ 0 ^ sxmo_gpsutil.sh menumaptype + $icon_itm Panel Toggle ^ 1 ^ key m + $icon_itm GPSD Toggle ^ 1 ^ key a + $icon_usr Locate Me ^ 0 ^ sxmo_gpsutil.sh gpsgeoclueset + " WINNAME=Maps else # Default system menu (no matches) CHOICES=" - Scripts ^ 0 ^ sxmo_appmenu.sh scripts - Apps ^ 0 ^ sxmo_appmenu.sh applications - Files ^ 0 ^ sxmo_files.sh - $(command -v foxtrotgps >/dev/null && echo 'Maps ^ 0 ^ foxtrotgps') - Dialer ^ 0 ^ sxmo_modemdial.sh - Texts ^ 0 ^ sxmo_modemtext.sh - $(command -v megapixels >/dev/null && echo 'Camera ^ 0 ^ GDK_SCALE=2 megapixels') - Networks ^ 0 ^ sxmo_networks.sh - Audio ^ 0 ^ sxmo_appmenu.sh audioout - Config ^ 0 ^ sxmo_appmenu.sh config - Power ^ 0 ^ sxmo_appmenu.sh power + $icon_grd Scripts ^ 0 ^ sxmo_appmenu.sh scripts + $icon_grd Apps ^ 0 ^ sxmo_appmenu.sh applications + $icon_dir Files ^ 0 ^ sxmo_files.sh + $(command -v foxtrotgps >/dev/null && echo "$icon_gps Maps ^ 0 ^ foxtrotgps") + $icon_phn Dialer ^ 0 ^ sxmo_modemdial.sh + $icon_msg Texts ^ 0 ^ sxmo_modemtext.sh + $(command -v megapixels >/dev/null && echo "$icon_cam Camera ^ 0 ^ GDK_SCALE=2 megapixels") + $icon_net Networks ^ 0 ^ sxmo_networks.sh + $icon_mus Audio ^ 0 ^ sxmo_appmenu.sh audioout + $icon_cfg Config ^ 0 ^ sxmo_appmenu.sh config + $icon_pwr Power ^ 0 ^ sxmo_appmenu.sh power " WINNAME=Sys fi @@ -395,7 +399,7 @@ getprogchoices() { NNOTIFICATIONS="$(find "$NOTIFDIR" -type f | wc -l)" if [ "$NNOTIFICATIONS" -gt 0 ]; then CHOICES=" - Notifications ($NNOTIFICATIONS) ^ 0 ^ sxmo_notificationsmenu.sh + $icon_bel Notifications ($NNOTIFICATIONS) ^ 0 ^ sxmo_notificationsmenu.sh $CHOICES " fi @@ -405,7 +409,7 @@ getprogchoices() { for NOTIFFILE in $(find "$NOTIFDIR" -name 'incomingcall*'); do NOTIFACTION="$(head -n1 "$NOTIFFILE")" CHOICES=" - Pick up incoming call ^ 0 ^ $NOTIFACTION + $icon_phn Pick up incoming call ^ 0 ^ $NOTIFACTION $CHOICES " break @@ -414,13 +418,13 @@ getprogchoices() { # 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 + $icon_mnu System Menu ^ 0 ^ sxmo_appmenu.sh sys " # Decorate menu at bottom w/ close menu entry 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')" diff --git a/scripts/core/sxmo_icons.sh b/scripts/core/sxmo_icons.sh new file mode 100644 index 0000000..8b8b699 --- /dev/null +++ b/scripts/core/sxmo_icons.sh @@ -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 diff --git a/scripts/modem/sxmo_modemcall.sh b/scripts/modem/sxmo_modemcall.sh index 7480828..f4e35ce 100755 --- a/scripts/modem/sxmo_modemcall.sh +++ b/scripts/modem/sxmo_modemcall.sh @@ -5,6 +5,10 @@ ALSASTATEFILE="$XDG_CACHE_HOME"/precall.alsa.state CACHEDIR="$XDG_CACHE_HOME"/sxmo trap "gracefulexit" INT TERM +DIR=$(dirname "$0") +# shellcheck source=./sxmo_icons.sh +. "$DIR/sxmo_icons.sh" + modem_n() { MODEMS="$(mmcli -L)" echo "$MODEMS" | grep -qoE 'Modem\/([0-9]+)' || finish "Couldn't find modem - is your modem enabled?" @@ -172,18 +176,18 @@ incallmonitor() { incallmenuloop() { echo "sxmo_modemcall: Current flags are $FLAGS">&2 CHOICES=" - $([ "$WINDOWIFIED" = 0 ] && echo Windowify || echo Unwindowify) ^ togglewindowify - $([ "$WINDOWIFIED" = 0 ] && echo 'Screenlock ^ togglewindowify; sxmo_screenlock &') - Volume ↑ ^ sxmo_vol.sh up - Volume ↓ ^ sxmo_vol.sh down - Earpiece $(echo -- "$FLAGS" | grep -q -- -e && echo ✓) ^ toggleflagset -e - Mic $(echo -- "$FLAGS" | grep -q -- -m && echo ✓) ^ toggleflagset -m - Linejack $(echo -- "$FLAGS" | grep -q -- -h && echo ✓) ^ toggleflagset -h - Linemic $(echo -- "$FLAGS" | grep -q -- -l && echo ✓) ^ toggleflagset -l - Speakerphone $(echo -- "$FLAGS" | grep -q -- -s && echo ✓) ^ toggleflagset -s - Echomic $(echo -- "$FLAGS" | grep -q -- -z && echo ✓) ^ toggleflagset -z - DTMF Tones ^ dtmfmenu $CALLID - Hangup ^ hangup $CALLID + $([ "$WINDOWIFIED" = 0 ] && echo "$icon_wn2 Windowify" || echo "$icon_wn2 Unwindowify") ^ togglewindowify + $([ "$WINDOWIFIED" = 0 ] && echo "$icon_lck Screenlock ^ togglewindowify; sxmo_screenlock &") + $icon_aru Volume up ^ sxmo_vol.sh up + $icon_ard Volume down ^ sxmo_vol.sh down + $icon_phn Earpiece $(echo -- "$FLAGS" | grep -q -- -e && echo ✓) ^ toggleflagset -e + $icon_mic Mic $(echo -- "$FLAGS" | grep -q -- -m && echo ✓) ^ toggleflagset -m + $icon_itm Linejack $(echo -- "$FLAGS" | grep -q -- -h && echo ✓) ^ toggleflagset -h + $icon_itm Linemic $(echo -- "$FLAGS" | grep -q -- -l && echo ✓) ^ toggleflagset -l + $icon_spk Speakerphone $(echo -- "$FLAGS" | grep -q -- -s && echo ✓) ^ toggleflagset -s + $icon_itm Echomic $(echo -- "$FLAGS" | grep -q -- -z && echo ✓) ^ toggleflagset -z + $icon_mus DTMF Tones ^ dtmfmenu $CALLID + $icon_phx Hangup ^ hangup $CALLID " pkill -9 dmenu # E.g. just incase user is playing with btns or hits a menu by mistake diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index bc70180..4d8f1b3 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -3,6 +3,10 @@ LOGDIR="$XDG_DATA_HOME"/sxmo/modem TERMMODE=$([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "true") DRAFT_DIR="$XDG_DATA_HOME/sxmo/modem/draft" +DIR=$(dirname "$0") +# shellcheck source=./sxmo_icons.sh +. "$DIR/sxmo_icons.sh" + menu() { if [ "$TERMMODE" != "true" ]; then "$@" @@ -39,20 +43,20 @@ choosenumbermenu() { # Prompt for 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 | menu sxmo_dmenu_with_kb.sh -p "Number" -l 10 -c -i | cut -d: -f1 | 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)" | grep . | menu sxmo_dmenu_with_kb.sh -l 10 -p "Number" -c -i | cut -d: -f1 | 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" } @@ -70,13 +74,13 @@ sendtextmenu() { while true do 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 )" - echo "$CONFIRM" | grep -E "^Send" && (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 "^Edit Message" && TEXT="$(editmsg "$NUMBER" "$TEXT")" - echo "$CONFIRM" | grep -E "^Save as Draft$" && err "Draft saved to $(draft "$NUMBER" "$TEXT")" + 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 "Edit Message" && TEXT="$(editmsg "$NUMBER" "$TEXT")" + echo "$CONFIRM" | grep -E "Save as Draft$" && err "Draft saved to $(draft "$NUMBER" "$TEXT")" done } @@ -91,10 +95,10 @@ draft() { senddrafttextmenu() { 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 )" - echo "$CONFIRM" | grep -E "^Cancel$" && exit 1 + echo "$CONFIRM" | grep -E "Cancel$" && exit 1 FILE="$DRAFT_DIR/$CONFIRM" NUMBER="$(head -n1 "$FILE")" TEXT="$(tail -n +2 "$FILE")" @@ -114,7 +118,7 @@ main() { [ ! -d "$DRAFT_DIR" ] && mkdir -p "$DRAFT_DIR" # E.g. only display logfiles for directories that exist and join w contact name 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 [ -d "$LOGDIR"/"$(printf %b "$CONTACT" | cut -d: -f1)" ] || continue printf %b "$CONTACT" | xargs -IL echo "L logfile" diff --git a/scripts/notifications/sxmo_notificationsmenu.sh b/scripts/notifications/sxmo_notificationsmenu.sh index 06fb4ac..edd7630 100755 --- a/scripts/notifications/sxmo_notificationsmenu.sh +++ b/scripts/notifications/sxmo_notificationsmenu.sh @@ -1,8 +1,12 @@ #!/usr/bin/env sh NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications +DIR=$(dirname "$0") +# shellcheck source=./sxmo_icons.sh +. "$DIR/sxmo_icons.sh" + notificationmenu() { - CHOICES="Close Menu\nClear Notifications" + CHOICES="$icon_cls Close Menu\n$icon_del Clear Notifications" # shellcheck disable=SC2045 for NOTIFFILE in $(ls -tr "$NOTIFDIR"); do NOTIFMSG="$(tail -n+3 "$NOTIFDIR/$NOTIFFILE" | tr "\n^" " ")" @@ -22,8 +26,8 @@ notificationmenu() { dmenu -c -i -p "Notifs" -l 20 )" - [ "$PICKEDCONTENT" = "Close Menu" ] && exit 1 - [ "$PICKEDCONTENT" = "Clear Notifications" ] && rm "$NOTIFDIR"/* && exit 1 + echo "$PICKEDCONTENT" | grep -q "Close Menu" && 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 ' ')" NOTIFACTION="$(head -n1 "$PICKEDNOTIFFILE")"