gui(niri): Use waypaper to play wallpaper instead of swaybg

This commit is contained in:
ulic-youthlic 2025-07-01 19:23:25 +08:00
parent 2688e918d9
commit 9e7124071b
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
4 changed files with 47 additions and 3 deletions

View file

@ -34,7 +34,7 @@
polkit-kde-agent = getExe' pkgs.kdePackages.polkit-kde-agent-1 "polkit-kde-agent";
wpctl = getExe' pkgs.wireplumber "wpctl";
swaybg = getExe pkgs.swaybg;
waypaper = getExe pkgs.waypaper;
alacritty = getExe config.programs.alacritty.package;
wl-paste = getExe' pkgs.wl-clipboard "wl-paste";
cliphist = getExe' pkgs.cliphist "cliphist";
@ -386,7 +386,7 @@ in
(flag "prefer-no-csd")
(spawn-at-startup [waybar])
(spawn-at-startup [swaync])
(spawn-at-startup [swaybg "-i" "${config.home.homeDirectory}/wallpaper/01.png"])
(spawn-at-startup [waypaper "--restore"])
(spawn-at-startup [polkit-kde-agent])
(spawn-at-startup [wl-paste "--watch" cliphist "store"])
(spawn-at-startup [wl-clip-persist "--clipboard" "regular"])

View file

@ -31,5 +31,6 @@
./eza.nix
./ion.nix
./alacritty
./waypaper.nix
];
}

View file

@ -26,7 +26,6 @@ in {
home.packages =
(with pkgs; [
swaynotificationcenter
swaybg
kdePackages.polkit-kde-agent-1
wl-clipboard
cliphist
@ -65,6 +64,7 @@ in {
waybar.enable = true;
swaync.enable = true;
swaylock.enable = true;
waypaper.enable = true;
};
programs.niri = {
config = cfg.config;

View file

@ -0,0 +1,43 @@
{
lib,
config,
pkgs,
...
}: let
cfg = config.youthlic.programs.waypaper;
in {
options = {
youthlic.programs.waypaper = {
enable = lib.mkEnableOption "waypaper";
};
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [waypaper socat mpvpaper];
systemd.user = {
timers."waypaper" = {
Unit = {
Description = "Set a random wallpaper every 10 minutes";
};
Timer = {
Persistent = true;
OnCalendar = "*:0/10";
};
Install = {
WantedBy = ["timers.target"];
};
};
services."waypaper" = {
Unit = {
Description = "Set a random wallpaper with waypaper";
};
Service = {
Type = "oneshot";
ExecStart = lib.escapeShellArgs [
(lib.getExe pkgs.waypaper)
"--random"
];
};
};
};
};
}