Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wpaperd: add systemd service; move to services/ from programs/ #6166

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions modules/misc/news.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,17 @@ in {
Cavalier is a GUI wrapper around the Cava audio visualizer.
'';
}

{
time = "2024-12-31T06:44:46+00:00";
condition = hostPlatform.isLinux;
message = ''
A new module is available: 'services.wpaperd'.

This replaces the existing module, 'programs.wpaperd', and adds a
systemd service to ensure its execution.
'';
}
];
};
}
2 changes: 1 addition & 1 deletion modules/modules.nix
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ let
./programs/wezterm.nix
./programs/wlogout.nix
./programs/wofi.nix
./programs/wpaperd.nix
./programs/xmobar.nix
./programs/xplr.nix
./programs/yambar.nix
Expand Down Expand Up @@ -407,6 +406,7 @@ let
./services/window-managers/xmonad.nix
./services/wlsunset.nix
./services/wob.nix
./services/wpaperd.nix
./services/xcape.nix
./services/xembed-sni-proxy.nix
./services/xidlehook.nix
Expand Down
49 changes: 0 additions & 49 deletions modules/programs/wpaperd.nix

This file was deleted.

85 changes: 85 additions & 0 deletions modules/services/wpaperd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.services.wpaperd;
tomlFormat = pkgs.formats.toml { };
in {
meta.maintainers = [ hm.maintainers.Avimitin ];

imports = [
(mkRenamedOptionModule # \
[ "programs" "wpaperd" "enable" ] # \
[ "services" "wpaperd" "enable" ])
(mkRenamedOptionModule # \
[ "programs" "wpaperd" "package" ] # \
[ "services" "wpaperd" "package" ])
(mkRenamedOptionModule # \
[ "programs" "wpaperd" "settings" ] # \
[ "services" "wpaperd" "settings" ])
];

options.services.wpaperd = {
enable = mkEnableOption "wpaperd";

package = mkPackageOption pkgs "wpaperd" { };

settings = mkOption {
type = tomlFormat.type;
default = { };
example = literalExpression ''
{
eDP-1 = {
path = "/home/foo/Pictures/Wallpaper";
apply-shadow = true;
};
DP-2 = {
path = "/home/foo/Pictures/Anime";
sorting = "descending";
};
}
'';
description = ''
Configuration written to
{file}`$XDG_CONFIG_HOME/wpaperd/wallpaper.toml`.
See <https://github.com/danyspin97/wpaperd#wallpaper-configuration>
for the full list of options.
'';
};
};

config = mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.wpaperd" pkgs
lib.platforms.linux)
];

home.packages = [ cfg.package ];

xdg.configFile = {
"wpaperd/wallpaper.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "wpaperd-wallpaper" cfg.settings;
};
};

systemd.user.services.wpaperd = {
Install = { WantedBy = [ "graphical-session.target" ]; };

Unit = {
ConditionEnvironment = "WAYLAND_DISPLAY";
Description = "wpaperd";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
X-Restart-Triggers =
[ "${config.xdg.configFile."wpaperd/wallpaper.toml".source}" ];
};

Service = {
ExecStart = "${getExe cfg.package}";
Restart = "always";
RestartSec = "10";
};
};
};
}
2 changes: 1 addition & 1 deletion tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ in import nmtSrc {
./modules/programs/waybar
./modules/programs/wlogout
./modules/programs/wofi
./modules/programs/wpaperd
./modules/programs/xmobar
./modules/programs/yambar
./modules/programs/yt-dlp
Expand Down Expand Up @@ -303,6 +302,7 @@ in import nmtSrc {
./modules/services/window-managers/sway
./modules/services/wlsunset
./modules/services/wob
./modules/services/wpaperd
./modules/services/xsettingsd
./modules/systemd
./modules/targets-linux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{
config = {
programs.wpaperd = {
services.wpaperd = {
enable = true;
settings = {
eDP-1 = {
Expand Down
Loading