A/B measure and reject additional VM/sysctl/mount tweaks that did not improve idle without trade-offs. Remove sxmo_networkmonitor's long-lived nmcli device monitor, replace it with NetworkManager dispatcher hooks that run Sxmo network/statusbar hooks as the X session user, disable the superd unit in both start hooks, guard it in check-rebuild.sh, update docs, rebuild the image, and verify live Wi-Fi reconnect and idle context switches.
52 lines
1.8 KiB
Bash
Executable File
52 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# NetworkManager dispatcher helper: run Sxmo network hooks as the X session
|
|
# user. The dispatcher runs as root; keeping status files user-owned avoids
|
|
# breaking sxmo_status.sh, dmenu and the status bar after a network event.
|
|
set -u
|
|
|
|
DEVICE="${1:-}"
|
|
ACTION="${2:-}"
|
|
[ -n "$DEVICE" ] && [ -n "$ACTION" ] || exit 0
|
|
|
|
export HOME=/home/user
|
|
export USER=user
|
|
export LOGNAME=user
|
|
export SHELL=/bin/ash
|
|
export XDG_RUNTIME_DIR=/run/user/10000
|
|
export XDG_CONFIG_HOME=/home/user/.config
|
|
export XDG_CACHE_HOME=/home/user/.cache
|
|
export XDG_DATA_HOME=/home/user/.local/share
|
|
export XDG_STATE_HOME=/home/user/.local/state
|
|
export SXMO_WM=dwm
|
|
export SXMO_STATE=/run/user/10000/sxmo.state
|
|
export SXMO_STATUS_NAME=default
|
|
export DISPLAY=:0
|
|
export PATH="/home/user/.local/bin:/home/user/.config/sxmo/hooks:/usr/share/sxmo/default_hooks:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin"
|
|
|
|
TYPE="$(nmcli -g GENERAL.TYPE device show "$DEVICE" 2>/dev/null || true)"
|
|
[ -n "$TYPE" ] || TYPE=unknown
|
|
|
|
case "$ACTION" in
|
|
up|vpn-up)
|
|
sxmo_hook_network_up.sh "$DEVICE" "$TYPE" >/dev/null 2>&1 || true
|
|
sxmo_hook_statusbar.sh network "$TYPE" "$DEVICE" >/dev/null 2>&1 || true
|
|
;;
|
|
down|vpn-down)
|
|
sxmo_hook_network_down.sh "$DEVICE" "$TYPE" >/dev/null 2>&1 || true
|
|
sxmo_hook_statusbar.sh network "$TYPE" "$DEVICE" >/dev/null 2>&1 || true
|
|
;;
|
|
pre-up|vpn-pre-up)
|
|
sxmo_hook_network_pre_up.sh "$DEVICE" "$TYPE" >/dev/null 2>&1 || true
|
|
sxmo_hook_statusbar.sh network "$TYPE" "$DEVICE" >/dev/null 2>&1 || true
|
|
;;
|
|
pre-down|vpn-pre-down)
|
|
sxmo_hook_network_pre_down.sh "$DEVICE" "$TYPE" >/dev/null 2>&1 || true
|
|
sxmo_hook_statusbar.sh network "$TYPE" "$DEVICE" >/dev/null 2>&1 || true
|
|
;;
|
|
connectivity-change|dhcp4-change|dhcp6-change|dns-change)
|
|
sxmo_hook_statusbar.sh network "$TYPE" "$DEVICE" >/dev/null 2>&1 || true
|
|
;;
|
|
*) exit 0 ;;
|
|
esac
|
|
exit 0
|