Added base

This commit is contained in:
Chen Asraf
2013-12-29 11:04:57 +02:00
parent e3df855f0f
commit 3fe89cb761
12 changed files with 157 additions and 0 deletions

BIN
00-Splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 965 KiB

BIN
01-Morning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
02-Late-Morning.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 KiB

BIN
03-Afternoon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
04-Late-Afternoon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 KiB

BIN
05-Evening.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
06-Late-Evening.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
07-Night.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

BIN
08-Late-Night.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 KiB

62
install.sh Executable file
View File

@@ -0,0 +1,62 @@
#!/bin/sh
pwd=`pwd`
sep="--------------------------------------------------------------------------"
echo $sep
echo "*** 8bit Day Wallpaper Rotator for Linux ***"
echo "*** Rotator Script: http://www.reddit.com/u/javajames64 ***"
echo "*** Auto Installer: http://www.reddit.com/u/OhMrBigshot ***"
echo $sep
echo
echo "* Changing permissions... [1/2]"
chmod +x update.sh
echo
echo "* Creating cron jobs... [2/2]"
echo
read -p "Create a cron job every hour? [y/n] " yn
case $yn in
[Yy]*)
line="0 * * * * ${pwd}/update.sh"
if ! crontab -l | grep -Fxq "$line"; then
(crontab -l ; echo "$line") | crontab -
else
echo "[cron already exists, skipping]"
fi
;;
esac
echo
read -p "Create a cron job after each reboot? [y/n] " yn
case $yn in
[Yy]*)
line="@reboot ${pwd}/update.sh"
if ! crontab -l | grep -Fxq "$line"; then
(crontab -l ; echo "$line") | crontab -
else
echo "[cron already exists, skipping]"
fi
;;
esac
echo
read -p "Run script after system resume (from suspension)? (requires root) [y/n] " yn
case $yn in
[Yy]*)
sudo -k sh -c "echo -e \"case \"\${1}\" in\n\tresume|thaw)\n\t\t${pwd}/update.sh\n\t;;\nesac\" > /etc/pm/sleep.d/RotatingWallpaper.sh"
if [ $? -ne 0 ]; then
echo " --> ERROR: Return from suspension script not created";
else
sudo sh -c "chmod +x /etc/pm/sleep.d/RotatingWallpaper.sh"
sudo sh -c "chown $USER /etc/pm/sleep.d/RotatingWallpaper.sh"
fi
;;
esac
echo
echo "Done!"

41
uninstall.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/bin/sh
pwd=`pwd`
sep="--------------------------------------------------------------------------"
echo $sep
echo "*** 8bit Day Wallpaper Rotator for Linux ***"
echo $sep
echo
echo "This will revert all the changes."
echo
read -p "Are you sure that's what you want? [y/n] " yn
case $yn in
[Yy]* )
echo
echo "Removing tasks..."
line="${pwd}/update.sh"
crontab -l | grep -v "$line1" | crontab -
if [ -f /etc/pm/sleep.d/RotatingWallpaper.sh ]; then
echo "We need root permissions to delete '/etc/pm/sleep.d/RotatingWallpaper.sh': "
sudo -k sh -c "rm /etc/pm/sleep.d/RotatingWallpaper.sh"
fi
;;
esac
echo
read -p "Delete this directory and its files? [y/n] " yn
case $yn in
[Yy]* )
echo "rm -R $pwd"
;;
esac
echo
echo "Done! We're sorry to see you go!"

54
update.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
sessionfile=`find "${HOME}/.dbus/session-bus/" -type f`
export `grep "DBUS_SESSION_BUS_ADDRESS" "${sessionfile}" | sed '/^#/d'`
files=(
01-Morning.png
02-Late-Morning.png
03-Afternoon.png
04-Late-Afternoon.png
05-Evening.png
06-Late-Evening.png
07-Night.png
08-Late-Night.png
)
#Timings for the backgrounds in order. Your life may vary.
timing=(
7
10
12
17
18
19
21
23
)
hour=`date +%H`
case $XDG_CURRENT_DESKTOP in
Mint|Mate) setcmd="gsettings set org.mate.background picture-uri";;
Cinnamon) setcmd="gsettings set org.cinnamon.background picture-uri";;
*) setcmd="feh --bg-fill";;
esac
if [[ -z $XDG_CURRENT_DESKTOP ]]; then
case $DESKTOP_SESSION in
i3) setcmd="feh --bg-fill"
esac
fi
for i in {7..0..-1}
do
if [[ $hour -ge ${timing[i]} ]]; then
$setcmd file://$DIR/${files[i]}
echo "Wallpaper set to ${files[i]}"
exit
fi
done
$setcmd file://$DIR/${files[7]}
echo "Wallpaper set to ${files[7]}"