Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
fix: route startcce through $HOME/XDG instead of a baked-in home directory
PATH, XCURSOR_PATH and both cce invocations hardcoded /home/lsgalante, so the session launcher only worked for one user on one machine — the DE-wide hardcoded-path problem, in the one file where it means the difference between logging in and not. Now $HOME throughout, with XCURSOR_PATH honoring $XDG_DATA_HOME when set. $HOME is safe to depend on: cce-display-manager sets it explicitly when it execs this script, and the default_terminal config read already relied on it.
The compositor path is resolved once into $CCE_BIN so the server launch and the client launcher written into /tmp cannot drift apart, and stays absolute rather than leaning on the PATH set just above — this is the one process a session cannot recover from failing to find. The launch heredoc keeps its unquoted delimiter so $CCE_BIN/$DEBUG_FLAG/$TERMINAL expand at write time into concrete values; that subtlety now carries a comment, because quoting the delimiter would ship a literal $CCE_BIN and no client would start.
Verified without ever running the script — it opens with killall cce cce-fx and truncates the live compositor log, so executing it would have taken the session down. Instead: sh -n, then a harness of the safe prefix (env block + heredoc, killall stripped, output redirected) run under a fake HOME. Expansions follow HOME, XDG_DATA_HOME overrides the icons path when set, and under the real HOME with no XDG_DATA_HOME — the actual login environment — PATH, XCURSOR_PATH, CCE_BIN and the generated exec line all come out byte-identical to the hardcoded values they replace.
Co-Authored-By: Claude <[email protected]>
scripts/startcce | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/scripts/startcce b/scripts/startcce
index 2345cff..99dd7b4 100755
--- a/scripts/startcce
+++ b/scripts/startcce
@@ -14,14 +14,22 @@ done
export XDG_RUNTIME_DIR=/run/user/$(id -u)
export XDG_CURRENT_DESKTOP=cce
export XDG_SESSION_TYPE=wayland
-export PATH="/home/lsgalante/.local/bin:$PATH"
+export PATH="$HOME/.local/bin:$PATH"
export XCURSOR_THEME="cce"
export XCURSOR_SIZE=24
-export XCURSOR_PATH="/home/lsgalante/.local/share/icons:/home/lsgalante/.icons:/usr/share/icons"
+export XCURSOR_PATH="${XDG_DATA_HOME:-$HOME/.local/share}/icons:$HOME/.icons:/usr/share/icons"
export WLR_NO_HARDWARE_CURSORS=1
export WLR_DRM_DEVICES=/dev/dri/card1
export VK_DRIVER_FILES=/usr/share/vulkan/icd.d/intel_icd.json
+# The compositor binary this session runs, resolved once so the server launch
+# and the client launcher written into /tmp cannot disagree. Absolute rather
+# than leaning on the PATH set above: this is the one process a session cannot
+# recover from failing to find. $HOME is guaranteed — cce-display-manager sets
+# it explicitly when it execs this script, and the config read below already
+# depends on it.
+CCE_BIN="$HOME/.local/bin/cce"
+
# The DE's default terminal (config.kdl `default_terminal`, set from the
# settings app) becomes $TERMINAL for the whole session, so non-cce tools
# that honor the convention agree with the launcher. A crude KDL read, but
@@ -50,11 +58,15 @@ if [ "$DEBUG" = true ]; then
DEBUG_FLAG="WAYLAND_DEBUG=1 "
fi
+# Unquoted delimiter on purpose: $DEBUG_FLAG, $TERMINAL and $CCE_BIN expand
+# HERE, so the generated script carries concrete values and depends on none of
+# this environment. Quoting LAUNCH_EOF would ship the literal '$CCE_BIN' and
+# the client would never start.
cat > /tmp/cce-launch.sh << LAUNCH_EOF
#!/bin/sh
systemctl --user import-environment DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP XDG_SESSION_TYPE XDG_SESSION_ID XDG_RUNTIME_DIR GNOME_KEYRING_CONTROL SSH_AUTH_SOCK${TERMINAL:+ TERMINAL}
systemctl --user start cce-session.target
-${DEBUG_FLAG}exec /home/lsgalante/.local/bin/cce client 2>/tmp/cce-client.log
+${DEBUG_FLAG}exec "$CCE_BIN" client 2>/tmp/cce-client.log
LAUNCH_EOF
chmod +x /tmp/cce-launch.sh
@@ -76,7 +88,7 @@ fi
> /tmp/cce.log
# Run CCE in the background so we can check if it exits immediately
-/home/lsgalante/.local/bin/cce ${LOG_LEVEL_FLAG} -c /tmp/cce-launch.sh 2>>/tmp/cce.log &
+"$CCE_BIN" ${LOG_LEVEL_FLAG} -c /tmp/cce-launch.sh 2>>/tmp/cce.log &
CCE_PID=$!
# Wait briefly to verify it launched successfully