hypr: move session daemons from exec-once to systemd user services
Replace the hl.exec_cmd autostart block with declarative home-manager services so the desktop shell has proper ordering and lifecycle: - services.hyprpaper (with settings) for hyprpaper - services.cliphist for the text/image clipboard watchers - services.hyprpolkitagent for the polkit agent - programs.quickshell.systemd for the quickshell shell - a hand-written systemd.user.services.mako (home-manager has no unit) All are tied to config.wayland.systemd.target (graphical-session.target), which start-hyprland already activates. No UWSM required.
This commit is contained in:
@@ -18,6 +18,7 @@ in
|
||||
./hyprlock.nix
|
||||
./hypridle.nix
|
||||
./quickshell.nix
|
||||
./services.nix
|
||||
];
|
||||
|
||||
home.packages = with pkgs; [
|
||||
@@ -25,24 +26,32 @@ in
|
||||
grim
|
||||
slurp
|
||||
wl-clipboard
|
||||
cliphist
|
||||
brightnessctl
|
||||
jq
|
||||
|
||||
# Desktop Environment / Hyprland ecosystem
|
||||
hyprpaper
|
||||
hyprpolkitagent
|
||||
];
|
||||
|
||||
# Build-time rendered wallpaper
|
||||
xdg.dataFile."backgrounds/silicon-volt.png".source = wallpaper;
|
||||
|
||||
# hyprpaper: load the Silicon Volt wallpaper on every output
|
||||
xdg.configFile."hypr/hyprpaper.conf".text = ''
|
||||
preload = ${config.home.homeDirectory}/.local/share/backgrounds/silicon-volt.png
|
||||
wallpaper = ,${config.home.homeDirectory}/.local/share/backgrounds/silicon-volt.png
|
||||
splash = false
|
||||
'';
|
||||
# hyprpaper: load the Silicon Volt wallpaper on every output. The
|
||||
# home-manager module writes hypr/hyprpaper.conf and runs the daemon as a
|
||||
# systemd user service tied to the Wayland session.
|
||||
services.hyprpaper = {
|
||||
enable = true;
|
||||
settings = {
|
||||
splash = false;
|
||||
preload = "${config.home.homeDirectory}/.local/share/backgrounds/silicon-volt.png";
|
||||
wallpaper = [
|
||||
{
|
||||
monitor = "";
|
||||
path = "${config.home.homeDirectory}/.local/share/backgrounds/silicon-volt.png";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Notifications: flat brutalist-glass cards with volt accents
|
||||
services.mako = {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
@@ -282,24 +281,12 @@ in
|
||||
];
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# 6. Autostart Daemons & Apps (hl.on)
|
||||
# 6. Autostart Daemons & Apps
|
||||
# -----------------------------------------------------------------------
|
||||
on = [
|
||||
{
|
||||
_args = [
|
||||
"hyprland.start"
|
||||
(mkLua ''
|
||||
function()
|
||||
hl.exec_cmd("qs")
|
||||
hl.exec_cmd("hyprpaper")
|
||||
hl.exec_cmd("mako")
|
||||
hl.exec_cmd("wl-paste --type text --watch cliphist store")
|
||||
hl.exec_cmd("wl-paste --type image --watch cliphist store")
|
||||
hl.exec_cmd("${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent")
|
||||
end'')
|
||||
];
|
||||
}
|
||||
];
|
||||
# Desktop daemons (quickshell, hyprpaper, mako, cliphist and the
|
||||
# polkit agent) are declared as systemd user services in
|
||||
# home/hypr/services.nix and home/hypr/quickshell.nix, tied to the
|
||||
# Wayland session target instead of exec-once.
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# 7. Keybindings (hl.bind)
|
||||
|
||||
@@ -14,11 +14,6 @@ let
|
||||
(pkgs.quickshell or pkgs.qt6.qtbase);
|
||||
in
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
quickshellPkg
|
||||
qt6.qtwayland
|
||||
];
|
||||
|
||||
# Quickshell overview module for Hyprland (Super+Tab workspace overview).
|
||||
# Vendored from: https://github.com/Shanu-Kumawat/quickshell-overview
|
||||
# Placed at the quickshell config root so a bare `qs` finds shell.qml.
|
||||
@@ -26,4 +21,15 @@ in
|
||||
source = ./quickshell;
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
# Run quickshell as a systemd user service tied to the Wayland session.
|
||||
programs.quickshell = {
|
||||
enable = true;
|
||||
package = quickshellPkg;
|
||||
systemd.enable = true;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
qt6.qtwayland
|
||||
];
|
||||
}
|
||||
|
||||
37
home/hypr/services.nix
Normal file
37
home/hypr/services.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
# The Wayland session target used by the home-manager Wayland modules
|
||||
# (resolves to graphical-session.target). start-hyprland activates it.
|
||||
sessionTarget = config.wayland.systemd.target;
|
||||
in
|
||||
{
|
||||
# PolicyKit agent (replaces the old hl.exec_cmd autostart).
|
||||
services.hyprpolkitagent.enable = true;
|
||||
|
||||
# Clipboard history. The module runs both the text and image watchers as
|
||||
# systemd user services and adds the cliphist package.
|
||||
services.cliphist.enable = true;
|
||||
|
||||
# mako has no systemd service in home-manager, so declare one here.
|
||||
# Configuration lives next to the rest of the desktop theme in default.nix.
|
||||
systemd.user.services.mako = {
|
||||
Unit = {
|
||||
Description = "mako notification daemon";
|
||||
After = [ sessionTarget ];
|
||||
PartOf = [ sessionTarget ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.mako}/bin/mako";
|
||||
Restart = "always";
|
||||
RestartSec = 2;
|
||||
};
|
||||
|
||||
Install.WantedBy = [ sessionTarget ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user