From cfe97a7c4f7fc5cce985798fd5f0dfbaca394995 Mon Sep 17 00:00:00 2001 From: Breadway Date: Wed, 17 Jun 2026 14:47:58 +0800 Subject: [PATCH] Run breadd as a systemd user service by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Best practice for the long-running bread daemon: ship an enabled user unit in skel (~/.config/systemd/user/breadd.service + default.target.wants symlink) instead of a bare Hyprland exec-once. Gives crash-restart, journald logging (journalctl --user -u breadd), and proper lifecycle. - ExecStart uses %h so it works for any account created from skel (not a hardcoded home). - RuntimeDirectoryPreserve=yes so restarting breadd doesn't wipe the shared theme.css that bread-theme writes into /run/user//bread. - hyprland.lua: replace the `breadd` exec-once with a Wayland-env import (dbus-update-activation-environment) + `systemctl --user restart breadd`, so the service — which autostarts at login before Hyprland exists — picks up HYPRLAND_INSTANCE_SIGNATURE and can drive the compositor. Co-Authored-By: Claude Opus 4.8 --- .../etc/skel/.config/hypr/hyprland.lua | 7 ++++++- .../skel/.config/systemd/user/breadd.service | 21 +++++++++++++++++++ .../user/default.target.wants/breadd.service | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 iso/airootfs/etc/skel/.config/systemd/user/breadd.service create mode 120000 iso/airootfs/etc/skel/.config/systemd/user/default.target.wants/breadd.service diff --git a/iso/airootfs/etc/skel/.config/hypr/hyprland.lua b/iso/airootfs/etc/skel/.config/hypr/hyprland.lua index c7ce981..dbd75a5 100644 --- a/iso/airootfs/etc/skel/.config/hypr/hyprland.lua +++ b/iso/airootfs/etc/skel/.config/hypr/hyprland.lua @@ -203,7 +203,12 @@ hl.on("hyprland.start", function() "awww-daemon", -- set the default wallpaper once the daemon is up (retry until ready) [[bash -c 'until awww img /usr/share/backgrounds/bos/bread-background.png 2>/dev/null; do sleep 0.3; done']], - "breadd", + -- breadd runs as a systemd user service (~/.config/systemd/user/breadd.service, + -- enabled in skel). It autostarts at login but before Hyprland exists, so + -- push the compositor's Wayland env into the user manager and restart breadd + -- to pick it up — that's how it gets HYPRLAND_INSTANCE_SIGNATURE to talk to Hyprland. + "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP HYPRLAND_INSTANCE_SIGNATURE", + "systemctl --user restart breadd", "breadbar", "breadbox-sync", "hypridle", diff --git a/iso/airootfs/etc/skel/.config/systemd/user/breadd.service b/iso/airootfs/etc/skel/.config/systemd/user/breadd.service new file mode 100644 index 0000000..49d6741 --- /dev/null +++ b/iso/airootfs/etc/skel/.config/systemd/user/breadd.service @@ -0,0 +1,21 @@ +[Unit] +Description=Bread Runtime Daemon + +[Service] +Type=simple +# %h = the user's home — works for any account created from this skel. +ExecStart=%h/.local/bin/breadd +Restart=on-failure +RestartSec=2 +UMask=0077 +RuntimeDirectory=bread +RuntimeDirectoryMode=0700 +# Keep /run/user//bread across restarts so the shared theme.css that +# bread-theme writes there (and the daemon socket) survive a `restart breadd`. +RuntimeDirectoryPreserve=yes +KillSignal=SIGTERM +TimeoutStopSec=5 +Environment=RUST_LOG=info + +[Install] +WantedBy=default.target diff --git a/iso/airootfs/etc/skel/.config/systemd/user/default.target.wants/breadd.service b/iso/airootfs/etc/skel/.config/systemd/user/default.target.wants/breadd.service new file mode 120000 index 0000000..c858aeb --- /dev/null +++ b/iso/airootfs/etc/skel/.config/systemd/user/default.target.wants/breadd.service @@ -0,0 +1 @@ +../breadd.service \ No newline at end of file