Compare commits

...
2 Commits
Author SHA1 Message Date
gitops 75267c5977 Seed ~/.config from the skeleton, so a new machine has a desktop
A machine that had never run HyprCosmic logged in to a bare compositor:
running, holding the display and accepting input, with nothing drawn on
the screen and no binding that opened anything. waybar, the wallpaper and
every keybinding come from ~/.config/hyprcosmic/autostart, and the package
created no such file -- it shipped /usr/share/hyprcosmic and left the home
directory to the reader of a README.

Nothing reported an error, because as far as the session was concerned
nothing had gone wrong, which is what makes it worth handling here rather
than in a note.

Only missing files are copied and an existing one is never touched, not
even when the skeleton is newer: the file wins, one way, and a login is
not an invitation to edit somebody's config. So this is safe on every
start, and deleting a file is how you ask for the default back.

Guarded throughout, like the log above it. A session that cannot seed
should still start.
2026-08-11 18:15:30 +07:00
gitops d65baf688c Start this fork's own binaries, not the distribution's
start-hyprcosmic now execs /usr/bin/hyprcosmic-session with
/usr/bin/hyprcosmic-comp as argv[1], leaving the cosmic-* paths to the
distribution's packages.

Taking the cosmic-* names meant erasing the distribution's compositor and
session to install this fork, which on Fedora also erases cosmic-greeter --
the display manager. cosmic-session already takes the compositor as argv[1],
so pairing the two here needs no source change.
2026-08-11 14:29:50 +07:00
+56 -5
View File
@@ -56,16 +56,25 @@ if [[ -z "${HYPRCOSMIC_LOGIN_SHELL:-}" && -n "${SHELL:-}" && -x "${SHELL}" ]]; t
esac
fi
# The binaries. HyprCosmic replaces COSMIC rather than installing beside it, so
# these are the ordinary paths -- this fork's cosmic-session *is* the machine's
# cosmic-session, and there is no second copy under a private prefix.
# The binaries, under their own names. HyprCosmic installs beside COSMIC rather
# than over it: these are this fork's builds, and /usr/bin/cosmic-session and
# /usr/bin/cosmic-comp are left to the distribution's packages.
#
# That is what keeps the stock session on the greeter's menu and working. The
# alternative -- taking the cosmic-* names -- means erasing the distribution's
# compositor and session to install this, which on Fedora also means erasing
# cosmic-greeter, which is the display manager. A fork that can only be tried by
# removing the desktop it forked is a fork nobody can back out of.
#
# cosmic-session takes the compositor as argv[1], so the pairing is arranged
# here and needs no patch: see the exec at the end of this file.
#
# Still named in variables rather than called bare. Two reasons: the check below
# can then say which path was missing, and both stay overridable from the
# environment, which is how the session is run out of a build tree without
# installing it.
HYPRCOSMIC_SESSION_BIN="${HYPRCOSMIC_SESSION_BIN:-/usr/bin/cosmic-session}"
HYPRCOSMIC_COMP_BIN="${HYPRCOSMIC_COMP_BIN:-/usr/bin/cosmic-comp}"
HYPRCOSMIC_SESSION_BIN="${HYPRCOSMIC_SESSION_BIN:-/usr/bin/hyprcosmic-session}"
HYPRCOSMIC_COMP_BIN="${HYPRCOSMIC_COMP_BIN:-/usr/bin/hyprcosmic-comp}"
if [[ ! -x "$HYPRCOSMIC_SESSION_BIN" ]]; then
echo "start-hyprcosmic: $HYPRCOSMIC_SESSION_BIN is missing or not executable" >&2
@@ -103,6 +112,48 @@ if mkdir -p "$(dirname "$HYPRCOSMIC_LOG")" 2>/dev/null; then
fi
fi
# Seed the per-user configuration from the skeleton the package ships.
#
# waybar, the wallpaper and every keybinding come from
# ~/.config/hyprcosmic/autostart. A machine that has never run HyprCosmic has no
# such file, and what starts is a bare compositor: running, holding the display,
# accepting input, with nothing drawn on the screen and no binding that opens
# anything. Nothing reports an error, because as far as the session is concerned
# nothing has gone wrong -- which is what makes it worth handling here rather
# than in a note in the README.
#
# Only missing files are copied, and an existing one is never touched, not even
# when the skeleton is newer. The file wins, one way; a login is not an
# invitation to edit somebody's config. Two things follow from that: this is
# safe to run on every session start, and deleting a file is how you ask for the
# default back.
#
# Guarded throughout, like the log above. A session that cannot seed should
# still start -- the user is no worse off than before this ran.
HYPRCOSMIC_SKEL="${HYPRCOSMIC_SKEL:-/usr/share/hyprcosmic/skel}"
HYPRCOSMIC_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
if [[ -d "$HYPRCOSMIC_SKEL" ]]; then
# Paths under the skeleton mirror the layout under ~/.config exactly, so
# the destination is the relative path and nothing here needs a list of
# which file goes where.
while IFS= read -r -d '' src; do
rel="${src#"$HYPRCOSMIC_SKEL"/}"
dest="$HYPRCOSMIC_CONFIG_HOME/$rel"
if [[ -e "$dest" ]]; then
continue
fi
# Every branch is an if rather than a && chain: set -e is on, and a
# trailing false would take the whole session down with it.
if mkdir -p "$(dirname "$dest")" 2>/dev/null && cp "$src" "$dest" 2>/dev/null; then
echo " seeded: $dest"
else
echo " seed failed: $dest"
fi
done < <(find "$HYPRCOSMIC_SKEL" -type f -print0 2>/dev/null | sort -z)
else
echo " no skeleton at $HYPRCOSMIC_SKEL; ~/.config is left as it is"
fi
# Selects the component set in cosmic-session's profile module: cosmic-panel,
# cosmic-launcher, cosmic-app-library, cosmic-workspaces, cosmic-bg and
# cosmic-files-applet are skipped; waybar and friends come from