Migrate graphical-session services to systemd
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -2,6 +2,14 @@
|
||||
|
||||
let
|
||||
hmConfig = config.home-manager.users.${user.name};
|
||||
themeSwww = lib.meta.getExe (pkgs.writeShellApplication {
|
||||
name = "theme-swww";
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils-full
|
||||
swww
|
||||
];
|
||||
text = "exec swww img \"${hmConfig.theme.configDir}/wallpaper\"";
|
||||
});
|
||||
in
|
||||
{
|
||||
home-manager.users.${user.name} = {
|
||||
@@ -10,27 +18,34 @@ in
|
||||
persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/swww" ];
|
||||
};
|
||||
|
||||
wayland.windowManager.hyprland.initExtraConfig = "${lib.meta.getExe (pkgs.writeShellApplication {
|
||||
name = "init-swww";
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils-full
|
||||
swww
|
||||
];
|
||||
text = ''
|
||||
swww-daemon &> /tmp/swww.log
|
||||
systemd.user.services.swww = {
|
||||
Unit = {
|
||||
Description = "Wallpaper daemon";
|
||||
BindsTo = [ "graphical-session.target" ];
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
while ! swww query &> /dev/null; do
|
||||
sleep 0.1
|
||||
done
|
||||
Service = {
|
||||
Type = "forking";
|
||||
|
||||
swww img "${hmConfig.theme.configDir}/wallpaper"
|
||||
'';
|
||||
})} &";
|
||||
ExecStart = lib.meta.getExe (pkgs.writeShellApplication {
|
||||
name = "init-swww";
|
||||
runtimeInputs = with pkgs; [ swww ];
|
||||
text = "exec swww init";
|
||||
});
|
||||
|
||||
theme.extraConfig = lib.mkAfter "${lib.meta.getExe (pkgs.writeShellApplication {
|
||||
name = "theme-swww";
|
||||
runtimeInputs = with pkgs; [ swww ];
|
||||
text = "swww img \"${hmConfig.theme.configDir}/wallpaper\"";
|
||||
})} &";
|
||||
ExecStartPost = themeSwww;
|
||||
|
||||
ExecStop = lib.meta.getExe (pkgs.writeShellApplication {
|
||||
name = "kill-swww";
|
||||
runtimeInputs = with pkgs; [ swww ];
|
||||
text = "exec swww kill";
|
||||
});
|
||||
};
|
||||
|
||||
Install.WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
theme.extraConfig = lib.mkAfter "${themeSwww} &";
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user