[Xfce4-commits] [panel-plugins/xfce4-genmon-plugin] 01/02: Update readme, authors, about dialog and add gmail script
noreply at xfce.org
noreply at xfce.org
Fri Jun 10 03:12:25 CEST 2016
This is an automated email from the git hooks/post-receive script.
ToZ pushed a commit to branch master
in repository panel-plugins/xfce4-genmon-plugin.
commit 4f45ecb5886600c09a920d50aec91bfb9591dc1c
Author: ToZ <tony.paulic at gmail.com>
Date: Thu Jun 9 21:12:05 2016 -0400
Update readme, authors, about dialog and add gmail script
---
AUTHORS | 1 +
README | 12 +++++++
panel-plugin/main.c | 3 +-
scripts/gmail | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 116 insertions(+), 1 deletion(-)
diff --git a/AUTHORS b/AUTHORS
index 6099265..720c4bc 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,2 +1,3 @@
Roger Seguin <roger_seguin at msn.com>
Julien Devemy <jujucece at gmail.com>
+Tony Paulic <tony.paulic at gmail.com>
diff --git a/README b/README
index 27f7c5c..945cb15 100644
--- a/README
+++ b/README
@@ -99,6 +99,18 @@ PS: Depending on your configuration, you should change the image path.
You can find more scripts in scripts/mon*.
+The xfce4-genmon-plugin now supports xfce4-panel plugin-event functionality. Currently it only supports the
+"refresh" action which resets the timer and causes the associated command to execute again. You can use this
+command remotely or at the end of a script to force the panel plugin to refresh.
+
+To refresh the plugin, issue the command:
+
+ xfce4-panel --plugin-event=genmon-X:refresh:bool:true
+
+where "genmon-X" is the widget name of the particular genmon instance. To get this name, go to the panel
+properties screen and on the Items tab, hover your mouse over the genmon plugin to get it's internal name.
+
+
6 - Bugs
----
If you find a bug, fix it, then tell me how you did it :-)
diff --git a/panel-plugin/main.c b/panel-plugin/main.c
index 7cf3c94..d69e8a5 100644
--- a/panel-plugin/main.c
+++ b/panel-plugin/main.c
@@ -600,6 +600,7 @@ static void About (XfcePanelPlugin *plugin)
{
"Roger Seguin <roger_seguin at msn.com>",
"Julien Devemy <jujucece at gmail.com>",
+ "Tony Paulic <tony.paulic at gmail.com>",
NULL
};
@@ -611,7 +612,7 @@ static void About (XfcePanelPlugin *plugin)
"program-name", PACKAGE,
"comments", _("Cyclically spawns a script/program, captures its output and displays the resulting string in the panel"),
"website", "http://goodies.xfce.org/projects/panel-plugins/xfce4-genmon-plugin",
- "copyright", _("Copyright \xc2\xa9 2004 Roger Seguin\nCopyright \xc2\xa9 2006 Julien Devemy\n"),
+ "copyright", _("Copyright \xc2\xa9 2004 Roger Seguin\nCopyright \xc2\xa9 2006 Julien Devemy\nCopyright \xc2\xa9 2016 Tony Paulic\n"),
"authors", auth,
NULL);
diff --git a/scripts/gmail b/scripts/gmail
new file mode 100644
index 0000000..b11f8d0
--- /dev/null
+++ b/scripts/gmail
@@ -0,0 +1,101 @@
+#!/bin/bash
+# GMAIL New Mail Notifier with message sender/subject preview and
+# notification of new mail
+#
+# Requires: curl xfce4-genmon-plugin notify-send
+#
+# xfce4-genmon-plugin properties:
+# Command = path to and name of this script
+# Label = optional label before icon (better unchecked)
+# Period = Time in seconds to check for new emails (to run this script)
+# Default Font = (your choice)
+#
+##############################################
+### configurable parameters (adjust to suit)
+
+ # gmail identification
+USERNAME="xxxxxxxx"
+PASSWORD="xxxxxxxx"
+ # timezone
+TIMEZONE="Canada/Eastern"
+ # icons
+NOMAIL="/home/toz/.icons/mail.png"
+NEWMAIL="/home/toz/.icons/mail-new.png"
+NOTIFICATION_ICON="/home/toz/.icons/aol_mail.png"
+ # your email application (activated on click)
+EMAILAPP="thunderbird"
+
+##############################################
+
+##############################################
+# don't change anything below
+##############################################
+
+# get and save the atom feed
+curl -u "$USERNAME":"$PASSWORD" --silent "https://mail.google.com/mail/feed/atom" > /tmp/.gmail
+
+# get number of unread messages
+num_messages=$(grep -oP "(?<=<fullcount>)[^<]+" /tmp/.gmail)
+
+# get last checked time
+last_checked=$(grep -oP "(?<=<modified>)[^<]+" /tmp/.gmail | TZ=$TIMEZONE date +'%r')
+
+# get ids, senders and subjects
+mapfile -t ids < <(grep -oP "(?<=<id>)[^<]+" /tmp/.gmail | awk -F":" '{print $3}')
+mapfile -t names < <(grep -oP "(?<=<name>)[^<]+" /tmp/.gmail)
+mapfile -t subjects < <(grep -oP "(?<=<title>)[^<]+" /tmp/.gmail | grep -v Gmail)
+
+# prepare tooltip string
+out=$(for (( i=0; i<$num_messages; i++ )); do echo "${names[i]} - ${subjects[i]}#"; done)
+toolstr="$(echo $out | sed -e 's/\# /\n/g' | sed -e 's/\#//g')"
+
+# check to see if there are new, new messages (only notify if something new has arrived)
+new_msgs=0
+
+if [ $num_messages -gt 0 ]; then
+ if [ -a /tmp/.gmail.lastid ]; then
+ if [ "${ids[0]}" != "$(cat /tmp/.gmail.lastid)" ]; then
+ echo ${ids[0]} > /tmp/.gmail.lastid
+ let new_msgs=1
+ fi
+ else
+ echo ${ids[0]} > /tmp/.gmail.lastid
+ let new_msgs=1
+ fi
+fi
+
+
+##### genmon processing
+
+#set default icon file to no new emails
+ICON_FILE="$NOMAIL"
+
+if [ $num_messages -gt 0 ]; then
+ # set icon file to new emails image
+ ICON_FILE="$NEWMAIL"
+ if [ $new_msgs -eq 1 ]; then
+ notify-send -i "$NOTIFICATION_ICON" "You have Mail" "<i>$num_messages new message(s).</i>"
+ fi
+fi
+
+##### do the genmon
+if [ $num_messages -gt 0 ]
+then
+ echo "<img>$ICON_FILE</img>
+ <click>$EMAILAPP</click>
+ <tool>$num_messages new message(s)
+
+$toolstr
+
+Last checked: $last_checked</tool>"
+else
+ echo "<img>$ICON_FILE</img>
+ <click>$EMAILAPP</click>
+ <tool>No new mail
+
+Last checked: $last_checked</tool>"
+fi
+
+unset ids names subjects
+exit 0
+
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list