TIP gmail-notify
From Gentoo Linux Wiki
| Terminals / Shells • Network • X Window System • Portage • System • Filesystems • Kernel • Other |
Contents |
[edit] Introduction
This article describes how to add notification icon to system tray.
[edit] Screenshot
[edit] Prerequesties
1) (Optional) You may install sunrise overlay for portage, but it is not necessary. More information you can find here Portage Overlay Listing
2) Create in your overlay category net-mail/gmail-notify
cd /usr/local/portage/ mkdir -p net-mail/gmail-notify cd net-mail/gmail-notify
3) create file gmail-notify-1.6.1-r1.ebuild here with the following content
inherit python eutils
DESCRIPTION="Gmail Notifier is a Linux alternative for the notifier program rele
ased by Google"
HOMEPAGE="http://gmail-notify.sourceforge.net"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"
IUSE=""
RESTRICT="strip"
RDEPEND="virtual/python
>=dev-python/pygtk-2.0
>=x11-libs/gtk+-2.4"
DEPEND="${RDEPEND}"
S=${WORKDIR}/${PN}
src_compile(){
epatch ${FILESDIR}/notifier-home.patch
}
src_install() {
python_version
INST_DIR=/usr/lib/python${PYVER}/site-packages/${PN}
#Install docs
dodoc README notifier.conf.sample
#Install all python files into site-packages
insinto ${INST_DIR}
doins *.py *.jpg *.png langs.xml pytrayicon.so
#Install a script in /usr/bin
echo "#!/bin/bash" > gmail-notify
echo "export NOTIFIER_HOME=${INST_DIR}" >> gmail-notify
echo "exec /usr/bin/python ${INST_DIR}/notifier.py \"\$1\"" >> gmail-not
ify
dobin gmail-notify
#make_wrapper gmail-notify "/usr/bin/python ${INST_DIR}/notifier.py"
}
pkg_postinst() {
python_version
python_mod_optimize /usr/lib/python${PYVER}/site-packages/${PN}
elog "Run gmail-notify to start the program"
elog ""
elog "Warning: if you check the 'save username and password' option"
elog "your password will be stored in plaintext in ~/.notifier.conf"
elog "with world-readable permissions. If this concerns you, do not"
elog "check the 'save username and password' option."
}
pkg_postrm() {
python_version
python_mod_cleanup /usr/lib/python${PYVER}/site-packages/${PN}
}
4) create directory files:
mkdir files
And file named files/notifier-home.patch with following content
diff -ur orig/GmailConfig.py src/GmailConfig.py
--- orig/GmailConfig.py 2005-09-25 20:12:11.000000000 +0300
+++ src/GmailConfig.py 2006-09-18 17:20:07.000000000 +0300
@@ -1,16 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
+import sys
+import os
import pygtk
pygtk.require('2.0')
-import os
import gtk
import ConfigParser
import gmailatom
import xmllangs
-import sys
-LANGSXML_PATH=sys.path[0]+"/langs.xml"
-ICON_PATH=sys.path[0]+"/gmail-notify-icon.png"
+NOTIFIER_HOME = os.getenv("NOTIFIER_HOME")
+if not NOTIFIER_HOME:
+ print "Environment variable NOTIFIER_HOME not set"
+ sys.exit(1)
+LANGSXML_PATH = NOTIFIER_HOME + "/langs.xml"
+ICON_PATH = NOTIFIER_HOME + "/gmail-notify-icon.png"
class GmailConfigWindow:
diff -ur orig/notifier.py src/notifier.py
--- orig/notifier.py 2005-09-25 20:12:11.000000000 +0300
+++ src/notifier.py 2006-09-18 17:20:02.000000000 +0300
@@ -1,13 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Uploaded by juan_grande 2005/02/24 18:38 UTC
+import sys
+import os
import pygtk
pygtk.require('2.0')
import gtk
import time
-import os
import pytrayicon
-import sys
import warnings
import ConfigParser
import xmllangs
@@ -15,9 +15,13 @@
import GmailPopupMenu
import gmailatom
-BKG_PATH=sys.path[0]+"/background.jpg"
-ICON_PATH=sys.path[0]+"/icon.png"
-ICON2_PATH=sys.path[0]+"/icon2.png"
+NOTIFIER_HOME = os.getenv("NOTIFIER_HOME")
+if not NOTIFIER_HOME:
+ print "Environment variable NOTIFIER_HOME not set"
+ sys.exit(1)
+BKG_PATH = NOTIFIER_HOME + "/background.jpg"
+ICON_PATH = NOTIFIER_HOME + "/icon.png"
+ICON2_PATH = NOTIFIER_HOME + "/icon2.png"
def removetags(text):
raw=text.split("<b>")
5) create digest
cd .. ebuild gmail-notify-1.6.1-r1.ebuild digest
[edit] Installation
Installation is as simple as usual. The only thing you need is to unmask gmail-notify
echo "~net-mail/gmail-notify-1.6.1 ~x86" >> /etc/portage/package.keywords emerge -av gmail-notify
Edit by Blankoworld : Gmail-notify depends on the dev-perl/gtk2-trayicon package. Just run:
emerge dev-perl/gtk2-trayicon
[edit] Lauching Command
To launch Gmail-notify you have to set NOTIFIER_HOME environnement variable. So complete launching command like that :
NOTIFIER_HOME="/usr/lib/python2.4/site-packages/gmail-notify/" /usr/lib/python2.4/site-packages/gmail-notify/notifier.py
Note that I use python2.4, change this if you use another version of Python.
[edit] Alternative
I was also looking for a way to check my Google Mail account, and I even went as far as trying to install Gnome's dependency-bloated Mail Notification. I also emerged gmail-notify, but it failed to connect. I was, however, looking too far. It is enough to use Xfce's mailwatch-plugin. It has a simple interface and allows you to check several accounts simultaneously. Simply give it a try in case, of course, you're using - intend to use - the Xfce Desktop Environment.
Another excellent program is checkgmail.
[edit] Links
- GMail Notify homepage
- Article about GMail notifier for Linux

