feat: Use upstream hyprpaper module
Some checks failed
Flake checker / Build Nix targets (push) Has been cancelled
Some checks failed
Flake checker / Build Nix targets (push) Has been cancelled
This commit is contained in:
@@ -4,25 +4,31 @@
|
||||
config,
|
||||
...
|
||||
}: {
|
||||
# imports = [
|
||||
# ../../modules/hyprpaper.nix
|
||||
# ];
|
||||
services.hyprpaper = let
|
||||
wallpapers = import ../../utils/wallhaven.nix {inherit pkgs;};
|
||||
nextcloudWallpapers = name: config.home.homeDirectory + "/Nextcloud/Wallpapers/" + name;
|
||||
silksongFleas = nextcloudWallpapers "silksong-fleas.jpg";
|
||||
silksongShadeLord = nextcloudWallpapers "silksong-shadelord.jpg";
|
||||
in rec {
|
||||
in {
|
||||
enable = device.is "ryu";
|
||||
systemd.enable = true;
|
||||
systemd.target = "hyprland-session.target";
|
||||
settings.preload =
|
||||
wallpapers.all
|
||||
++ pkgs.lib.mapAttrsToList (_: value: value) settings.wallpapers;
|
||||
settings.wallpapers = {
|
||||
"${device.monitors.primary}" = silksongShadeLord;
|
||||
"${device.monitors.secondary}" = wallpapers.frieren_3;
|
||||
"${device.monitors.tertiary}" = silksongFleas;
|
||||
settings = {
|
||||
wallpaper = [
|
||||
{
|
||||
monitor = device.monitors.primary;
|
||||
path = silksongShadeLord;
|
||||
fit_mode = "cover";
|
||||
}
|
||||
{
|
||||
monitor = device.monitors.secondary;
|
||||
path = wallpapers.frieren_3;
|
||||
fit_mode = "cover";
|
||||
}
|
||||
{
|
||||
monitor = device.monitors.tertiary;
|
||||
path = silksongFleas;
|
||||
fit_mode = "cover";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.programs.hyprpaper;
|
||||
in {
|
||||
options = {
|
||||
programs.hyprpaper = {
|
||||
enable = mkEnableOption "Hyprpaper - Wayland wallpaper utility";
|
||||
|
||||
systemd = {
|
||||
enable = mkEnableOption "autostart service for Hyprpaper";
|
||||
|
||||
target = mkOption {
|
||||
type = types.str;
|
||||
default = "graphical-session.target";
|
||||
example = "hyprland-session.target";
|
||||
description = ''
|
||||
The systemd target that will automatically start the Hyprpaper service.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settings = with types; {
|
||||
preload = mkOption {
|
||||
type = listOf path;
|
||||
default = [];
|
||||
description = ''
|
||||
Wallpaper images that should be preloaded into memory
|
||||
'';
|
||||
example = [./wallpapers/tensura.png];
|
||||
};
|
||||
|
||||
wallpapers = mkOption {
|
||||
type = attrsOf str;
|
||||
default = {};
|
||||
example = {"DP-1" = ./wallpapers/tensura.png;};
|
||||
description = ''
|
||||
Wallpaper to monitor mapper
|
||||
'';
|
||||
};
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = str;
|
||||
default = "";
|
||||
description = "Check https://github.com/hyprwm/hyprpaper#usage for info";
|
||||
example = ''
|
||||
newConfigOption = foo,bar
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
home.packages = mkIf cfg.enable [pkgs.hyprpaper];
|
||||
|
||||
systemd.user.services.hyprpaper = mkIf cfg.systemd.enable {
|
||||
Unit = {
|
||||
Description = "autostart service for Hyprpaper";
|
||||
Documentation = "https://github.com/hyprwm/hyprpaper";
|
||||
BindsTo = ["graphical-session.target"];
|
||||
After = ["graphical-session-pre.target"];
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.hyprpaper}/bin/hyprpaper";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
|
||||
Restart = "on-failure";
|
||||
KillMode = "mixed";
|
||||
};
|
||||
|
||||
Install = {WantedBy = [cfg.systemd.target];};
|
||||
};
|
||||
|
||||
xdg.configFile = mkIf cfg.enable {
|
||||
"hypr/hyprpaper.conf".text = ''
|
||||
# Auto-generated by Nix home-manager module
|
||||
|
||||
# hyprpaper.settings.preload
|
||||
${(lists.foldl (acc: v:
|
||||
acc
|
||||
+ ''
|
||||
preload = ${v}
|
||||
'') ""
|
||||
cfg.settings.preload)}
|
||||
|
||||
# hyprpaper.settings.wallpapers
|
||||
${(lists.foldl (acc: v:
|
||||
acc
|
||||
+ ''
|
||||
wallpaper = ${v}
|
||||
'') "" (pkgs.lib.attrsets.mapAttrsToList (name: val: name + "," + val)
|
||||
cfg.settings.wallpapers))}
|
||||
|
||||
# hyprpaper.settings.extraConfig
|
||||
${cfg.settings.extraConfig}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user