summaryrefslogtreecommitdiff
path: root/home-manager/sh/wp.nix
diff options
context:
space:
mode:
Diffstat (limited to 'home-manager/sh/wp.nix')
-rw-r--r--home-manager/sh/wp.nix31
1 files changed, 31 insertions, 0 deletions
diff --git a/home-manager/sh/wp.nix b/home-manager/sh/wp.nix
new file mode 100644
index 0000000..37fefb2
--- /dev/null
+++ b/home-manager/sh/wp.nix
@@ -0,0 +1,31 @@
+{ pkgs }:
+
+let
+ wp-set = pkgs.writeShellScriptBin "wp-set" ''
+ if [ -n "$1" ] && [ -e "$1" ]; then
+ rm "$HOME/.config/wallpaper."*
+
+ cp "$1" "$HOME/.config/wallpaper.''${1##*.}"
+ fi
+
+ ${pkgs.xwallpaper}/bin/xwallpaper --zoom "$HOME/.config/wallpaper."*
+ '';
+
+ wp-rand = pkgs.writeShellScriptBin "wp-rand" ''
+ ${wp-set}/bin/wp-set $(ls -1Ad "$HOME/Pictures/Wallpapers/"* | shuf | head -n 1)
+ '';
+
+ wp = pkgs.writeShellScriptBin "wp" ''
+ nsxiv="${pkgs.nsxiv}/bin/nsxiv"
+ wpset="${wp-set}/bin/wp-set"
+
+ $wpset "$($nsxiv -bfort "$HOME/Pictures/Wallpapers" | sed 1q)"
+ '';
+in pkgs.symlinkJoin {
+ name = "wp";
+ paths = [
+ wp
+ wp-rand
+ wp-set
+ ];
+}
Software created with 💖