diff --git a/scripts/core/sxmo_appmenu.sh b/scripts/core/sxmo_appmenu.sh index cc12f14..5e5bc0a 100755 --- a/scripts/core/sxmo_appmenu.sh +++ b/scripts/core/sxmo_appmenu.sh @@ -1,11 +1,11 @@ #!/usr/bin/env sh 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" +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + +WIN=$(xdotool getwindowfocus) gracefulexit() { echo "Gracefully exiting $0">&2 diff --git a/scripts/core/sxmo_common.sh b/scripts/core/sxmo_common.sh index 33be11b..9db71ce 100644 --- a/scripts/core/sxmo_common.sh +++ b/scripts/core/sxmo_common.sh @@ -1,303 +1,206 @@ #!/usr/bin/env sh +# This script is meant to be sourced by various sxmo scripts +# and defines some common settings + +# we disable shellcheck SC2034 (variable not used) +# for all the variables we define here + +# shellcheck disable=SC2034 +NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications +# shellcheck disable=SC2034 +CACHEDIR="$XDG_CACHE_HOME"/sxmo +# shellcheck disable=SC2034 +LOGDIR="$XDG_DATA_HOME"/sxmo/modem + # This script ensures all sxmo scripts are using the busybox version of -# coreutils rather than any other version that may be installed on the +# certain coreutils rather than any other version that may be installed on the # user's computer - -alias acpid="busybox acpid" -alias add-shell="busybox shell" -alias addgroup="busybox addgroup" -alias adduser="busybox adduser" -alias adjtimex="busybox adjtimex" -alias arch="busybox arch" -alias arp="busybox arp" -alias arping="busybox arping" -alias ash="busybox ash" -alias awk="busybox awk" -alias base64="busybox base64" -alias basename="busybox basename" -alias bbconfig="busybox bbconfig" -alias bc="busybox bc" -alias beep="busybox beep" -alias blkdiscard="busybox blkdiscard" -alias blkid="busybox blkid" -alias blockdev="busybox blockdev" -alias brctl="busybox brctl" -alias bunzip2="busybox bunzip2" -alias bzcat="busybox bzcat" -alias bzip2="busybox bzip2" -alias cal="busybox cal" -alias cat="busybox cat" -alias chgrp="busybox chgrp" -alias chmod="busybox chmod" -alias chown="busybox chown" -alias chpasswd="busybox chpasswd" -alias chroot="busybox chroot" -alias chvt="busybox chvt" -alias cksum="busybox cksum" -alias clear="busybox clear" -alias cmp="busybox cmp" -alias comm="busybox comm" -alias cp="busybox cp" -alias cpio="busybox cpio" -alias crond="busybox crond" -alias crontab="busybox crontab" -alias cryptpw="busybox cryptpw" -alias cut="busybox cut" -alias date="busybox date" -alias dc="busybox dc" -alias dd="busybox dd" -alias deallocvt="busybox deallocvt" -alias delgroup="busybox delgroup" -alias deluser="busybox deluser" -alias depmod="busybox depmod" -alias df="busybox df" -alias diff="busybox diff" -alias dirname="busybox dirname" -alias dmesg="busybox dmesg" -alias dnsdomainname="busybox dnsdomainname" -alias dos2unix="busybox dos2unix" -alias du="busybox du" -alias dumpkmap="busybox dumpkmap" -alias echo="busybox echo" -alias ed="busybox ed" -alias egrep="busybox egrep" -alias eject="busybox eject" -alias env="busybox env" -alias ether-wake="busybox wake" -alias expand="busybox expand" -alias expr="busybox expr" -alias factor="busybox factor" -alias fallocate="busybox fallocate" -alias false="busybox false" -alias fatattr="busybox fatattr" -alias fbset="busybox fbset" -alias fbsplash="busybox fbsplash" -alias fdflush="busybox fdflush" -alias fdisk="busybox fdisk" -alias fgrep="busybox fgrep" alias find="busybox find" -alias findfs="busybox findfs" -alias flock="busybox flock" -alias fold="busybox fold" -alias free="busybox free" -alias fsck="busybox fsck" -alias fstrim="busybox fstrim" -alias fsync="busybox fsync" -alias fuser="busybox fuser" -alias getopt="busybox getopt" -alias getty="busybox getty" -alias grep="busybox grep" -alias groups="busybox groups" -alias gunzip="busybox gunzip" -alias gzip="busybox gzip" -alias halt="busybox halt" -alias hd="busybox hd" -alias head="busybox head" -alias hexdump="busybox hexdump" -alias hostid="busybox hostid" -alias hostname="busybox hostname" -alias hwclock="busybox hwclock" -alias id="busybox id" -alias ifconfig="busybox ifconfig" -alias ifdown="busybox ifdown" -alias ifenslave="busybox ifenslave" -alias ifup="busybox ifup" -alias init="busybox init" -alias inotifyd="busybox inotifyd" -alias insmod="busybox insmod" -alias install="busybox install" -alias ionice="busybox ionice" -alias iostat="busybox iostat" -alias ip="busybox ip" -alias ipaddr="busybox ipaddr" -alias ipcalc="busybox ipcalc" -alias ipcrm="busybox ipcrm" -alias ipcs="busybox ipcs" -alias iplink="busybox iplink" -alias ipneigh="busybox ipneigh" -alias iproute="busybox iproute" -alias iprule="busybox iprule" -alias iptunnel="busybox iptunnel" -alias kbd_mode="busybox mode" -alias kill="busybox kill" -alias killall, killall5="busybox killall5" -alias klogd="busybox klogd" -alias less="busybox less" -alias link="busybox link" -alias linux32="busybox linux32" -alias linux64="busybox linux64" -alias ln="busybox ln" -alias loadfont="busybox loadfont" -alias loadkmap="busybox loadkmap" -alias logger="busybox logger" -alias login="busybox login" -alias logread="busybox logread" -alias losetup="busybox losetup" -alias ls="busybox ls" -alias lsmod="busybox lsmod" -alias lsof="busybox lsof" -alias lsusb="busybox lsusb" -alias lzcat="busybox lzcat" -alias lzma="busybox lzma" -alias lzop="busybox lzop" -alias lzopcat="busybox lzopcat" -alias makemime="busybox makemime" -alias md5sum="busybox md5sum" -alias mdev="busybox mdev" -alias mesg="busybox mesg" -alias microcom="busybox microcom" -alias mkdir="busybox mkdir" -alias mkdosfs="busybox mkdosfs" -alias mkfifo="busybox mkfifo" -alias mkfs.vfat="busybox mkfs.vfat" -alias mknod="busybox mknod" -alias mkpasswd="busybox mkpasswd" -alias mkswap="busybox mkswap" -alias mktemp="busybox mktemp" -alias modinfo="busybox modinfo" -alias modprobe="busybox modprobe" -alias more="busybox more" -alias mount="busybox mount" -alias mountpoint="busybox mountpoint" -alias mpstat="busybox mpstat" -alias mv="busybox mv" -alias nameif="busybox nameif" -alias nanddump="busybox nanddump" -alias nandwrite="busybox nandwrite" -alias nbd-client="busybox nbd" -alias nc="busybox nc" -alias netstat="busybox netstat" -alias nice="busybox nice" -alias nl="busybox nl" -alias nmeter="busybox nmeter" -alias nohup="busybox nohup" -alias nologin="busybox nologin" -alias nproc="busybox nproc" -alias nsenter="busybox nsenter" -alias nslookup="busybox nslookup" -alias ntpd="busybox ntpd" -alias od="busybox od" -alias openvt="busybox openvt" -alias partprobe="busybox partprobe" -alias passwd="busybox passwd" -alias paste="busybox paste" -alias pgrep="busybox pgrep" -alias pidof="busybox pidof" -alias ping="busybox ping" -alias ping6="busybox ping6" -alias pipe_progress="busybox pipe" -alias pivot_root="busybox pivot" alias pkill="busybox pkill" -alias pmap="busybox pmap" -alias poweroff="busybox poweroff" -alias printenv="busybox printenv" -alias printf="busybox printf" -alias ps="busybox ps" -alias pscan="busybox pscan" -alias pstree="busybox pstree" -alias pwd="busybox pwd" -alias pwdx="busybox pwdx" -alias raidautorun="busybox raidautorun" -alias rdate="busybox rdate" -alias rdev="busybox rdev" -alias readahead="busybox readahead" -alias readlink="busybox readlink" -alias realpath="busybox realpath" -alias reboot="busybox reboot" -alias reformime="busybox reformime" -alias remove-shell="busybox remove-shell" -alias renice="busybox renice" -alias reset="busybox reset" -alias resize="busybox resize" -alias rev="busybox rev" -alias rfkill="busybox rfkill" -alias rm="busybox rm" -alias rmdir="busybox rmdir" -alias rmmod="busybox rmmod" -alias route="busybox route" -alias run-parts="busybox run" -alias sed="busybox sed" -alias sendmail="busybox sendmail" -alias seq="busybox seq" -alias setconsole="busybox setconsole" -alias setfont="busybox setfont" -alias setkeycodes="busybox setkeycodes" -alias setlogcons="busybox setlogcons" -alias setpriv="busybox setpriv" -alias setserial="busybox setserial" -alias setsid="busybox setsid" -alias sh="busybox sh" -alias sha1sum="busybox sha1sum" -alias sha256sum="busybox sha256sum" -alias sha3sum="busybox sha3sum" -alias sha512sum="busybox sha512sum" -alias showkey="busybox showkey" -alias shred="busybox shred" -alias shuf="busybox shuf" -alias slattach="busybox slattach" -alias sleep="busybox sleep" -alias sort="busybox sort" -alias split="busybox split" -alias stat="busybox stat" -alias strings="busybox strings" -alias stty="busybox stty" -alias su="busybox su" -alias sum="busybox sum" -alias swapoff="busybox swapoff" -alias swapon="busybox swapon" -alias switch_root="busybox switch" -alias sync="busybox sync" -alias sysctl="busybox sysctl" -alias syslogd="busybox syslogd" -alias tac="busybox tac" -alias tail="busybox tail" -alias tar="busybox tar" -alias tee="busybox tee" -alias test="busybox test" -alias time="busybox time" -alias timeout="busybox timeout" -alias top="busybox top" -alias touch="busybox touch" -alias tr="busybox tr" -alias traceroute="busybox traceroute" -alias traceroute6="busybox traceroute6" -alias true="busybox true" -alias truncate="busybox truncate" -alias tty="busybox tty" -alias ttysize="busybox ttysize" -alias tunctl="busybox tunctl" -alias udhcpc="busybox udhcpc" -alias udhcpc6="busybox udhcpc6" -alias umount="busybox umount" -alias uname="busybox uname" -alias unexpand="busybox unexpand" -alias uniq="busybox uniq" -alias unix2dos="busybox unix2dos" -alias unlink="busybox unlink" -alias unlzma="busybox unlzma" -alias unlzop="busybox unlzop" -alias unshare="busybox unshare" -alias unxz="busybox unxz" -alias unzip="busybox unzip" -alias uptime="busybox uptime" -alias usleep="busybox usleep" -alias uudecode="busybox uudecode" -alias uuencode="busybox uuencode" -alias vconfig="busybox vconfig" -alias vi="busybox vi" -alias vlock="busybox vlock" -alias volname="busybox volname" -alias watch="busybox watch" -alias watchdog="busybox watchdog" -alias wc="busybox wc" -alias wget="busybox wget" -alias which="busybox which" -alias whoami="busybox whoami" -alias whois="busybox whois" -alias xargs="busybox xargs" -alias xxd="busybox xxd" -alias xzcat="busybox xzcat" -alias yes="busybox yes" -alias zca="busybox zca" +alias pgrep="busybox pgrep" + +#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 + +# shellcheck disable=SC2034 +icon_itm="" #item (default) +# shellcheck disable=SC2034 +icon_trm='' #terminal +# shellcheck disable=SC2034 +icon_vim='' +# shellcheck disable=SC2034 +icon_tgm='' #telegram +# shellcheck disable=SC2034 +icon_gps='' #gps +# shellcheck disable=SC2034 +icon_msg="" #text +# shellcheck disable=SC2034 +icon_pwr="⏻" #power +# shellcheck disable=SC2034 +icon_cfg="" #configuration cog +# shellcheck disable=SC2034 +icon_cls="" #close +# shellcheck disable=SC2034 +icon_phn="" #phone +# shellcheck disable=SC2034 +icon_dir="" #directory folder +# shellcheck disable=SC2034 +icon_fil="" #file +# shellcheck disable=SC2034 +icon_grd="" +# shellcheck disable=SC2034 +icon_mnu="" +# shellcheck disable=SC2034 +icon_cam="" +# shellcheck disable=SC2034 +icon_net="" +# shellcheck disable=SC2034 +icon_bel="" +# shellcheck disable=SC2034 +icon_mic="" +# shellcheck disable=SC2034 +icon_mmc="" +# shellcheck disable=SC2034 +icon_mus="" +# shellcheck disable=SC2034 +icon_mut="" #mute +# shellcheck disable=SC2034 +icon_spk="" #speaker +# shellcheck disable=SC2034 +icon_img="" +# shellcheck disable=SC2034 +icon_usr="" +# shellcheck disable=SC2034 +icon_tmr="" #timer +# shellcheck disable=SC2034 +icon_arl="" +# shellcheck disable=SC2034 +icon_arr="" +# shellcheck disable=SC2034 +icon_aru="" +# shellcheck disable=SC2034 +icon_ard="" +# shellcheck disable=SC2034 +icon_ac1="" +# shellcheck disable=SC2034 +icon_ac2="" +# shellcheck disable=SC2034 +icon_ac3="" +# shellcheck disable=SC2034 +icon_ac4="" +# shellcheck disable=SC2034 +icon_mov="" +# shellcheck disable=SC2034 +icon_shr="" #shrink +# shellcheck disable=SC2034 +icon_exp="" #expand +# shellcheck disable=SC2034 +icon_zmi="" +# shellcheck disable=SC2034 +icon_zmo="" +# shellcheck disable=SC2034 +icon_hom="" +# shellcheck disable=SC2034 +icon_rld="" +# shellcheck disable=SC2034 +icon_hdp="" #headphones +# shellcheck disable=SC2034 +icon_lck="" +# shellcheck disable=SC2034 +icon_rss="" +# shellcheck disable=SC2034 +icon_lnk="" +# shellcheck disable=SC2034 +icon_cpy="" +# shellcheck disable=SC2034 +icon_pst="" +# shellcheck disable=SC2034 +icon_fnd="" #search/find +# shellcheck disable=SC2034 +icon_win="" #window +# shellcheck disable=SC2034 +icon_tab="" +# shellcheck disable=SC2034 +icon_flt="" #filter/pipe +# shellcheck disable=SC2034 +icon_glb="" #globe +# shellcheck disable=SC2034 +icon_phl="'" #phonelog +# shellcheck disable=SC2034 +icon_inf="" #info +# shellcheck disable=SC2034 +icon_fll="" #flashlight +# shellcheck disable=SC2034 +icon_clk="" +# shellcheck disable=SC2034 +icon_rol="" #rotate left +# shellcheck disable=SC2034 +icon_ror="" #rotate right +# shellcheck disable=SC2034 +icon_upc="" #up in circle +# shellcheck disable=SC2034 +icon_zzz="" #sleep/suspend/crust +# shellcheck disable=SC2034 +icon_out="" #logout +# shellcheck disable=SC2034 +icon_ytb="" #youtube +# shellcheck disable=SC2034 +icon_wtr="" #weather +# shellcheck disable=SC2034 +icon_red="" #reddit +# shellcheck disable=SC2034 +icon_vid="" #video +# shellcheck disable=SC2034 +icon_mvi="" #movie +# shellcheck disable=SC2034 +icon_clc="" #calculator +# shellcheck disable=SC2034 +icon_eml="" #email +# shellcheck disable=SC2034 +icon_edt="" #editor +# shellcheck disable=SC2034 +icon_ffx="" #firefox +# shellcheck disable=SC2034 +icon_ffw="'" #fast forward +# shellcheck disable=SC2034 +icon_fbw="" +# shellcheck disable=SC2034 +icon_pau="" +# shellcheck disable=SC2034 +icon_a2y="⇅" +# shellcheck disable=SC2034 +icon_a2x="⇄" +# shellcheck disable=SC2034 +icon_sav="" #save +# shellcheck disable=SC2034 +icon_ret="" #return +# shellcheck disable=SC2034 +icon_nxt="" #next +# shellcheck disable=SC2034 +icon_prv="" #previous +# shellcheck disable=SC2034 +icon_stp="" #stop +# shellcheck disable=SC2034 +icon_sfl="" #shuffle, random +# shellcheck disable=SC2034 +icon_lst="" #list +# shellcheck disable=SC2034 +icon_kbd="" #keyboard +# shellcheck disable=SC2034 +icon_del="﫧" #delete +# shellcheck disable=SC2034 +icon_grp="" #group +# shellcheck disable=SC2034 +icon_snd="" #send +# shellcheck disable=SC2034 +icon_phx="" #hangup +# shellcheck disable=SC2034 +icon_wn2="" + +#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/core/sxmo_icons.sh b/scripts/core/sxmo_icons.sh deleted file mode 100644 index 8b8b699..0000000 --- a/scripts/core/sxmo_icons.sh +++ /dev/null @@ -1,96 +0,0 @@ -#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 f4e35ce..41de0bd 100755 --- a/scripts/modem/sxmo_modemcall.sh +++ b/scripts/modem/sxmo_modemcall.sh @@ -1,13 +1,10 @@ #!/usr/bin/env sh -LOGDIR="$XDG_DATA_HOME"/sxmo/modem -NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications 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" +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" modem_n() { MODEMS="$(mmcli -L)" diff --git a/scripts/modem/sxmo_modemlog.sh b/scripts/modem/sxmo_modemlog.sh index 8205939..0143964 100755 --- a/scripts/modem/sxmo_modemlog.sh +++ b/scripts/modem/sxmo_modemlog.sh @@ -1,3 +1,7 @@ #!/usr/bin/env sh -LOGDIR="$XDG_DATA_HOME"/sxmo/modem + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + st -f "Terminus-14" -e tail -n9999 -f "$LOGDIR"/modemlog.tsv diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh index 5be5174..65d4b69 100755 --- a/scripts/modem/sxmo_modemmonitor.sh +++ b/scripts/modem/sxmo_modemmonitor.sh @@ -1,9 +1,10 @@ #!/usr/bin/env sh -LOGDIR="$XDG_DATA_HOME"/sxmo/modem -NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications -CACHEDIR="$XDG_CACHE_HOME"/sxmo trap "gracefulexit" INT TERM +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + err() { echo "sxmo_modemmonitor: Error: $1">&2 notify-send "$1" diff --git a/scripts/modem/sxmo_modemmonitortoggle.sh b/scripts/modem/sxmo_modemmonitortoggle.sh index 56b8253..7c76055 100755 --- a/scripts/modem/sxmo_modemmonitortoggle.sh +++ b/scripts/modem/sxmo_modemmonitortoggle.sh @@ -4,13 +4,16 @@ # It optionally takes a parameter "on" or "off" # forcing it to toggle only to that desired state if applicable. +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + if [ "$1" != "on" ] && pgrep -f sxmo_modemmonitor.sh; then pgrep -f sxmo_modemmonitor.sh | grep -Ev "^${$}$" | xargs -IP kill -TERM P elif [ "$1" != "off" ]; then setsid -f sxmo_modemmonitor.sh & fi -NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications rm "$NOTIFDIR"/incomingcall* # E.g. wait until process killed or started -- maybe there's a better way.. diff --git a/scripts/modem/sxmo_modemsendsms.sh b/scripts/modem/sxmo_modemsendsms.sh index 68e9625..90d3285 100755 --- a/scripts/modem/sxmo_modemsendsms.sh +++ b/scripts/modem/sxmo_modemsendsms.sh @@ -1,5 +1,8 @@ #!/usr/bin/env sh -LOGDIR="$XDG_DATA_HOME"/sxmo/modem + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" info() { echo "$1" > /dev/stderr diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index 4d8f1b3..e9c981a 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -1,12 +1,12 @@ #!/usr/bin/env sh -LOGDIR="$XDG_DATA_HOME"/sxmo/modem + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" + 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 "$@" @@ -17,7 +17,7 @@ menu() { err() { echo "$1">&2 - echo "$1" | menu dmenu -fn Terminus-20 -c -l 10 + echo "$1" | menu dmenu -c -l 10 kill $$ } diff --git a/scripts/notifications/sxmo_notificationmonitor.sh b/scripts/notifications/sxmo_notificationmonitor.sh index af4d00e..53dbed1 100755 --- a/scripts/notifications/sxmo_notificationmonitor.sh +++ b/scripts/notifications/sxmo_notificationmonitor.sh @@ -1,6 +1,9 @@ #!/usr/bin/env sh trap gracefulexit INT TERM -NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" gracefulexit() { echo "Gracefully exiting $0" diff --git a/scripts/notifications/sxmo_notificationsmenu.sh b/scripts/notifications/sxmo_notificationsmenu.sh index edd7630..0ee8283 100755 --- a/scripts/notifications/sxmo_notificationsmenu.sh +++ b/scripts/notifications/sxmo_notificationsmenu.sh @@ -1,9 +1,8 @@ #!/usr/bin/env sh -NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications -DIR=$(dirname "$0") -# shellcheck source=./sxmo_icons.sh -. "$DIR/sxmo_icons.sh" +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" notificationmenu() { CHOICES="$icon_cls Close Menu\n$icon_del Clear Notifications" diff --git a/scripts/notifications/sxmo_notificationwrite.sh b/scripts/notifications/sxmo_notificationwrite.sh index 62f05f9..782a491 100755 --- a/scripts/notifications/sxmo_notificationwrite.sh +++ b/scripts/notifications/sxmo_notificationwrite.sh @@ -1,5 +1,8 @@ #!/usr/bin/env sh -NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications + +# include common definitions +# shellcheck source=scripts/core/sxmo_common.sh +. "$(dirname "$0")/sxmo_common.sh" # Takes 4 args: # (1) the filepath of the notification to write (or random to generate a random id)