diff --git a/systemd/.config/systemd/user/changepaper.service b/systemd/.config/systemd/user/changepaper.service index c77460f..90fae32 100644 --- a/systemd/.config/systemd/user/changepaper.service +++ b/systemd/.config/systemd/user/changepaper.service @@ -5,4 +5,4 @@ RefuseManualStop=yes [Service] Type=oneshot -ExecStart=/home/powellc/var/documents/scripts/changepaper.sh +ExecStart=/home/powellc/.config/systemd/user/changepaper.sh diff --git a/systemd/.config/systemd/user/changepaper.sh b/systemd/.config/systemd/user/changepaper.sh new file mode 100755 index 0000000..aaba420 --- /dev/null +++ b/systemd/.config/systemd/user/changepaper.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# This Script downloads National Geographic Photo of the day, and sets it as desktop background (gnome, unity) +# Copyright (C) 2012 Saman Barghi - All Rights Reserved +# Permission to copy, modify, and distribute is granted under GPLv3 +# Last Revised 22 May 2019 +####################### + +#Change directory to where the script resides. +BASEDIR="$HOME/var/inbox/ng_photos" +cd $BASEDIR +####################### + +#getting the image URL +img="$(curl https://www.nationalgeographic.com/photography/photo-of-the-day/ -s | grep -oP '(?<="twitter:image:src" content=")\K[^"]*')" + +#check to see if there is any wallpaper to download +if [ -n "$img" ] +then + img_base=`echo $img | cut -d/ -f 5` + img_md5=`echo -n $img_base | md5sum | cut -f1 -d" "` + img_file="$img_md5.jpg" + + curl "$img" > $img_file + #set the current image as wallpaper + feh --bg-scale $BASEDIR/$img_md5.jpg +else + echo "No Wallpaper today" +fi diff --git a/systemd/.config/systemd/user/checkmail.service b/systemd/.config/systemd/user/checkmail.service index b4122c1..20f5d94 100644 --- a/systemd/.config/systemd/user/checkmail.service +++ b/systemd/.config/systemd/user/checkmail.service @@ -5,4 +5,4 @@ RefuseManualStop=yes [Service] Type=oneshot -ExecStart=/home/powellc/var/documents/scripts/checkmail.sh +ExecStart=/home/powellc/.config/systemd/user/checkmail.sh diff --git a/systemd/.config/systemd/user/checkmail.sh b/systemd/.config/systemd/user/checkmail.sh new file mode 100755 index 0000000..af15e00 --- /dev/null +++ b/systemd/.config/systemd/user/checkmail.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +STATE=`nmcli networking connectivity` + +if [ $STATE = 'full' ] +then + mbsync -a + notmuch new + exit 0 +fi +echo "No internet connection" +exit 0