From 1b78c3cf2f6885dd50b347dc1e38f77ef4c9934b Mon Sep 17 00:00:00 2001 From: Anjandev Momi Date: Thu, 4 Jun 2020 21:26:16 -0700 Subject: [PATCH] modem: use XDG_CONFIG_HOME to save logs Signed-off-by: Miles Alan --- scripts/core/sxmo_xinit.sh | 5 ++++- scripts/modem/sxmo_modemcall.sh | 2 +- scripts/modem/sxmo_modemlog.sh | 3 ++- scripts/modem/sxmo_modemmonitor.sh | 2 +- scripts/modem/sxmo_modemtext.sh | 4 ++-- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/core/sxmo_xinit.sh b/scripts/core/sxmo_xinit.sh index 17f6dff..1118411 100755 --- a/scripts/core/sxmo_xinit.sh +++ b/scripts/core/sxmo_xinit.sh @@ -3,6 +3,7 @@ source /etc/profile which $TERM || export TERM=st which $BROWSER || export BROWSER=surf [ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1 +[ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME=~/.config xmodmap /usr/share/sxmo/xmodmap_caps_esc xsetroot -mod 3 2 -fg '#000000' -bg '#888888' @@ -22,4 +23,6 @@ pkill lisgd conky -c /usr/share/sxmo/conky.conf -d autocutsel & autocutsel -selection PRIMARY & sxmo_statusbar.sh & -exec dbus-run-session sh -c "dunst -conf /usr/share/sxmo/dunst.conf & lisgd & dwm 2> ~/.dwm.log" +exec dbus-run-session sh -c "dunst -conf /usr/share/sxmo/dunst.conf & lisgd & +[ -d "~/.sxmo" ] && notify-send -t 0 -u critical '~/.sxmo is deprecated. To preserve your modem logs, please move the contents of the ~/.sxmo folder into the $XDG_CONFIG_HOME/sxmo/modem/ folder' & +dwm 2> ~/.dwm.log" diff --git a/scripts/modem/sxmo_modemcall.sh b/scripts/modem/sxmo_modemcall.sh index 5cfc441..0349fb6 100755 --- a/scripts/modem/sxmo_modemcall.sh +++ b/scripts/modem/sxmo_modemcall.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh PID=$$ -LOGDIR=/home/$USER/.sxmo +LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem trap "kill 0" SIGINT err() { diff --git a/scripts/modem/sxmo_modemlog.sh b/scripts/modem/sxmo_modemlog.sh index 8eae791..115c671 100755 --- a/scripts/modem/sxmo_modemlog.sh +++ b/scripts/modem/sxmo_modemlog.sh @@ -1,2 +1,3 @@ #!/usr/bin/env sh -st -fn "Terminus-14" -e tail -f ~/.sxmo/modemlog.tsv +LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem +st -fn "Terminus-14" -e tail -f "$LOGDIR"/modemlog.tsv diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh index 785d013..250fbbf 100755 --- a/scripts/modem/sxmo_modemmonitor.sh +++ b/scripts/modem/sxmo_modemmonitor.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh TIMEOUT=3 -LOGDIR=/home/$USER/.sxmo +LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem ACTIVECALL="NONE" trap "kill 0" SIGINT diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index 6473e08..a5fa280 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh EDITOR=vis -LOGDIR=/home/$USER/.sxmo +LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem err() { echo $1 | dmenu -fn Terminus-20 -c -l 10 @@ -90,4 +90,4 @@ main() { tailtextlog "$(echo $NUMBER | sed 's/ logfile//g')" } -main \ No newline at end of file +main