TIP gmail-notify

Posted by Victor Guardiola | Posted in Gentoo, HowTo, VIM | Posted on 15-12-2006

Introducción

Este artículo describe como añadir el icono de notificación de Gmail en la bandeja del sitema(system tray).

Pre-requisitos

  1. (Opcional) Puedes instalar el overlay sunrise, pero no es necesario. más información en Portage_Overlay_Listing
  2. Crea en tu overlay la categoria net-mail/gmail-notify

cd /usr/local/portage/
mkdir -p net-mail/gmail-notify
cd net-mail/gmail-notify
  1. crea el fichero gmail-notify-1.6.1-r1.ebuild con el siguiente contenido
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}
 }
  1. crea el directorio files:
mkdir files

Y el fichero llamado files/notifier-home.patch con el siguiente contenido:

 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("")
  1. haz el digest
ebuild gmail-notify-1.6.1-r1.ebuild digest

Instalacón

La instalación es simple y es como lo habitual. La unica cosa que necessitas es unmask el ebbuild de gmail-notify

echo "~net-mail/gmail-notify-1.6.1 ~x86" >> /etc/portage/package.keywords
emerge -av gmail-notify

Links
http://gmail-notify.sourceforge.net/

Write a Comment