git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit10090ee19ee5c846e022020850303cee8180a208
parentefe120e5f4
authorLucas Galante <[email protected]>
date2026-08-16 11:12
Install D-Bus activation files crates ship in dbus/

A D-Bus activation file is how the Secret Service override works at all
(~/.local/share/dbus-1/services shadows /usr/share by basename), and it
was another hand-written unversioned file. <crate>/dbus/*.service now
installs like units and desktop entries, per-package filtered.
file_crate_dir learns to unwrap dbus/ like scripts/.

Co-Authored-By: Claude Fable 5 <[email protected]>

 scripts/ccebuild | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

diff --git a/scripts/ccebuild b/scripts/ccebuild
index b7bb713..1ac156a 100755
--- a/scripts/ccebuild
+++ b/scripts/ccebuild
@@ -30,6 +30,7 @@ PREFIX="${CCE_PREFIX:-$HOME/.local}"
 BINDIR="$PREFIX/bin"
 UNITDIR="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"
 DESKTOPDIR="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
+DBUSDIR="${XDG_DATA_HOME:-$HOME/.local/share}/dbus-1/services"
 
 die() { printf 'ccebuild: %s\n' "$*" >&2; exit 1; }
 
@@ -106,6 +107,17 @@ crate_scripts() {
         -not -path "$WS/target/*" 2>/dev/null
 }
 
+# D-Bus activation files a crate ships in its dbus/ dir, installed to
+# ~/.local/share/dbus-1/services where they shadow /usr/share ones by basename
+# (that shadowing is the mechanism: org.freedesktop.secrets.service overrides
+# gnome-keyring's with KeePassXC's unit). Same .service extension as systemd
+# units, but user_units() cannot mistake one for a unit: it keys on [Install]
+# WantedBy, which D-Bus files don't have.
+dbus_services() {
+    find "$WS" -mindepth 3 -maxdepth 3 -path '*/dbus/*.service' -type f \
+        -not -path "$WS/target/*" 2>/dev/null
+}
+
 # XDG .desktop entries shipped by crates, at the crate root next to Cargo.toml.
 #
 # These used to be hand-written straight into ~/.local/share/applications, which
@@ -127,7 +139,9 @@ desktop_entries() {
 file_crate_dir() {
     local dir
     dir=$(basename "$(dirname "$1")")
-    [ "$dir" = scripts ] && dir=$(basename "$(dirname "$(dirname "$1")")")
+    case "$dir" in
+        scripts|dbus) dir=$(basename "$(dirname "$(dirname "$1")")") ;;
+    esac
     printf '%s\n' "$dir"
 }
 
@@ -157,7 +171,7 @@ cmd_install() {
         fi
     fi
 
-    mkdir -p "$BINDIR" "$UNITDIR" "$DESKTOPDIR"
+    mkdir -p "$BINDIR" "$UNITDIR" "$DESKTOPDIR" "$DBUSDIR"
     local n=0 missing=()
 
     printf '==> installing binaries -> %s\n' "$BINDIR"
@@ -204,6 +218,18 @@ cmd_install() {
     done < <(user_units)
     [ "$units" -gt 0 ] && { systemctl --user daemon-reload 2>/dev/null || true; }
 
+    local b dbus=0
+    while read -r b; do
+        [ -n "$b" ] || continue
+        # Same filtered install as the units above.
+        if [ ${#pkgs[@]} -gt 0 ]; then
+            crate_selected "$(file_crate_dir "$b")" "${pkgs[@]}" || continue
+        fi
+        [ "$dbus" -eq 0 ] && printf '==> installing dbus activation files -> %s\n' "$DBUSDIR"
+        install -m 644 "$b" "$DBUSDIR/$(basename "$b")"
+        dbus=$((dbus + 1))
+    done < <(dbus_services)
+
     local d desktops=0
     while read -r d; do
         [ -n "$d" ] || continue