Refactor xinit to be more structured and set $EDITOR if unset to vis

master
Miles Alan 4 years ago
parent d2ee25d724
commit 5c4c6c15e2
  1. 1
      scripts/appscripts/sxmo_files.sh
  2. 40
      scripts/core/sxmo_xinit.sh
  3. 3
      scripts/modem/sxmo_modemtext.sh

@ -1,5 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env sh
EDITOR=vis
DIR="$1" DIR="$1"
[ -z "$DIR" ] && DIR="/home/$USER/" [ -z "$DIR" ] && DIR="/home/$USER/"
cd "$DIR" || exit 1 cd "$DIR" || exit 1

@ -1,21 +1,25 @@
#!/usr/bin/env sh #!/usr/bin/env sh
# Env vars
envvars() {
# shellcheck disable=SC1091 # shellcheck disable=SC1091
. /etc/profile . /etc/profile
command -v "$TERM" || export TERM=st command -v "$TERM" || export TERM=st
command -v "$BROWSER" || export BROWSER=surf command -v "$BROWSER" || export BROWSER=surf
command -v "$EDITOR" || export EDITOR=vis
[ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1 [ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1
[ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME=~/.config [ -z "$XDG_CONFIG_HOME" ] && export XDG_CONFIG_HOME=~/.config
}
# Setup audio and a few sensible X defaults xdefaults() {
alsactl --file /usr/share/sxmo/alsa/default_alsa_sound.conf restore alsactl --file /usr/share/sxmo/alsa/default_alsa_sound.conf restore
xmodmap /usr/share/sxmo/appcfg/xmodmap_caps_esc xmodmap /usr/share/sxmo/appcfg/xmodmap_caps_esc
xsetroot -mod 3 2 -fg '#000000' -bg '#888888' xsetroot -mod 3 2 -fg '#000000' -bg '#888888'
xset s off -dpms xset s off -dpms
xrdb /usr/share/sxmo/appcfg/xresources_xcalc.xr xrdb /usr/share/sxmo/appcfg/xresources_xcalc.xr
synclient TapButton1=1 TapButton2=3 TapButton3=2 MinSpeed=0.25 synclient TapButton1=1 TapButton2=3 TapButton3=2 MinSpeed=0.25
}
# Start daemons daemons() {
pkill conky pkill conky
if [ -e "$XDG_CONFIG_HOME/sxmo/conky.conf" ]; then if [ -e "$XDG_CONFIG_HOME/sxmo/conky.conf" ]; then
conky -c $XDG_CONFIG_HOME/sxmo/conky.conf -d conky -c $XDG_CONFIG_HOME/sxmo/conky.conf -d
@ -26,15 +30,37 @@ keynav &
autocutsel & autocutsel &
autocutsel -selection PRIMARY & autocutsel -selection PRIMARY &
sxmo_statusbar.sh & sxmo_statusbar.sh &
}
# Run user's custom xinit daemonsneedingdbus() {
dunst -conf /usr/share/sxmo/appcfg/dunst.conf &
sxmo_lisgdstart.sh &
}
customxinit() {
set -o allexport set -o allexport
# shellcheck disable=SC1090
[ -f "$XDG_CONFIG_HOME/sxmo/xinit" ] && . "$XDG_CONFIG_HOME/sxmo/xinit" [ -f "$XDG_CONFIG_HOME/sxmo/xinit" ] && . "$XDG_CONFIG_HOME/sxmo/xinit"
set +o allexport set +o allexport
}
# Startup dbus, dunst in dbus path, lisgd in dbus path, and finally dwm startdwm() {
exec dbus-run-session sh -c " exec dbus-run-session sh -c "
dunst -conf /usr/share/sxmo/appcfg/dunst.conf & $0 daemonsneedingdbus;
sxmo_lisgdstart.sh & $0 customxinit;
dwm 2> ~/.dwm.log dwm 2> ~/.dwm.log
" "
}
xinit() {
envvars
xdefaults
daemons
startdwm
}
if [ -z "$1" ]; then
xinit
else
"$1"
fi

@ -1,5 +1,4 @@
#!/usr/bin/env sh #!/usr/bin/env sh
EDITOR=vis
LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem
err() { err() {
@ -16,7 +15,7 @@ modem_n() {
editmsg() { editmsg() {
TMP="$(mktemp --suffix "$1_msg")" TMP="$(mktemp --suffix "$1_msg")"
echo "$2" > "$TMP" echo "$2" > "$TMP"
TEXT="$(st -e $EDITOR "$TMP")" TEXT="$(st -e "$EDITOR" "$TMP")"
cat "$TMP" cat "$TMP"
} }

Loading…
Cancel
Save