feat(nix): improve swww-daemon user service

This commit is contained in:
Price Hiller 2024-04-19 04:50:24 -05:00
parent 107ab1fefd
commit 9d18ed882f
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB

View File

@ -430,8 +430,20 @@ in {
};
services = {
swww-daemon = {
Service = {
Service =
let
cleanup-socket-script = pkgs.writeShellScript "swww-daemon-cleanup-socket" ''
# Remove the existing swww.socket if it exists, avoids some issues with swww-daemon
# startup where swww-daemon claims the address is already in use
if [[ -w "$XDG_RUNTIME_DIR/swww.socket" ]]; then
rm -f $XDG_RUNTIME_DIR/swww.socket || exit 1
fi
'';
in {
RestartSec = 3;
PassEnvironment = [ "XDG_RUNTIME_DIR" ];
ExecStartPre = "${cleanup-socket-script}";
ExecStopPost = "${cleanup-socket-script}";
ExecStart = "${pkgs.swww}/bin/swww-daemon";
};
Install.WantedBy = [ "compositor.target" ];