added random hyprpaper script and options

hyprpaper: added script for a random background every 15mins
This commit is contained in:
Aly Raffauf 2024-04-05 15:04:06 -04:00
parent 8c6d194a4c
commit d61c7002b4
16 changed files with 229 additions and 176 deletions

View file

@ -1,5 +1,7 @@
{ pkgs, lib, config, ... }: { { pkgs, lib, config, ... }: {
imports = [ ./hyprpaper-random.nix ];
options = { options = {
desktopEnv.hyprland.hyprpaper.enable = desktopEnv.hyprland.hyprpaper.enable =
lib.mkEnableOption "Enables hyprpaper and assorted wallpapers."; lib.mkEnableOption "Enables hyprpaper and assorted wallpapers.";
@ -10,13 +12,29 @@
# Packages that should be installed to the user profile. # Packages that should be installed to the user profile.
home.packages = with pkgs; [ hyprpaper ]; home.packages = with pkgs; [ hyprpaper ];
desktopEnv.hyprland.hyprpaper.randomWallpaper.enable = lib.mkDefault true;
xdg.configFile."hypr/hyprpaper.conf".source = ./hyprpaper.conf; xdg.configFile."hypr/hyprpaper.conf".source = ./hyprpaper.conf;
xdg.configFile."hypr/wallpapers/greenCity.jpg".source = xdg.configFile."hypr/wallpapers/evening-sky.png".source =
./wallpapers/greenCity.jpg; ./wallpapers/evening-sky.png;
xdg.configFile."hypr/wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg".source = xdg.configFile."hypr/wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg".source =
./wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg; ./wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg;
xdg.configFile."hypr/wallpapers/salty-justice-NOMebOREvtc-unsplash.jpg".source = xdg.configFile."hypr/wallpapers/wallhaven-6d7xmx.jpg".source =
./wallpapers/salty-justice-NOMebOREvtc-unsplash.jpg; ./wallpapers/wallhaven-6d7xmx.jpg;
xdg.configFile."hypr/wallpapers/wallhaven-83v96o.png".source =
./wallpapers/wallhaven-83v96o.png;
xdg.configFile."hypr/wallpapers/wallhaven-285rjm.jpg".source =
./wallpapers/wallhaven-285rjm.jpg;
xdg.configFile."hypr/wallpapers/wallhaven-4219wy.jpg".source =
./wallpapers/wallhaven-4219wy.jpg;
xdg.configFile."hypr/wallpapers/wallhaven-4267k6.jpg".source =
./wallpapers/wallhaven-4267k6.jpg;
xdg.configFile."hypr/wallpapers/wallhaven-d6ggel.jpg".source =
./wallpapers/wallhaven-d6ggel.jpg;
xdg.configFile."hypr/wallpapers/wallhaven-q2o2w5.jpg".source =
./wallpapers/wallhaven-q2o2w5.jpg;
xdg.configFile."hypr/wallpapers/wallhaven-zm7x5o.jpg".source =
./wallpapers/wallhaven-zm7x5o.jpg;
}; };
} }

View file

@ -0,0 +1,35 @@
{ pkgs, lib, config, ... }:
let
hyprpaper-random = pkgs.writeShellScriptBin "hyprpaper-random" ''
directory=${config.home.homeDirectory}/.config/hypr/wallpapers
monitor=`hyprctl monitors | grep Monitor | awk '{print $2}'`
if [ -d "$directory" ]; then
while true; do
sleep 30
hyprctl hyprpaper unload all
for m in ''${monitor[@]}; do
random_background=$(ls $directory/* | shuf -n 1)
hyprctl hyprpaper preload $random_background
hyprctl hyprpaper wallpaper "$m,$random_background"
done
sleep 870
done
fi
'';
in {
options = {
desktopEnv.hyprland.hyprpaper.randomWallpaper.enable =
lib.mkEnableOption "Enables hyprpaper random wallpaper script.";
};
config =
lib.mkIf config.desktopEnv.hyprland.hyprpaper.randomWallpaper.enable {
# Packages that should be installed to the user profile.
home.packages = with pkgs; [ hyprpaper-random ];
wayland.windowManager.hyprland.extraConfig = "exec-once = ${hyprpaper-random}/bin/hyprpaper-random";
};
}

View file

@ -1,6 +1,4 @@
preload = ~/.config/hypr/wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg preload = ~/.config/hypr/wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg
preload = ~/.config/hypr/wallpapers/salty-justice-NOMebOREvtc-unsplash.jpg
preload = ~/.config/hypr/wallpapers/tokyoGreen.jpg
wallpaper = ,~/.config/hypr/wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg wallpaper = ,~/.config/hypr/wallpapers/jr-korpa-9XngoIpxcEo-unsplash.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 MiB

View file

@ -13,6 +13,8 @@
home.stateVersion = "23.11"; home.stateVersion = "23.11";
programs.home-manager.enable = true; programs.home-manager.enable = true;
desktopEnv.hyprland.hyprpaper.randomWallpaper.enable = false;
}; };
users.users.aly.hashedPassword = users.users.aly.hashedPassword =