2023-09-24 17:48:18 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
2023-10-08 17:12:53 +00:00
|
|
|
#!nix-shell -i bash -p systemd -p xdg-user-dirs
|
2023-09-05 17:20:48 +00:00
|
|
|
# this is based on upstream sxmo-utils sxmo_hook_start.sh
|
|
|
|
# but modified for nixos integration and specialize a bit to my needs
|
|
|
|
. sxmo_common.sh
|
|
|
|
|
|
|
|
# Create xdg user directories, such as ~/Pictures
|
|
|
|
xdg-user-dirs-update
|
|
|
|
|
2023-10-08 17:12:53 +00:00
|
|
|
sxmo_daemons.sh start daemon_manager
|
2023-09-05 17:20:48 +00:00
|
|
|
|
|
|
|
# Periodically update some status bar components
|
|
|
|
sxmo_hook_statusbar.sh all
|
|
|
|
sxmo_daemons.sh start statusbar_periodics sxmo_run_aligned.sh 60 \
|
|
|
|
sxmo_hook_statusbar.sh periodics
|
|
|
|
|
2023-10-08 17:12:53 +00:00
|
|
|
# TODO: start these externally, via `wantedBy` in nix
|
|
|
|
# don't: mako is managed externally
|
2023-09-05 17:46:01 +00:00
|
|
|
# superctl start mako
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start sxmo_wob
|
|
|
|
systemctl --user start sxmo_menumode_toggler
|
|
|
|
systemctl --user start bonsaid
|
2023-09-05 17:20:48 +00:00
|
|
|
# don't: sway background is managed externally
|
2023-09-05 17:46:01 +00:00
|
|
|
# swaymsg output '*' bg "$SXMO_BG_IMG" fill
|
2023-09-05 17:20:48 +00:00
|
|
|
|
|
|
|
# To setup initial lock state
|
2023-09-12 10:06:01 +00:00
|
|
|
sxmo_state_switch.sh set unlock
|
2023-09-05 17:20:48 +00:00
|
|
|
|
|
|
|
# Turn on auto-suspend
|
|
|
|
if [ -w "/sys/power/wakeup_count" ] && [ -f "/sys/power/wake_lock" ]; then
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start sxmo_autosuspend
|
2023-09-05 17:20:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Turn on lisgd
|
|
|
|
if [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start sxmo_hook_lisgd
|
2023-09-05 17:20:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$(command -v ModemManager)" ]; then
|
|
|
|
# Turn on the dbus-monitors for modem-related tasks
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start sxmo_modemmonitor
|
2023-09-05 17:20:48 +00:00
|
|
|
|
|
|
|
# place a wakelock for 120s to allow the modem to fully warm up (eg25 +
|
|
|
|
# elogind/systemd would do this for us, but we don't use those.)
|
|
|
|
sxmo_wakelock.sh lock sxmo_modem_warming_up 120s
|
|
|
|
fi
|
|
|
|
|
|
|
|
# don't: conky is managed externally
|
2023-09-05 17:46:01 +00:00
|
|
|
# superctl start sxmo_conky
|
2023-09-05 17:20:48 +00:00
|
|
|
|
|
|
|
# Monitor the battery
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start sxmo_battery_monitor
|
2023-09-05 17:20:48 +00:00
|
|
|
|
|
|
|
# It watch network changes and update the status bar icon by example
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start sxmo_networkmonitor
|
2023-09-05 17:20:48 +00:00
|
|
|
|
|
|
|
# The daemon that display notifications popup messages
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start sxmo_notificationmonitor
|
2023-09-05 17:20:48 +00:00
|
|
|
|
|
|
|
# monitor for headphone for statusbar
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start sxmo_soundmonitor
|
2023-09-05 17:20:48 +00:00
|
|
|
|
|
|
|
# rotate UI based on physical display angle by default
|
|
|
|
if [ -n "$SXMO_AUTOROTATE" ]; then
|
2023-09-05 17:46:01 +00:00
|
|
|
# TODO: this could use ~/.cache/sxmo/sxmo.autorotate like for lisgd above
|
2023-09-05 17:20:48 +00:00
|
|
|
sxmo_daemons.sh start autorotate sxmo_autorotate.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Play a funky startup tune if you want (disabled by default)
|
|
|
|
#mpv --quiet --no-video ~/welcome.ogg &
|
|
|
|
|
|
|
|
# mmsd and vvmd
|
|
|
|
if [ -f "${SXMO_MMS_BASE_DIR:-"$HOME"/.mms/modemmanager}/mms" ]; then
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start mmsd-tng
|
2023-09-05 17:20:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "${SXMO_VVM_BASE_DIR:-"$HOME"/.vvm/modemmanager}/vvm" ]; then
|
2023-10-08 17:12:53 +00:00
|
|
|
systemctl --user start vvmd
|
2023-09-05 17:20:48 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# add some warnings if things are not setup correctly
|
|
|
|
if ! command -v "sxmo_deviceprofile_$SXMO_DEVICE_NAME.sh"; then
|
|
|
|
sxmo_notify_user.sh --urgency=critical \
|
|
|
|
"No deviceprofile found $SXMO_DEVICE_NAME. See: https://sxmo.org/deviceprofile"
|
|
|
|
fi
|
|
|
|
|
|
|
|
sxmo_migrate.sh state || sxmo_notify_user.sh --urgency=critical \
|
|
|
|
"Config needs migration" "$? file(s) in your sxmo configuration are out of date and disabled - using defaults until you migrate (run sxmo_migrate.sh)"
|