feat: add i3-style session-specific autostart support and documentation
This commit is contained in:
1 parent
f73040a0be
commit
8d6236a63f
13 files changed
+1156
-8
No files matched your search
@@ -4,8 +4,36 @@ set -u
|
||||
|
||||
: "${XDG_CONFIG_HOME:=$HOME/.config}"
|
||||
: "${ANODE_PREFIX:=/usr/local}"
|
||||
: "${XDG_CURRENT_DESKTOP:=ANODE}"
|
||||
: "${XDG_SESSION_DESKTOP:=anode}"
|
||||
: "${DESKTOP_SESSION:=anode}"
|
||||
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--profile)
|
||||
if [ $# -ge 2 ]; then
|
||||
ANODE_SESSION_PROFILE="$2"
|
||||
shift 2
|
||||
else
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
--profile=*)
|
||||
ANODE_SESSION_PROFILE="${1#--profile=}"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
export XDG_CURRENT_DESKTOP XDG_SESSION_DESKTOP DESKTOP_SESSION
|
||||
if [ -n "${ANODE_SESSION_PROFILE:-}" ]; then
|
||||
export ANODE_SESSION_PROFILE
|
||||
fi
|
||||
|
||||
# Ensure ANODE prefix binaries are on PATH
|
||||
case ":$PATH:" in
|
||||
*":$SCRIPT_DIR:"*) ;;
|
||||
@@ -67,6 +95,38 @@ if [ "${ANODE_TOUCH:-0}" = "1" ]; then
|
||||
spawn_bg anode-vkbd
|
||||
fi
|
||||
|
||||
# Seed default user autostart files on first session launch
|
||||
mkdir -p "$XDG_CONFIG_HOME/anode/autostart.d"
|
||||
if [ ! -e "$XDG_CONFIG_HOME/anode/autostart" ]; then
|
||||
for _tpl in "$ANODE_PREFIX/share/anode/autostart" "$SCRIPT_DIR/../share/anode/autostart" "$SCRIPT_DIR/../data/autostart"; do
|
||||
if [ -r "$_tpl" ]; then
|
||||
cp "$_tpl" "$XDG_CONFIG_HOME/anode/autostart" 2>/dev/null || true
|
||||
break
|
||||
fi
|
||||
done
|
||||
unset _tpl
|
||||
fi
|
||||
|
||||
# Launch i3-style and XDG session autostart entries once DWM is ready
|
||||
if command -v anode-autostart >/dev/null 2>&1; then
|
||||
(
|
||||
_i=0
|
||||
if command -v xprop >/dev/null 2>&1; then
|
||||
while [ "$_i" -lt 20 ]; do
|
||||
if xprop -root _NET_SUPPORTING_WM_CHECK 2>/dev/null | grep -q "window id"; then
|
||||
break
|
||||
fi
|
||||
_i=$(( _i + 1 ))
|
||||
sleep 0.1
|
||||
done
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
anode-autostart start
|
||||
) >/dev/null 2>&1 &
|
||||
BG_PIDS="$BG_PIDS $!"
|
||||
fi
|
||||
|
||||
if command -v dwm >/dev/null 2>&1; then
|
||||
dwm
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user