Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- settings=$HOME/Launchers/.tconk-settings-general
- # load variables from file
- . $settings
- imgtmp=$tmpfolder/.time-icon.png
- imgout=$tmpfolder/time-icon.png
- updatestmp=$tmpfolder/time-updates
- mailtmp=$tmpfolder/time-mail
- fbtmp=$tmpfolder/time-fb
- updateCount=$(cat $updatestmp)
- mailCount=$(cat $mailtmp)
- fbCount=$(cat $fbtmp)
- # check if our facebook count contains our message indicator
- if [[ "$fbCount" =~ M ]]; then
- # our count is a message count
- fbIsMessage="yes"
- # clean our message indicator from our count
- fbCount=$(echo "$fbCount" | sed 's|M||')
- elif [[ "$fbCount" =~ F ]]; then
- # our count is a friend request count
- fbIsFriendRequest="yes"
- # clean our friend request indicator from our count
- fbCount=$(echo "$fbCount" | sed 's|F||')
- fi
- # check if there are facebook notifications
- if [ "$fbCount" = 0 ] ; then
- # no notifications, report to conky
- echo "\${alignr}\${color7}No new Facebook activity."
- elif [ "$fbCount" = 1 ] ; then
- if [ -n "$fbIsMessage" ]; then
- # message, report to conky
- echo "\${alignr}\${color5}$fbCount \${color6}Facebook message\${color5}!"
- elif [ -n "$fbIsFriendRequest" ]; then
- # friend request, report to conky
- echo "\${alignr}\${color5}$fbCount \${color6}Facebook friend request\${color5}!"
- else
- # notification, report to conky
- echo "\${alignr}\${color5}$fbCount \${color6}Facebook notification\${color5}!"
- fi
- # set our strings variable
- strings="$timeIconFB"
- elif [ "$fbCount" -gt 1 ] ; then
- if [ -n "$fbIsMessage" ]; then
- # message, report to conky
- echo "\${alignr}\${color5}$fbCount \${color6}Facebook messages\${color5}!"
- elif [ -n "$fbIsFriendRequest" ]; then
- # friend request, report to conky
- echo "\${alignr}\${color5}$fbCount \${color6}Facebook friend requests\${color5}!"
- else
- # notifications, report to conky
- echo "\${alignr}\${color5}$fbCount \${color6}Facebook notifications\${color5}!"
- fi
- # set our strings variable
- strings="$timeIconFB"
- else
- # error checking, report to conky
- echo "\${alignr}\${color7}Error checking Facebook."
- fi
- # check if there is new mail
- if [ "$mailCount" = 0 ] ; then
- # no new mail, report to conky
- echo "\${alignr}\${color7}No new Gmail activity."
- elif [ "$mailCount" = 1 ] ; then
- # new mail, report to conky
- echo "\${alignr}\${color5}$mailCount \${color6}Unread Gmail message\${color5}!"
- # set our strings variable
- strings=$(echo -e "$strings"'\n'"$timeIconGmail")
- elif [ "$mailCount" -gt 1 ] ; then
- # new mail, report to conky
- echo "\${alignr}\${color5}$mailCount \${color6}Unread Gmail messages\${color5}!"
- # set our strings variable
- strings=$(echo -e "$strings"'\n'"$timeIconGmail")
- else
- # error checking, report to conky
- echo "\${alignr}\${color7}Error checking mail."
- fi
- # check if there are updates
- if [ -f /var/run/reboot-required ]; then
- # we need to reboot, report to conky
- echo "\${alignr}\${color6}Restart required."
- elif [ "$updateCount" = 0 ] ; then
- # no updates, report to conky
- echo "\${alignr}\${color7}System up to date."
- elif [[ "$updateCount" =~ A1$ ]]; then
- echo "\${alignr}\${color5}${updateCount#A*} \${color6}New AUR Update Available\${color5}!"
- elif [[ "$updateCount" =~ A ]]; then
- echo "\${alignr}\${color5}${updateCount#A*} \${color6}New AUR Updates Available\${color5}!"
- elif [ "$updateCount" = 1 ] ; then
- # updates, report to conky
- echo "\${alignr}\${color5}$updateCount \${color6}New Update Available\${color5}!"
- else
- # updates, report to conky
- echo "\${alignr}\${color5}$updateCount \${color6}New Updates Available\${color5}!"
- fi
- # set our updates and restart strings separately, so that
- # one doesn't prevent the other
- if [ "${updateCount#A*}" -gt 0 ]; then
- strings=$(echo -e "$strings"'\n'"$timeIconUpdate")
- fi
- if [ -f /var/run/reboot-required ]; then
- strings=$(echo -e "$strings"'\n'"$timeIconRestart")
- fi
- # define our reference
- while read f; do
- if [ "$f" = "$timeIconFB" ]; then
- # just a number because KISS
- ref=1
- elif [ "$f" = "$timeIconGmail" ]; then
- ref=2
- elif [ "$f" = "$timeIconUpdate" ]; then
- ref=3
- elif [ "$f" = "$timeIconRestart" ]; then
- ref=4
- fi
- # append our number to the end of any existing references
- reference=$(echo "$reference""$ref")
- done < <(echo "$strings" | grep [\da-zA-Z])
- # add our reference path to the beginning of our reference filename
- reference="$tmpfolder/time=$reference"
- # define our background image
- bg=$timeBottomImage
- # make our picture
- if [ ! -f "$reference" ]; then
- while read fg; do
- # incriment our count by 1
- count=$(( $count + 1 ))
- # make our offset, using our count
- pos=+$(( 46 + ( ( $count - 1 ) * 35 ) ))+15
- # do the actual work of creating the image
- composite -geometry "$pos" "$fg" "$bg" "$imgtmp"
- bg="$imgtmp"
- done < <(echo "$strings" | grep [\da-zA-Z])
- composite "$timeTopImage" "$bg" "$imgout"
- rm "$imgtmp"
- rm "$tmpfolder"/time=*
- touch "$reference"
- fi
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement