diff --git a/scripts/appscripts/sxmo_files.sh b/scripts/appscripts/sxmo_files.sh index 9da2540..9e48471 100755 --- a/scripts/appscripts/sxmo_files.sh +++ b/scripts/appscripts/sxmo_files.sh @@ -1,5 +1,4 @@ #!/usr/bin/env sh -EDITOR=vis DIR="$1" [ -z "$DIR" ] && DIR="/home/$USER/" cd "$DIR" || exit 1 diff --git a/scripts/core/sxmo_xinit.sh b/scripts/core/sxmo_xinit.sh index f00a78a..3a061d4 100755 --- a/scripts/core/sxmo_xinit.sh +++ b/scripts/core/sxmo_xinit.sh @@ -1,40 +1,66 @@ #!/usr/bin/env sh -# Env vars -# shellcheck disable=SC1091 -. /etc/profile -command -v "$TERM" || export TERM=st -command -v "$BROWSER" || export BROWSER=surf -[ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1 -[ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME=~/.config - -# Setup audio and a few sensible X defaults -alsactl --file /usr/share/sxmo/alsa/default_alsa_sound.conf restore -xmodmap /usr/share/sxmo/appcfg/xmodmap_caps_esc -xsetroot -mod 3 2 -fg '#000000' -bg '#888888' -xset s off -dpms -xrdb /usr/share/sxmo/appcfg/xresources_xcalc.xr -synclient TapButton1=1 TapButton2=3 TapButton3=2 MinSpeed=0.25 - -# Start daemons -pkill conky -if [ -e "$XDG_CONFIG_HOME/sxmo/conky.conf" ]; then - conky -c $XDG_CONFIG_HOME/sxmo/conky.conf -d -else - conky -c /usr/share/sxmo/appcfg/conky.conf -d -fi -keynav & -autocutsel & -autocutsel -selection PRIMARY & -sxmo_statusbar.sh & - -# Run user's custom xinit -set -o allexport -[ -f "$XDG_CONFIG_HOME/sxmo/xinit" ] && . "$XDG_CONFIG_HOME/sxmo/xinit" -set +o allexport - -# Startup dbus, dunst in dbus path, lisgd in dbus path, and finally dwm -exec dbus-run-session sh -c " + +envvars() { + # shellcheck disable=SC1091 + . /etc/profile + command -v "$TERM" || export TERM=st + command -v "$BROWSER" || export BROWSER=surf + command -v "$EDITOR" || export EDITOR=vis + [ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1 + [ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME=~/.config +} + +xdefaults() { + alsactl --file /usr/share/sxmo/alsa/default_alsa_sound.conf restore + xmodmap /usr/share/sxmo/appcfg/xmodmap_caps_esc + xsetroot -mod 3 2 -fg '#000000' -bg '#888888' + xset s off -dpms + xrdb /usr/share/sxmo/appcfg/xresources_xcalc.xr + synclient TapButton1=1 TapButton2=3 TapButton3=2 MinSpeed=0.25 +} + +daemons() { + pkill conky + if [ -e "$XDG_CONFIG_HOME/sxmo/conky.conf" ]; then + conky -c $XDG_CONFIG_HOME/sxmo/conky.conf -d + else + conky -c /usr/share/sxmo/appcfg/conky.conf -d + fi + keynav & + autocutsel & + autocutsel -selection PRIMARY & + sxmo_statusbar.sh & +} + +daemonsneedingdbus() { dunst -conf /usr/share/sxmo/appcfg/dunst.conf & sxmo_lisgdstart.sh & - dwm 2> ~/.dwm.log -" +} + +customxinit() { + set -o allexport + # shellcheck disable=SC1090 + [ -f "$XDG_CONFIG_HOME/sxmo/xinit" ] && . "$XDG_CONFIG_HOME/sxmo/xinit" + set +o allexport +} + +startdwm() { + exec dbus-run-session sh -c " + $0 daemonsneedingdbus; + $0 customxinit; + dwm 2> ~/.dwm.log + " +} + +xinit() { + envvars + xdefaults + daemons + startdwm +} + +if [ -z "$1" ]; then + xinit +else + "$1" +fi diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index 7c1b409..05614e9 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -1,5 +1,4 @@ #!/usr/bin/env sh -EDITOR=vis LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem err() { @@ -16,7 +15,7 @@ modem_n() { editmsg() { TMP="$(mktemp --suffix "$1_msg")" echo "$2" > "$TMP" - TEXT="$(st -e $EDITOR "$TMP")" + TEXT="$(st -e "$EDITOR" "$TMP")" cat "$TMP" }