tinygmc - tiny Gmail checker - v.0.0.3

Browsers, email, chat, etc.
Post Reply
Message
Author
User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

tinygmc - tiny Gmail checker - v.0.0.3

#1 Post by neurino »

This is a little bash script I wrote to learn some shell scripting.

It's main merit is it's small, around 5.5KB, and it could be less if I'd remove script comments, xml indentations etc...
I wanted to use only stock Puppy tools such as gtkdialog3, Glade to design interfaces and gtrayicon. I live tested it only on Wary 030, Quirky 1.2 and Puppeee RC 7 at the moment.

Usage is pretty staightforward, on first run:

- Fill settings dialog that comes up with your username and password (they will be saved unencrypted in ~/.tinygmc file)

- Set time interval (0 = checks only when you deactivate then reactivate tray icon)

- Set max number of messages to preview (to avoid huge dialogs)

- Set if you want it to run at Startup (will place a symlink in ~/Startup)

Periodically a gtkdialog appears with unread mail notifications, clicking on a preview opens the mail in default browser.

Red icon in tray = periodic check is activated
Grayed icon in tray = periodic check is deactivated

All the sed part that parses the xml feed belongs to potong (thanks for all the tips) 8)

If anyone wants to give a look at the code and suggest improvements I'll be glad, please consider I'm a noob in bash/linux.

---------------------

:idea: For older versions of puppy like 3.01 the good vovchik has made a retro version of tinygmc 0.0.3, you can download it here


Changelog:

version 0.0.3 (bugfixes):
  • creating correct symlink to gtrayicon
  • added -k (insecure) option to connect to SSL site without certificates to avoid problems with some, maybe buggy, versions of curl
version 0.0.2:
  • Waits for internet connection before checking (v.0.0.1 failed first check on Startup)
  • Added "last message time" tooltip hovering on each notification dialog entry
  • No more notifications if no new messages since last dialog: if you closed it you already read it! When you want to see what's unread simply deactivate / reactivate tray icon (a.k.a. double click). I find working this way is way less annoying than seeing the same headings every xx minutes.
Attachments
tinygmc-0.0.3.pet
tiny Gmail checker
md5sum: e63763d9ccd7fdbd832528f45d54b32d
(5.72 KiB) Downloaded 682 times
settings.png
settings dialog
(15 KiB) Downloaded 1817 times
notify.png
notification popup
(17.05 KiB) Downloaded 1750 times
tray.png
(2.25 KiB) Downloaded 1749 times
Last edited by neurino on Sat 04 Sep 2010, 13:17, edited 13 times in total.

User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

#2 Post by neurino »

version 0.0.2 :roll:

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#3 Post by seaside »

neurino,

Nicely done.

I tried it in Puppy431 and Lupu510 and unfortunately it doesn't run. I then thought I'd install Wary to check it out, but then the code looks generic enough to run on other puppies.

I'll take a look later and see how it could be modified.

Regards,
s

User avatar
dejan555
Posts: 2798
Joined: Sun 30 Nov 2008, 11:57
Location: Montenegro
Contact:

#4 Post by dejan555 »

Code: Select all

# tinygmc
/usr/local/bin/tinygmc: line 10: /usr/local/tinygmc/traygmc: No such file or directory
I checked the file /usr/local/bin/tinygmc and it's a symlink to /usr/bin/gtrayicon which doesn't exist in package.
puppy.b0x.me stuff mirrored [url=https://drive.google.com/open?id=0B_Mb589v0iCXNnhSZWRwd3R2UWs]HERE[/url] or [url=http://archive.org/details/Puppy_Linux_puppy.b0x.me_mirror]HERE[/url]

seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

#5 Post by seaside »

dejan555 wrote:

Code: Select all

# tinygmc
/usr/local/bin/tinygmc: line 10: /usr/local/tinygmc/traygmc: No such file or directory
I checked the file /usr/local/bin/tinygmc and it's a symlink to /usr/bin/gtrayicon which doesn't exist in package.
Yep, that's it. "gtrayicon" isn't included in Pup431 and probably below.

Also, I got this curl error-

Code: Select all

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
I got it to work by specifying curl -k option (no certificate checking).

Attached below is the missing file.

Cheers,
s
Attachments
gtrayicon.tar.gz
(4.72 KiB) Downloaded 625 times

User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

#6 Post by neurino »

Ok, the grtayicon symlink does not work since I found it's not in the same place in all Puppy derivatives...

I added a postinstall script that creates the symlink dynamically, you can run in terminal:

Code: Select all

#remove not working symlink
rm /usr/local/tinygmc/traygmc
#create a working one
ln -s `which gtrayicon` /usr/local/tinygmc/traygmc
about the curl error I alreay noticed the error in Puppeee but thougt it's a curl bug, not of the script and maybe it should be fixed in curl.

Anyway if it's not a security problem for anyone I can add the -k option by default...

Il posted version 0.0.3 with these fixes.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#7 Post by vovchik »

Dear neurino,

Could you kindly tar.gz the glade file for gtrayicon and post it here? I don't have it and want to try your app.

Many thanks in advance,
vovchik

User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

#8 Post by neurino »

gtrayicon is not a glade file and should be in almost any Puppy derivative...

http://gtrayicon.sourceforge.net/

try to call it from commandline, if you really don't have it seaside posted it above, just rename it.

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#9 Post by vovchik »

Dear neurino,

The reason I mentioned the glade file is because I get this when running from a terminal:
root$ [/usr/local/tinygmc]-> tinygmc

(traygmc:26120): libglade-WARNING **: could not find glade file '/usr/share/gtrayicon/gtrayicon.glade'
gtrayicon: error loading glade file.: No such file or directory
With kind regards,
vovchik

PS. The source contains all the necessary files, include the glade file! So, thanks for the link.

User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

#10 Post by neurino »

Dear vovchik,

here attached the contents of /usr/share/gtrayicon/

I don't know which other files, more than gtrayicon binary and these, are required.

Anyway I guess the better solution, if you don't have gtrayicon on your puplet, is to compile it from source.

Best regards
neurino
Attachments
gtrayicon.tar.gz
md5sum: 79373260a87627b20c0532b5f017b445
(6.98 KiB) Downloaded 526 times

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#11 Post by vovchik »

Dear neurino,

Thanks again. I recompiled it under Puppy 3.01 and had to change g_strcmp0 to strcmp in the source (a usual thing for old GTK 2.10). There was only one instance that required changing. As for the span stuff (text attributes) in your generated glade files, they don't show up properly in GTK 2.10 - I see the metalabels in the inbox list, e.g. <b></b>. Must be something with PANGO and I am investigating.

With kind regards,
vovchik

PS. If and when I figure out the span business, I will post a "retro" version with the modded gtrayicon and tweaked glade-generating code. It could be something as simple as single or double quotes, but I don't know yet.

User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

#12 Post by neurino »

If you don't care about bigger texts in dialogs you can just strip <span>s (or maybe strip and cut down some of the atom texts to make dialogs smaller)

Bye

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

Span stuff

#13 Post by vovchik »

Dear neurino,

Thanks for all of the replies. I am interested in the span stuff and glade because I wrote this little editor for "span" stuff and, like you, obviously, like minimalist solutions.

http://www.murga-linux.com/puppy/viewto ... h&id=30359 (page 5 I think)

What I would do is to get rid of curl dependencies. Luigi has written a little prog (with source) that does most of what wget and curl do, and does not have ugly dependencies. I posted that somewhere (search for Luigi and vovchik). Long ago, I also posted the source and binary for "email", which can query POP3 servers and knows SSL, if I remember correctly. It is also small and not too dependent on many extraneous libs.

Your use of glade generation, on the fly, is brilliant, so hats off. Nice solution, and efficient.

With kind regards,
vovchik

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#14 Post by vovchik »

Dear neurino,

I did as you suggested and removed the metatags from "check" (that's the easy way out). It works perfectly in 3.01. However, I still want to understand how to get the tags working, since they do work in regular gtkdialog and in all other apps that make use of glade. So, some head-scratching is in order on my part.

With thanks and kind regards,
vovchik

PS. What about scrambling the password in the rc file?

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

Retro version for old Puppies

#15 Post by vovchik »

Dear nuerino,

Here is a pet containing my modded gtrayicon and modded check so that your prog will work OK in older puppies - e.g. 3.01. I hope I didn't forget anything when making the pet.

With kind regards,
vovchik
Attachments
tinygmc-0.03-retro.pet
(28.13 KiB) Downloaded 538 times

User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

#16 Post by neurino »

vovchik wrote: However, I still want to understand how to get the tags working, since they do work in regular gtkdialog and in all other apps that make use of glade. So, some head-scratching is in order on my part.

PS. What about scrambling the password in the rc file?
I can't find a good resource where to learn something more about glade xml... all I put in tinygmc glade files is scratched from tens of webpages around... :roll:

I thought about scrambling somewhere but why care when it will be readable in process list during curl call?
If you have some link with an example I'll read it willingly

P.S.: I added a link to your retro version on first topic post

balaji.md
Posts: 25
Joined: Thu 16 Jun 2011, 02:25
Location: Australia

superb!

#17 Post by balaji.md »

tinygmc rocks on puppy 525. Thanks! its a lovely little addition.

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#18 Post by DaveS »

One of the nicest add-ons for Puppy I have, but I have a small issue. When Firefox is set as my default browser (/usr/lib/firefox/firefox), it loads as it should with a click on the tinygmc dialogue, but with Opera as the default, (/root/opera/opera), it does not load. Clicking the defaultbrowser file in /usr/local/bin does load Opera though. What might be wrong?

Edit Ok, fixed it. Defaultbrowser needed /root/opera/opera "$@"
Spup Frugal HD and USB
Root forever!

User avatar
neurino
Posts: 362
Joined: Thu 15 Oct 2009, 13:08

#19 Post by neurino »

Good to know you fixed it :)

User avatar
DaveS
Posts: 3685
Joined: Thu 09 Oct 2008, 16:01
Location: UK

#20 Post by DaveS »

Packaged for Wary and Racy. Just includes some missing libs etc.
Attachments
tinygmc_racy-0.0.3.pet
(11.53 KiB) Downloaded 254 times
Spup Frugal HD and USB
Root forever!

Post Reply