Pages

Tuesday, October 14, 2014

Theme color setting version of Checkgmail

For busy people, here is the script: https://dl.dropboxusercontent.com/u/2677320/checkgmail

I always use checkgmail... I like its simplicity and its sobriety . It 's a  simple python script with some setting files. But there has been no change in its code for a long time and now it is discontinued. It continue to work if we put the right arguments on command line. We can only change  status icons and background color icon to improve his appearance from preferences window.


But to adapt checkgmail's colors to your desktop theme, we need to see what's happened in the script and it is not very easy.
That's why i have improve some things in the code  in order to facilitate the popup windows colors setting directly by editing the start of the scripts without you need to get your hands so dirty.

It is easier to know what i am talking about with some screenshots





The default colors setting is adapt to original Ubuntu theme, but you can change it easily (see below).

install it  and change the setting of this checkgmail version:

Install your distibution checkgmail package
$ sudo apt-get install checkgmail
$ sudo apt-get install apt-get install libcrypt-blowfish-perl\
 libcrypt-simple-perl libfreezethaw-perl libgtk2-trayicon-perl\
 liblwp-protocol-https-perl libxml-simple-perl
( derivative of Debian)

Download the new checkgmai versionl:
$ wget "https://dl.dropboxusercontent.com/u/2677320/checkgmail"

Change permissions:
$ chmod +x ./checkgmail

Replace the old script:
$ sudo mv ./checkgmail /usr/bin

Finally, launch it fromthe menu.
If you want launch it automatically at statup:
$ cp  /usr/share/applications/checkgmail.desktop ~/.config/autostart

You can now open the preferences window (right-click on tray-icon) and complete it.



If you want to set an appropriate error-icon  with ' indicator-messages.svg' and 'indicator-messages-new.svg' from Ubuntu theme, here is the link:
https://dl.dropboxusercontent.com/u/2677320/indicator-messages-error.svg

Setup popup windows colors:

Edit the script (~line 162), read the readme in it and set the colors:
$ gksudo gedit /usr/bin/checkgmail

#######################
# Color + Border setting
#
# use gcolor2 to pick info color
#(to install it on ubuntu: sudo apt-get install gcolor2)
#
# For a finest adaptation to your theme desktop, you can change the icons and
# the background color in the preferences window
#
# For Ubuntu users:
# In the preferences, set user icons to indicator-messages.svg
# and indicator-messages-new.svg from /usr/share/ubuntu-mono-*/status/*/
# A error icon can be download here:
#  https://dl.dropboxusercontent.com/u/2677320/indicator-messages-error.svg
# Set the background color to your panel background color
#
########################################################################
####################### README COLORS #################################
########################################################################
# Color variables with '_GTK' in their name
#(ex: '$win_new_mail_color_GTK_border')
#
# must be declare like that:          
## with decimal          
#my $Black   = Gtk2::Gdk::Color->new (0,0,0);      
#my $Grey    = Gtk2::Gdk::Color->new (150*257, 150*257, 150*257);  
#my $White   = Gtk2::Gdk::Color->new (65535, 65535, 65535);  
# or with hexadecimals          
#my $Red     = Gtk2::Gdk::Color->new (0xFFFF,0,0);    
#my $Yellow  = Gtk2::Gdk::Color->new (0xFFFF,0xFFFF,0);    
#my $Magenta = Gtk2::Gdk::Color->new (0xFFFF,0,0xFFFF);  
#my $Green   = Gtk2::Gdk::Color->new (0,0xFFFF,0);    
#my $Cyan    = Gtk2::Gdk::Color->new (0,0xFFFF,0xFFFF);    
#my $Blue    = Gtk2::Gdk::Color->new (0,0,0xFFFF);      
#my $White   = Gtk2::Gdk::Color->new (0xFFFF,0xFFFF,0xFFFF);  
#              
# Color variables with 'no _GTK' in its name (ex: '$win_no_mail_color_text)
# must be declare like that:          
#my $Grey   = "#AAAAAA";          
#my $White  = "#FFFFFF";          
#my $Black  = "#000000";              
#my $Red    = "#FF0000";              
#my $Green  = "#00FF00";              
###############################################################
## You can add your colors here ...
# Ubuntu ambience theme colors
my $Ambiance_BG_GTK        = Gtk2::Gdk::Color->new (62*257, 62*257, 58*257);
my $Ambiance_Grey_BG_GTK   = Gtk2::Gdk::Color->new (241*257, 241*257, 241*257);
my $Ambiance_Grey_Text_GTK = Gtk2::Gdk::Color->new (213*257, 210*257, 203*257);

my $Ambiance_Text_Bg_Color   = "#3E3E3A";

my $Ambiance_Grey_Bg_Color   = "#F1F1F1";
my $Ambiance_Grey_Text_Color = "#D5D2CB";

# my colors

my $Blue_mail_GTK  = Gtk2::Gdk::Color->new (25*257, 182*257, 238*257); # Blue from indicator-messages-new icon
my $Blue_mail_text = "#19B6EE";
my $Orange_Text    = "#FCAF3E";
my $Purple_Text    = "#CEA4E2";
my $Grey_Text      = "#DDDDDD";
my $White_Text     = "#FFFFFF";
my $Black_Text     = "#333333";
my $Green_Text     = "#71CC59";

##### ... and setting colors here

 #1 WIN POPUP NO MAIL
 $win_no_mail_color_text         = $Ambiance_Grey_Text_Color;
 $win_no_mail_color_text_bg      = $Ambiance_Text_Bg_Color;

  #2 WIN POPUP NEW MAIL + BORDER + BORDER WIDTH

 $win_new_mail_color_GTK_border   = $Blue_mail_GTK; #GTK
 $win_new_mail_color_border_width = 3;
 $win_new_mail_color_GTK_bg       = $Ambiance_Grey_BG_GTK; #GTK

 $win_new_mail_color_text        = $Black_Text;

 $win_new_mail_color_text_bg     = $Ambiance_Grey_Bg_Color;

  #3 WIN POPUP MAIL

   # BG COLOR + BORDER + BORDER WIDTH
 $win_mail_color_GTK_bg_border   = $Blue_mail_GTK; #GTK
 $win_mail_border_width = 1;
 $win_mail_color_GTK_bg          = $Ambiance_BG_GTK; #GTK

    # TEXT COLOR

 $win_mail_color_text    = "";
 $win_mail_color_text_bg = $Ambiance_Text_Bg_Color;

    # CHECK TEXT COLOR

 $win_mail_color_text_check = $White_Text;

    # NUMBER MAIL TEXT COLOR

 $win_mail_color_text_number_mail = $White_Text;

    # SUBJECT COLOR

 $win_mail_color_text_subject = $Orange_Text;
 $win_mail_color_text_subject_under_mouse = $Orange_Text;

    # 'FROM' COLOR

 $win_mail_color_text_from   = $Ambiance_Grey_Text_Color;

    # AUTHOR COLOR

 $win_mail_color_text_author = $Purple_Text;

    # 'OPEN' TEXT COLOR

 $win_mail_color_text_open             = $Green_Text;
 $win_mail_color_text_open_under_mouse = $Green_Text;

   # BODY COLOR

 $win_mail_color_text_body = $White_Text;

  #4 FEN POPUP CHEK

 $win_popup_check_color_text    = $Ambiance_Grey_Text_Color;
 $win_popup_check_color_text_bg = $Ambiance_Text_Bg_Color;

  #5 MENU

 $win_menu_color_GTK_bg   = $Ambiance_BG_GTK; #GTK

 $win_menu_color_GTK_text = $Ambiance_Grey_Text_GTK; #GTK



If you are a perl hacker (which is not really the case for me):

It 's possible to improve the code  integrating colors settings in the preferences window, time to get your groove on!. All colors variables are at the script start now.

Finally just a word to say that we now launch checkgmail without '-no_cookies' argument. it was just enough to put $cookies variable  to 0 line ~67, hopping that we need it a future day and... add original links to delete, mark as read,etc... in the popup window!
It should be able to to code this with  'imap' and 'email'  libraries.
The starting script i have used is the one modified by Stefanie at
http://ubuntuforums.org/showthread.php?t=1520603 that resolve background color bug, and a patch to replace google adress account by the new one found here at http://linuxdeal.com/how-to-fix-checkgmail

GOOD NEWS !!
The Return of the 'manage buttons':
2014-10-11: monojp has hacked checkgmail. It allows to manage again mails from the popup window.

I have re-wright my color themable version base on this hack !

Voila!