feh-wallpaper-changer
This commit is contained in:
parent
a9ecc94a77
commit
658744d33c
|
@ -17,7 +17,7 @@
|
|||
recursive = true;
|
||||
text = ''
|
||||
|
||||
autostart="dwmblocks"
|
||||
autostart="dwmblocks feh-wallpaper-changer"
|
||||
|
||||
for program in $autostart; do
|
||||
pidof -sx "$program" || "$program" &
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./feh-wallpaper-changer.nix
|
||||
];
|
||||
|
||||
home.packages = [
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
(writeShellScriptBin "feh-wallpaper-changer" ''
|
||||
wallpaper_dir="$HOME/.local/share/bg/"
|
||||
if [ ! -d "$wallpaper_dir" ]; then
|
||||
echo "No wallpapers in $wallpaper_dir, cloning from remote"
|
||||
mkdir -p "$wallpaper_dir"
|
||||
git clone https://git.bitlab21.com/sam/minimalistic-wallpaper-collection.git "$wallpaper_dir/minimalistic-wallpaper-collection"
|
||||
[ $? != 0 ] && echo "cloning from gitea failed, exiting" && exit 1
|
||||
fi
|
||||
pics_exist=$(find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \))
|
||||
if [ -z "$pics_exist" ]; then
|
||||
git clone https://git.bitlab21.com/sam/minimalistic-wallpaper-collection.git "$wallpaper_dir/minimalistic-wallpaper-collection"
|
||||
[ $? != 0 ] && echo "cloning from gitea failed, exiting" && exit 1
|
||||
fi
|
||||
|
||||
while true; do
|
||||
find "$wallpaper_dir" -type f -follow \( -iname \*.jpg -o -iname \*.png -o -iname \*.gif -o -iname \*.bmp \) | shuf | while read -r file; do
|
||||
${feh}/bin/feh --bg-fill "$file"
|
||||
[ $? != 0 ] && echo "feh failed, exiting" && exit 1
|
||||
sleep 600
|
||||
done
|
||||
done
|
||||
'')
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue