many improvements
This commit is contained in:
@@ -3,37 +3,40 @@
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
# # load the wallpapers from the wallpapers directory - this gives a set with the folder content
|
||||
# dirContent = builtins.readDir ../../../wallpapers;
|
||||
# wallpaperString = lib.strings.concatMapStrings (x: " " + x) wallpapers;
|
||||
# # # load each wallpaper and keep its path (now in the nix store) as an array
|
||||
# # wallpapers = map (x: builtins.readDir "${../../../wallpapers}/${x.value}") dirContent;
|
||||
# # wallpaperString = lib.strings.concatMapStrings (x: " " + x) wallpapers;
|
||||
let
|
||||
|
||||
# # script that picks a random wallpaper from the array and sets it as the desktop background
|
||||
# monitor = ""; # leave empty to set the wallpaper on all monitors
|
||||
wallpapers = [
|
||||
../../../wallpapers/codioful-formerly-gradienta-lweK7Wme_jo-unsplash.jpg
|
||||
../../../wallpapers/codioful-formerly-gradienta-n2XqPm7Bqhk-unsplash.jpg
|
||||
../../../wallpapers/luke-chesser-eICUFSeirc0-unsplash.jpg
|
||||
../../../wallpapers/luke-chesser-pJadQetzTkI-unsplash.jpg
|
||||
../../../wallpapers/magicpattern-87PP9Zd7MNo-unsplash.jpg
|
||||
];
|
||||
|
||||
# wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
|
||||
# wallpaper=$(shuf -n 1 -e ${wallpaperString})
|
||||
# hyprctl hyprpaper unload all
|
||||
# hyprctl hyprpaper preload $wallpaper
|
||||
# hyprctl hyprpaper wallpaper "${monitor},$wallpaper"
|
||||
# '';
|
||||
monitor = ""; # leave empty to set the wallpaper on all monitors
|
||||
|
||||
wallpaperPicker = pkgs.writeShellScriptBin "wallpaper-picker" ''
|
||||
#!/usr/bin/env bash
|
||||
# use an array of wallpapers to randomly select one
|
||||
wallpapers=(${pkgs.lib.concatStringsSep " " (map (p: "${p}") wallpapers)})
|
||||
# select a random wallpaper from the array
|
||||
index=$((RANDOM % ${toString (builtins.length wallpapers)}))
|
||||
wallpaper="''${wallpapers[index]}"
|
||||
echo "Setting wallpaper to: $wallpaper"
|
||||
|
||||
hyprctl hyprpaper unload all
|
||||
hyprctl hyprpaper reload "${monitor},$wallpaper"
|
||||
'';
|
||||
|
||||
in {
|
||||
# home.packages = [wallpaperRandomizer];
|
||||
|
||||
|
||||
home.packages = [wallpaperPicker];
|
||||
|
||||
services.hyprpaper = {
|
||||
enable = true;
|
||||
settings = {
|
||||
ipc = "on";
|
||||
};
|
||||
};
|
||||
# settings = {
|
||||
# ipc = "off";
|
||||
# splash = false;
|
||||
# };
|
||||
# };
|
||||
|
||||
# systemd.user = {
|
||||
# services.wallpaperRandomizer = {
|
||||
|
Reference in New Issue
Block a user