1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
envvars() {
export SXMO_WM=sway
export MOZ_ENABLE_WAYLAND=1
export SDL_VIDEODRIVER=wayland
export XDG_CURRENT_DESKTOP=sway
# shellcheck disable=SC2086
command -v $TERMCMD "" >/dev/null || export TERMCMD="foot"
command -v "$KEYBOARD" >/dev/null || export KEYBOARD=wvkbd-mobintl
[ -z "$MOZ_USE_XINPUT2" ] && export MOZ_USE_XINPUT2=1
}
defaults() {
[ -e "$HOME"/.Xresources ] && xrdb -merge "$HOME"/.Xresources
}
with_dbus() {
echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
exec sway -c "$XDG_CONFIG_HOME/sxmo/sway"
}
start() {
[ -f "$XDG_STATE_HOME"/sxmo.log ] && mv "$XDG_STATE_HOME"/sxmo.log "$XDG_STATE_HOME"/sxmo.log.old
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
dbus-run-session -- "$0" "with_dbus"
else
# with_dbus calls exec because dbus-run-session starts it in a
# new shell, but we need to keep this shell; start a subshell
( with_dbus )
fi
}
cleanup() {
sxmo_daemons.sh stop all
pkill bemenu
pkill wvkbd
pkill superd
}
init() {
# shellcheck source=/dev/null
. /etc/profile.d/sxmo_init.sh
_sxmo_load_environments
_sxmo_prepare_dirs
envvars
sxmo_migrate.sh sync
defaults
# shellcheck disable=SC1090,SC1091
. "$XDG_CONFIG_HOME/sxmo/profile"
cleanup
start
cleanup
sxmo_hook_stop.sh
}
if [ -z "$1" ]; then
init
else
"$1"
fi
|