From 4833402f65db04377ea56c53bf57c44add411b3b Mon Sep 17 00:00:00 2001 From: Filippo Berto Date: Mon, 18 Oct 2021 15:57:16 +0200 Subject: [PATCH] Better change background script --- custom/default.nix | 2 +- custom/update-background/default.nix | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/custom/default.nix b/custom/default.nix index 4f22b25..cb5f006 100644 --- a/custom/default.nix +++ b/custom/default.nix @@ -1,4 +1,4 @@ -{ pkgs ? import { inherit system; } +{ pkgs ? import { inherit system; } , system ? builtins.currentSystem }: diff --git a/custom/update-background/default.nix b/custom/update-background/default.nix index 1ef856a..1a74946 100644 --- a/custom/update-background/default.nix +++ b/custom/update-background/default.nix @@ -14,7 +14,11 @@ let in writeScript "update-background.sh" '' #!/bin/sh - image=`${find} ${backgrounds_directory} -type f | ${grep} -v "/\." | ${shuf} -n 1` + if [ $# -eq 0 ]; then + image=`${find} ${backgrounds_directory} -type f | ${grep} -v "/\." | ${shuf} -n 1` + else + image="$1" + fi echo "image: $image" ${feh}/bin/feh --bg-fill --no-fehbg "$image" ${glib}/bin/gsettings set org.gnome.desktop.background picture-uri "file://$image"