not quite there

This commit is contained in:
Remy Moll 2025-03-11 15:38:44 +01:00
parent 8eed29719d
commit 5c3980dfcf
2 changed files with 16 additions and 9 deletions

@ -69,8 +69,8 @@
binde = [ binde = [
# Fn keys # Fn keys
", code:232, exec, brightnessctl set +5%" ", code:232, exec, brightnessctl set -5%"
", code:233, exec, brightnessctl set -5%" ", code:231, exec, brightnessctl set +5%"
", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%-" ", XF86AudioLowerVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"

@ -4,17 +4,24 @@
... ...
}: }:
with lib; let with lib; let
# load the wallpapers from the wallpapers directory # load the wallpapers from the wallpapers directory - this gives a set with the folder content
wallpapers = builtins.readDir ../../../wallpapers; dirContent = builtins.readDir ../../../wallpapers;
# only keep regular (the true files) as a list
# loop over the set and keep the values where the key is "regular"
wallpapersIntermediate = attrsToList dirContent;
# remove the attr, keep the value
wallpapers = map (x: x.value) wallpapersIntermediate;
wallpaperString = lib.strings.concatMapStrings (x: " " + x) wallpapers;
# script that picks a random wallpaper from the array and sets it as the desktop background # 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 monitor = ""; # leave empty to set the wallpaper on all monitors
randomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" '' wallpaperRandomizer = pkgs.writeShellScriptBin "wallpaperRandomizer" ''
wallpaper=$(shuf -n 1 -e ${wallpapers[@]}) wallpaper=$(shuf -n 1 -e ${wallpaperString})
hyprctl hyprpaper unload all hyprctl hyprpaper unload all
hyprctl hyprpaper preload $wallpaper hyprctl hyprpaper preload $wallpaper
hyprctl hyprpaper wallpaper "${monitor},${wallpaper}" hyprctl hyprpaper wallpaper "${monitor},$wallpaper"
''; '';
in { in {