Optimize and make cooler!

This commit is contained in:
NaiJi ✨ 2022-04-13 19:41:24 +03:00
parent 2cda3a69ac
commit 33ab980cad
3 changed files with 62 additions and 11 deletions

View File

@ -1,12 +1,14 @@
# Nitrogen Random # Nitrogen Random
Simply changes your nitrogen desktop wallpaper to a random image from provided folder. Simply changes your [nitrogen](https://wiki.archlinux.org/title/Nitrogen) desktop wallpaper to a random image from a folder.
### How to run ### ### How to run ###
Edit the script and make all variables valid:
BGSAVED is the path to bg-saved.cfg of nitrogen, must be in your .config/nitrogen folder. * Carefully read the installation script and then launch it:
```bash
WALLPAPERS is the path to a folder where all your wallpapers are located. bash install.sh
```
You may also put it to crontab. * Follow the instructions.
* Optionally edit your .nitrogen-random config file.
* Try it by running nitrogen-random.
* Optionally add it to your [crontab](https://wiki.archlinux.org/title/Cron)!

50
install.sh Normal file
View File

@ -0,0 +1,50 @@
#!/bin/bash
if [[ "$EUID" = 0 ]]
then
echo "Please run without sudo."
exit 0
fi
if [ ! -d ~/.config/nitrogen/ ]
then
echo "You don't have nitrogen installed! Please install it."
exit 0
fi
echo "Now exporting default config file to ~/.config/nitrogen/.nitrogen-random"
echo "#Path to bg-saved.cfg of nitrogen, must be in your ~/.config/nitrogen folder." > ~/.config/nitrogen/.nitrogen-random
echo "nBGSAVED=/home/${USER}/.config/nitrogen/bg-saved.cfg" >> ~/.config/nitrogen/.nitrogen-random
echo " " >> ~/.config/nitrogen/.nitrogen-random
echo "#Path to a folder where all your wallpapers are located." >> ~/.config/nitrogen/.nitrogen-random
echo "nWALLPAPERS=/home/${USER}/Pictures/" >> ~/.config/nitrogen/.nitrogen-random
echo " " >> ~/.config/nitrogen/.nitrogen-random
echo "#Nitrogen policy for resizing and scaling." >> ~/.config/nitrogen/.nitrogen-random
echo "nMODE=4" >> ~/.config/nitrogen/.nitrogen-random
echo "nitrogen-random will read config from ~/.config/ folder of ${USER}."
decided=false
while [ "$decided" == false ]
do
echo "Choose an option:"
echo "1) It's okay, the config will be in /home/${USER}/.config/nitrogen/"
echo "2) No, I want to set the path on my own."
read input
if [ "$input" == "1" ]
then
decided=true
sed -i "s/{username}/${USER}/" nitrogen-random
elif [ "$input" == "2" ]
then
decided=true
echo "Please write path to the config file in /usr/local/bin/nitrogen-random manually!"
fi
done
chmod u+x ./nitrogen-random
echo "Ready to install ./nitrogen-random to /usr/local/bin/"
sudo cp -f ./nitrogen-random /usr/local/bin/
sudo chown ${USER} /usr/local/bin/nitrogen-random
echo " "
echo " All done! (> < ) "

5
nitrogen-random.sh → nitrogen-random Normal file → Executable file
View File

@ -1,8 +1,7 @@
#!/bin/bash #!/bin/bash
nBGSAVED=/home/naiji/.config/nitrogen/bg-saved.cfg #You can move the config .nitrogen-random anywhere, just replace the path here
nWALLPAPERS=/home/naiji/Pictures/wallpapers/lewd/ . /home/{username}/.config/nitrogen/.nitrogen-random
nMODE=4
export DISPLAY=:0 export DISPLAY=:0