Gmail Script

Hi!, somebody know how I can make a fvwm script to check the gmail acount?
thxs :slight_smile:

Heres a link on the gentoo forums on how to do it.

http://forums.gentoo.org/viewtopic-t-242076-highlight-fvwm+gmail.html

Heh, I have some Python code lying around that gets the number of new messages, just haven’t gotten around to writing the FvwmScript to display it (I’m rethinking my setup atm), should be dead easy though…

[code]#!/usr/bin/env python
import libgmail
import sys

if name == “main”:
ga = libgmail.GmailAccount(sys.argv[1] + “@gmail.com”, sys.argv[2])
ga.login()
print ga.getUnreadMsgCount()[/code]

It expects two arguments: the username and the password, might kick together the FvwmScript part later today or somewhere tomorrow…

[EDIT]
So that still was today…

[code]#--fvwm--
WindowTitle {FvwmGmail}
WindowSize 120 25

Init
Begin
Set $MainColorset=(GetScriptArgument 1)
If $MainColorset <> {} Then
Begin
ChangeColorset 0 $MainColorset
ChangeColorset 1 $MainColorset
End
Set $Username=(GetScriptArgument 2)
Set $Password=(GetScriptArgument 3)
Set $cmd={exec .fvwm/scripts/FvwmGmail/NewMessages.py } $Username { } $Password}
Echo $cmd
Set $tmp={New mail(s): }(GetOutput $cmd 1 -1)
ChangeTitle 1 $tmp
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 30)==0 Then
Begin
Set $tmp=(GetOutput $cmd 1 -1)
ChangeTitle 1 $tmp
End
End

Widget 1
Property
Position 0 0
Size 120 25
Type ItemDraw
Title {}
Main
Case message of
SingleClic:
Begin

End
End
[/code]

It’s basic as it only displays the number of new messages, wouldn’t be hard to add the total number of messages in your inbox.

thxs for replys:
VoiDeR the post forums.gentoo.org/viewtopic-t-24 … gmail.html is deprecated (the links)

theBlackDragon I can’t understand ur script, where I set the pass and user? u say that isn’t finished yet?

Thxs to all :slight_smile:

I’ve just edited my post, you basically have two files, the Python script which does the actual work of getting the data from the server and the FvwmScript that displays it, you might have to edit the path to the Python script though as I keep both files in ~/.fvwm/scripts/FvwmGmail if you put them there they shouldn’t need any modification.

The FvwmScript takes three parameters, the first one being a Colorset number to use, the second one being your Gmail username and the third one being your password, you might want to use Piperead to read in the latter ones from external files as keeping that kind of stuff in your config isn’t really secure, and might cause some trouble if you decide to share it and forget to take those ‘details’ out :wink:

But as I said, it doesn’t do any advanced stuff, just displays the number of new messages, which is all I need :slight_smile:

Hi!, well I’ve some problems, let’s see
I’ve modified the script with my user,pass and the path to the python script

Then, I swallowed the script in FvwmButton

When y restart fvwm, I can see the script in FvwmButton and show me “New mail(s):”, but nothing else. So I’ve tryed to run “manually” in a terminal:

exec /home/blue/fvwm-config/scripts/NewMessages.py heremyuser heremypass

After 3 seconds the terminal has closed without errors

NOTE: the 2 files, FvwmGmail and NewMessages.py have chmod a+x
And I have emerged libgmail, any ideas?

thxs :slight_smile:

It seems the script doesn’t like it when it’s executed with an absolute path, I strongly suspect this to be a bug in libgmail is it works fine for FvwmMpd. I thought that normally FvwmScript should also find the script without the path being specified if it’s in the same directory as the calling script but that doesn’t seem to work for me which is a real pain…

I’ll try to work something out later today.

Well, reading ur post, I’ve tryed this
copy the files FvwmGmail and Newmessage.py to /usr/fvwm/fvwm and edited the FvwmGmail script:

But I get the same result :frowning: