wpaperd: add wpaperd configuration

Signed-off-by: Avimitin <dev@avimit.in>
This commit is contained in:
Avimitin 2023-09-28 10:47:55 +08:00 committed by Robert Helgesson
parent ae896c810f
commit 209a24dff2
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
8 changed files with 98 additions and 0 deletions

View file

@ -19,6 +19,12 @@
githubId = 56743515;
name = "Morgane Austreelis";
};
Avimitin = {
name = "Avimitin";
email = "dev@avimit.in";
github = "Avimitin";
githubId = 30021675;
};
blmhemu = {
name = "blmhemu";
email = "19410501+blmhemu@users.noreply.github.com";

View file

@ -1244,6 +1244,13 @@ in
A new module is available: 'programs.awscli'.
'';
}
{
time = "2023-10-01T07:23:26+00:00";
message = ''
A new module is available: 'programs.wpaperd'.
'';
}
];
};
}

View file

@ -224,6 +224,7 @@ let
./programs/wezterm.nix
./programs/wlogout.nix
./programs/wofi.nix
./programs/wpaperd.nix
./programs/xmobar.nix
./programs/xplr.nix
./programs/yazi.nix

View file

@ -0,0 +1,49 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.wpaperd;
tomlFormat = pkgs.formats.toml { };
in {
meta.maintainers = [ hm.maintainers.Avimitin ];
options.programs.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 {
home.packages = [ cfg.package ];
xdg.configFile = {
"wpaperd/wallpaper.toml" = mkIf (cfg.settings != { }) {
source = tomlFormat.generate "wpaperd-wallpaper" cfg.settings;
};
};
};
}

View file

@ -196,6 +196,7 @@ import nmt {
./modules/programs/waybar
./modules/programs/wlogout
./modules/programs/wofi
./modules/programs/wpaperd
./modules/programs/xmobar
./modules/programs/yt-dlp
./modules/services/avizo

View file

@ -0,0 +1 @@
{ wpaperd-example-settings = ./wpaperd-example-settings.nix; }

View file

@ -0,0 +1,26 @@
{ ... }:
{
config = {
programs.wpaperd = {
enable = true;
settings = {
eDP-1 = {
path = "/home/foo/Pictures/Wallpaper";
apply-shadow = true;
};
DP-2 = {
path = "/home/foo/Pictures/Anime";
sorting = "descending";
};
};
};
test.stubs.wpaperd = { };
nmt.script = ''
assertFileContent home-files/.config/wpaperd/wallpaper.toml \
${./wpaperd-expected-settings.toml}
'';
};
}

View file

@ -0,0 +1,7 @@
[DP-2]
path = "/home/foo/Pictures/Anime"
sorting = "descending"
[eDP-1]
apply-shadow = true
path = "/home/foo/Pictures/Wallpaper"