set wallpaper

This commit is contained in:
2025-10-29 20:42:17 +09:00
parent 262bb6821a
commit 5a70da2880
4 changed files with 84 additions and 15 deletions
-14
View File
@@ -1,14 +0,0 @@
{ pkgs, lib, ... }:
let
walls = pkgs.fetchFromGitHub {
owner = "orangci";
repo = "walls-catppuccin-mocha";
rev = "40912e6418737e93b59a38bcf189270cbf26656d";
hash = "sha256-1QR3J+wgLVNjucPSVELv0FicNt+jM2KPLU5ubBfxjHI="; # nix-shell -p nix-prefetch-github --run 'nix-prefetch-github orangci walls-catppuccin-mocha --rev 40912e6418737e93b59a38bcf189270cbf26656d'
};
in {
home.file."wallpapers" = {
source = walls;
recursive = true;
};
}
+70
View File
@@ -0,0 +1,70 @@
{ pkgs, lib, ... }:
let
walls = pkgs.fetchFromGitHub {
owner = "orangci";
repo = "walls-catppuccin-mocha";
rev = "40912e6418737e93b59a38bcf189270cbf26656d";
hash = "sha256-1QR3J+wgLVNjucPSVELv0FicNt+jM2KPLU5ubBfxjHI=";
};
in {
home.file."wallpapers" = {
source = walls;
recursive = true;
};
home.file.".local/bin/set-wallpaper.sh" = {
source = ./set-wallpaper.sh;
executable = true;
};
home.packages = with pkgs; [
swww
bash
findutils
coreutils
];
systemd.user.services.swww = {
Unit = {
Description = "swww daemon";
After = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.swww}/bin/swww-daemon";
Restart = "on-failure";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
systemd.user.services."wallpaper-rotate" = {
Unit = {
Description = "Rotate wallpaper via swww";
After = [ "swww.service" "graphical-session.target" ];
Wants = [ "swww.service" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.bash}/bin/bash -lc $HOME/.local/bin/set-wallpaper.sh";
};
Install = {
WantedBy = [ "default.target" ];
};
};
systemd.user.timers."wallpaper-rotate" = {
Unit = {
Description = "Change wallpaper every 1 minute";
};
Timer = {
OnBootSec = "30s";
OnUnitActiveSec = "1min";
Unit = "wallpaper-rotate.service";
Persistent = true;
};
Install = {
WantedBy = [ "timers.target" ];
};
};
}
+13
View File
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
# set-wallpaper.sh
set -euo pipefail
WALLS="${HOME}/wallpapers"
# Pick up wallpaper(jpg/jpeg/png/webp)
mapfile -t files < <(find "$WALLS" -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \))
[[ ${#files[@]} -gt 0 ]] || exit 0
pick="${files[RANDOM % ${#files[@]}]}"
exec swww img "$pick" --transition-type any --transition-step 90 --transition-fps 60
+1 -1
View File
@@ -16,6 +16,6 @@
./../modules/home/noctalia.nix ./../modules/home/noctalia.nix
./../modules/home/avatar.nix ./../modules/home/avatar.nix
./../modules/home/ghostty ./../modules/home/ghostty
./../modules/home/wallpaper.nix ./../modules/home/wallpaper
]; ];
} }