hyprpaper randomizer
This commit is contained in:
@ -73,6 +73,7 @@
|
|||||||
go
|
go
|
||||||
htop
|
htop
|
||||||
httpie
|
httpie
|
||||||
|
hyprpaper-random
|
||||||
jq
|
jq
|
||||||
just
|
just
|
||||||
lazygit
|
lazygit
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
exec-once = [
|
exec-once = [
|
||||||
"hyprpanel"
|
"hyprpanel"
|
||||||
"hyprpaper"
|
"hyprpaper"
|
||||||
|
"hyprpaper-random"
|
||||||
"hypridle"
|
"hypridle"
|
||||||
"wl-paste --type text --watch cliphist store" # Stores only text data
|
"wl-paste --type text --watch cliphist store" # Stores only text data
|
||||||
"wl-paste --type image --watch cliphist store" # Stores only image data "wl-paste -p -t text --watch clipman store -P --histpath=\"~/.local/share/clipman-primary.json\""
|
"wl-paste --type image --watch cliphist store" # Stores only image data "wl-paste -p -t text --watch clipman store -P --histpath=\"~/.local/share/clipman-primary.json\""
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{pkgs, ...}: {
|
{pkgs, ...}: {
|
||||||
# Define your custom packages here
|
# Define your custom packages here
|
||||||
|
hyprpaper-random = pkgs.callPackage ./hyprpaper-random {};
|
||||||
msty = pkgs.callPackage ./msty {};
|
msty = pkgs.callPackage ./msty {};
|
||||||
msty-sidecar = pkgs.callPackage ./msty-sidecar {};
|
msty-sidecar = pkgs.callPackage ./msty-sidecar {};
|
||||||
zellij-ps = pkgs.callPackage ./zellij-ps {};
|
zellij-ps = pkgs.callPackage ./zellij-ps {};
|
||||||
|
72
pkgs/hyprpaper-random/default.nix
Normal file
72
pkgs/hyprpaper-random/default.nix
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
writeShellScriptBin,
|
||||||
|
fd,
|
||||||
|
hyprland,
|
||||||
|
coreutils,
|
||||||
|
gawk,
|
||||||
|
}: let
|
||||||
|
script = writeShellScriptBin "hyprpaper-random" ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Directory (override with WALLPAPER_DIR)
|
||||||
|
DIR="''${WALLPAPER_DIR:-''${XDG_CONFIG_HOME:-$HOME/.config}/hypr/wallpapers}"
|
||||||
|
|
||||||
|
HYPRCTL="${hyprland}/bin/hyprctl"
|
||||||
|
FD="${fd}/bin/fd"
|
||||||
|
SHUF="${coreutils}/bin/shuf"
|
||||||
|
TR="${coreutils}/bin/tr"
|
||||||
|
AWK="${gawk}/bin/awk"
|
||||||
|
|
||||||
|
# Pick one random image (null-safe)
|
||||||
|
WALLPAPER="$(
|
||||||
|
"$FD" . "$DIR" -t f -e jpg -e jpeg -e png -e webp -e avif -0 --follow --hidden \
|
||||||
|
| "$SHUF" -z -n1 \
|
||||||
|
| "$TR" -d '\0'
|
||||||
|
)"
|
||||||
|
|
||||||
|
if [[ -z "''${WALLPAPER:-}" ]]; then
|
||||||
|
echo "No wallpapers found in: $DIR" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Preload so hyprpaper can use it
|
||||||
|
"$HYPRCTL" hyprpaper preload "$WALLPAPER" >/dev/null 2>&1 || true
|
||||||
|
|
||||||
|
# Apply to all monitors
|
||||||
|
"$HYPRCTL" monitors \
|
||||||
|
| "$AWK" '/^Monitor /{print $2}' \
|
||||||
|
| while IFS= read -r mon; do
|
||||||
|
[ -n "$mon" ] && "$HYPRCTL" hyprpaper wallpaper "$mon,$WALLPAPER"
|
||||||
|
done
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
pname = "hyprpaper-random";
|
||||||
|
version = "0.1.1";
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
fd
|
||||||
|
hyprland
|
||||||
|
coreutils
|
||||||
|
gawk
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p "$out/bin"
|
||||||
|
ln -s ${script}/bin/hyprpaper-random "$out/bin/hyprpaper-random"
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Minimal random wallpaper setter for Hyprpaper";
|
||||||
|
license = licenses.mit;
|
||||||
|
platforms = platforms.linux;
|
||||||
|
mainProgram = "hyprpaper-random";
|
||||||
|
};
|
||||||
|
}
|
Reference in New Issue
Block a user