quickshell: run as systemd service, auto-restart on config change

Replace hl.exec_cmd("qs") with a systemd user service bound to
hyprland-session.target. xdg.configFile onChange restarts the
service when the QML config changes during a rebuild.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
rope 2026-05-26 17:30:13 +01:00
parent 53c9abb11a
commit 0b9f981ed2

View file

@ -239,7 +239,6 @@ in
-- Ensure hyprland-session.target starts even if HM's -- Ensure hyprland-session.target starts even if HM's
-- dbus-update-activation-environment chain fails upstream. -- dbus-update-activation-environment chain fails upstream.
hl.exec_cmd("systemctl --user start hyprland-session.target") hl.exec_cmd("systemctl --user start hyprland-session.target")
hl.exec_cmd("qs")
hl.exec_cmd("mako") hl.exec_cmd("mako")
hl.exec_cmd("wl-paste --type text --watch cliphist store") hl.exec_cmd("wl-paste --type text --watch cliphist store")
@ -428,7 +427,24 @@ in
# Hyprland session so they don't crash-loop in a GNOME session. # Hyprland session so they don't crash-loop in a GNOME session.
wayland.systemd.target = "hyprland-session.target"; wayland.systemd.target = "hyprland-session.target";
systemd.user.services.quickshell = {
Unit = {
Description = "Quickshell desktop shell";
PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.quickshell}/bin/qs";
Restart = "on-failure";
RestartSec = 2;
};
Install.WantedBy = [ "hyprland-session.target" ];
};
xdg.configFile."quickshell/shell.qml" = { xdg.configFile."quickshell/shell.qml" = {
onChange = ''
${pkgs.systemd}/bin/systemctl --user restart quickshell.service 2>/dev/null || true
'';
text = '' text = ''
//@ pragma UseQApplication //@ pragma UseQApplication
import Quickshell import Quickshell