Install as the session, at upstream's paths

Eight files: upstream's six, where upstream puts them, plus this fork's
start-hyprcosmic and hyprcosmic.desktop. Replaces the private libexec
prefix, matching the same change in cosmic-comp.

A machine that installs this gets its cosmic-session from here, so there
is nothing else on disk to provide the systemd target, the mimeapps list
or the dconf profile. Omitting them produced a session that started and
then had no user target for the portals to attach to, which surfaces much
later and much less clearly than a missing file.

Both session entries are installed and both are served by these binaries.
Replacing COSMIC need not mean removing its shell, and keeping
cosmic.desktop costs one file while preserving the one property worth
keeping from the beside-install layout: if the HyDE shell will not start,
there is still something on the greeter's menu that will.

start-hyprcosmic now names /usr/bin for both binaries, still through
overridable variables so the check below it can say which path was
missing and so the session still runs out of a build tree.

The dconf asymmetry is deliberate and now asserted in CI, because it is
easy to get backwards once both scripts are installed: start-cosmic is
sed'd to an absolute profile path, as upstream does; start-hyprcosmic is
not, because it searches /etc/dconf/profile and XDG_DATA_DIRS at runtime
and pinning a build prefix would break an administrator's override.
This commit is contained in:
2026-08-10 18:21:42 +07:00
parent 8ff1e72d3e
commit 73867a5d6a
3 changed files with 77 additions and 50 deletions
+28 -12
View File
@@ -131,24 +131,40 @@ jobs:
- name: Install into a staging root - name: Install into a staging root
run: just rootdir="$PWD/stage" install run: just rootdir="$PWD/stage" install
# These assertions are the "three files, not seven" commit as something # Eight files: upstream's six, at upstream's paths, plus this fork's two.
# executable. Upstream's recipe wrote /usr/bin/cosmic-session and # HyprCosmic replaces COSMIC rather than installing beside it, so nothing
# cosmic.desktop, which replaced the stock COSMIC session and left nothing # else on the machine provides the systemd target, the mimeapps list or
# to log into when the fork failed to start. The negative tests are the # the dconf profile -- a session that omits them starts, and then has no
# important half: it is the files that must NOT appear that made the old # user target for the portals to attach to, which surfaces much later and
# recipe dangerous. # much less clearly than a missing file would.
- name: Assert it installs beside COSMIC, not over it #
# Both session entries are asserted. Dropping cosmic.desktop would leave a
# machine whose only way in is the HyDE shell, and the last two lines are
# what stop the private libexec layout from creeping back.
- name: Assert it installs as the session, at upstream's paths
run: | run: |
set -eux set -eux
test -x stage/usr/libexec/hyprcosmic/cosmic-session test -x stage/usr/bin/cosmic-session
test -x stage/usr/bin/start-hyprcosmic test -x stage/usr/bin/start-hyprcosmic
test -x stage/usr/bin/start-cosmic
test -f stage/usr/share/wayland-sessions/hyprcosmic.desktop test -f stage/usr/share/wayland-sessions/hyprcosmic.desktop
test ! -e stage/usr/bin/cosmic-session test -f stage/usr/share/wayland-sessions/cosmic.desktop
test ! -e stage/usr/bin/start-cosmic test -f stage/usr/lib/systemd/user/cosmic-session.target
test ! -e stage/usr/share/wayland-sessions/cosmic.desktop test -f stage/usr/share/applications/cosmic-mimeapps.list
test ! -e stage/usr/share/applications/cosmic-mimeapps.list test -f stage/usr/share/dconf/profile/cosmic
test ! -e stage/usr/libexec/hyprcosmic/cosmic-session
find stage -type f -printf '%M %10s %P\n' find stage -type f -printf '%M %10s %P\n'
# Upstream rewrites DCONF_PROFILE to an absolute path in its own start
# script; this fork's searches for the profile at runtime instead. Both
# behaviours are deliberate, and the pair is easy to get backwards in a
# recipe that now installs both scripts.
- name: Assert the dconf rewrite hit start-cosmic and only start-cosmic
run: |
set -eux
grep -q 'DCONF_PROFILE=/usr/share/dconf/profile/cosmic' stage/usr/bin/start-cosmic
grep -q 'DCONF_PROFILE=cosmic$' stage/usr/bin/start-hyprcosmic
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
name: cosmic-session-${{ matrix.distro }} name: cosmic-session-${{ matrix.distro }}
+40 -30
View File
@@ -9,12 +9,6 @@ systemddir := usrdir / 'lib' / 'systemd' / 'user'
sessiondir := usrdir / 'share' / 'wayland-sessions' sessiondir := usrdir / 'share' / 'wayland-sessions'
applicationdir := usrdir / 'share' / 'applications' applicationdir := usrdir / 'share' / 'applications'
# The fork's own binary directory. It stays out of bindir for the same reason
# the compositor does: the distro's cosmic-session owns /usr/bin/cosmic-session,
# and overwriting it would break the stock session -- the one you need to log
# into when this one will not start.
privdir := usrdir / 'libexec' / 'hyprcosmic'
default: build-release default: build-release
build-debug *args: build-debug *args:
@@ -36,39 +30,55 @@ clean-dist: clean
# Installs files into the system # Installs files into the system
# #
# Three files, where upstream installs seven. The four that are gone are not # All six of upstream's, at upstream's paths, plus this fork's two. HyprCosmic
# oversights -- each is owned by the distro's own cosmic-session package, and # is a fork of COSMIC rather than something installed next to it, so a machine
# writing them from here would make a HyprCosmic package conflict with it: # that installs this gets its cosmic-session from here and there is nothing else
# on disk to provide the target, the mimeapps list or the dconf profile.
# #
# data/start-cosmic -> /usr/bin/start-cosmic # The two extra files are what make it a HyprCosmic install rather than a rebuilt
# data/cosmic-session.target -> systemd user target # COSMIC one:
# data/cosmic-mimeapps.list -> the default-applications list
# data/dconf/profile/cosmic -> the dconf profile
# #
# None of them are things this fork changes, and a HyprCosmic session needs # data/start-hyprcosmic -> /usr/bin/start-hyprcosmic
# stock COSMIC installed regardless, for the greeter, the portals and the # data/hyprcosmic.desktop -> a second entry on the greeter's menu
# settings daemon. So it reads that package's copies rather than shipping rival
# ones. `data/cosmic.desktop` is dropped for the same reason and replaced by
# hyprcosmic.desktop, which is what puts the second entry on the greeter's menu
# instead of overwriting the first.
# #
# Upstream's `sed` over DCONF_PROFILE is deliberately not carried across. # Both session entries are installed, and both are served by these same
# start-hyprcosmic searches /etc/dconf/profile and then XDG_DATA_DIRS for the # binaries. That is deliberate. Replacing COSMIC does not have to mean removing
# profile and exports the bare name only if it finds one; rewriting a prefix # its shell, and keeping cosmic.desktop costs one file while preserving the one
# into it would pin one location and break an administrator's /etc override. # property worth keeping from the old beside-install layout: if the HyDE shell
# The script says so at the point where it does the search. # will not start, there is still something on the greeter's menu that will.
install: install:
# main binary # main binary
install -Dm0755 {{ cargo-target-dir }}/release/cosmic-session {{ privdir }}/cosmic-session install -Dm0755 {{ cargo-target-dir }}/release/cosmic-session {{ bindir }}/cosmic-session
# session start script # session start scripts, this fork's and upstream's
install -Dm0755 data/start-hyprcosmic {{ bindir }}/start-hyprcosmic install -Dm0755 data/start-hyprcosmic {{ bindir }}/start-hyprcosmic
install -Dm0755 data/start-cosmic {{ bindir }}/start-cosmic
# session entry. Note that hyprcosmic.desktop names /usr/bin/start-hyprcosmic # Upstream rewrites DCONF_PROFILE in its own start script to an absolute
# as an absolute Exec: a .desktop file has no way to interpolate a prefix, # path under the build prefix. That is carried across for start-cosmic,
# so building with prefix != /usr installs an entry that points at a path # because it is upstream's file and diverging from it here would be a change
# this recipe did not write. # this fork has no reason to make.
#
# start-hyprcosmic is deliberately NOT sed'd. It searches /etc/dconf/profile
# and then XDG_DATA_DIRS and exports the bare profile name only if it finds
# one, which keeps an administrator's /etc override working; pinning a build
# prefix into it would break that. The script says so where it searches.
sed -i "s|DCONF_PROFILE=cosmic|DCONF_PROFILE={{ cosmic_dconf_profile }}|" {{ bindir }}/start-cosmic
# systemd user target
install -Dm0644 data/cosmic-session.target {{ systemddir }}/cosmic-session.target
# session entries. Note that both .desktop files name an absolute Exec under
# /usr/bin: a .desktop has no way to interpolate a prefix, so building with
# prefix != /usr installs entries pointing at paths this recipe did not write.
install -Dm0644 data/hyprcosmic.desktop {{ sessiondir }}/hyprcosmic.desktop install -Dm0644 data/hyprcosmic.desktop {{ sessiondir }}/hyprcosmic.desktop
install -Dm0644 data/cosmic.desktop {{ sessiondir }}/cosmic.desktop
# default applications
install -Dm0644 data/cosmic-mimeapps.list {{ applicationdir }}/cosmic-mimeapps.list
# dconf profile
install -Dm0644 data/dconf/profile/cosmic {{ rootdir }}/{{ cosmic_dconf_profile }}
# Vendor Cargo dependencies locally # Vendor Cargo dependencies locally
vendor: vendor:
+9 -8
View File
@@ -56,15 +56,16 @@ if [[ -z "${HYPRCOSMIC_LOGIN_SHELL:-}" && -n "${SHELL:-}" && -x "${SHELL}" ]]; t
esac esac
fi fi
# The forked binaries, installed alongside rather than over the stock ones. # 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.
# #
# Pointing at /usr/bin/cosmic-session here would be a silent no-op: the system # Still named in variables rather than called bare. Two reasons: the check below
# binary has no profile module, so the session would come up as ordinary COSMIC # can then say which path was missing, and both stay overridable from the
# and the gating would look broken. Installing to a private prefix instead of # environment, which is how the session is run out of a build tree without
# replacing /usr/bin also means `dnf update cosmic-session` cannot clobber the # installing it.
# fork, and the stock session entry keeps working as the escape hatch. HYPRCOSMIC_SESSION_BIN="${HYPRCOSMIC_SESSION_BIN:-/usr/bin/cosmic-session}"
HYPRCOSMIC_SESSION_BIN="${HYPRCOSMIC_SESSION_BIN:-/usr/libexec/hyprcosmic/cosmic-session}" HYPRCOSMIC_COMP_BIN="${HYPRCOSMIC_COMP_BIN:-/usr/bin/cosmic-comp}"
HYPRCOSMIC_COMP_BIN="${HYPRCOSMIC_COMP_BIN:-/usr/libexec/hyprcosmic/cosmic-comp}"
if [[ ! -x "$HYPRCOSMIC_SESSION_BIN" ]]; then if [[ ! -x "$HYPRCOSMIC_SESSION_BIN" ]]; then
echo "start-hyprcosmic: $HYPRCOSMIC_SESSION_BIN is missing or not executable" >&2 echo "start-hyprcosmic: $HYPRCOSMIC_SESSION_BIN is missing or not executable" >&2