Thunderbird Extensions
Apple - mac
Donation
Make a donation to help WiPhA development

Search




Preferences

Connect again
---

Your user name :

Your secret code


 Count of members 123 members


Connected :

(nobody)
Visits

 2019944 visitors

 12 visitors online

Private
newmailnotify.tcl

Download Download file

#!/usr/bin/wish
 
# $Id: newmailnotify 724 2005-08-08 10:55:58Z adam $
# This is a Tcl/Tk version of a small newmail notify popup.
# Largely based on amsn's popup script. (http://amsn.sf.net)
#
# I use it in combination with the yamb thunderbird extension.
# (https://globs.org/index.php?lng=en)
# Script is tested on:
#  - Solaris 8, running CDE.
#  - Linux RH3E, running KDE.
#
# Arthur van Dam, http://www.math.uu.nl/people/dam
 
# uncomment this line to ring the system bell
#bell
 
# uncomment this line to play a sound (Solaris)
#exec audioplay /usr/demo/SOUND/sounds/laughter.au
 
#-------------------------------------------------------
# Cuts off a string at n characters and adds three dots '...'
proc chopString { str n } {
        if {[string length $str] >$n} {
                set str "[string range $str 0 [expr $n-1]]..."
        }
        
        return $str;
}
#-------------------------------------------------------
 
# yamb specific stuff:
set subjectData [lindex $argv 0]
set senderData [lindex $argv 1]
set recipientsData [lindex $argv 2]
set sizeData [lindex $argv 3]
set folderData [lindex $argv 4]
set accountTypeData [lindex $argv 5]
set accountNameData [lindex $argv 6]
set bodyData [lindex $argv 7]
 
# I still need to get rid of the main window, just make it small for now.
wm geometry . 10x10
wm overrideredirect . 1
 
set width 150
set height 75
set family "Helvetica"
# A nice post-it note yellowish:
set bgcolor "#FFFFCC"
set size "10"
set xpos 0
set ypos 0
set linelength 20
 
font create sboldf -family $family -size $size -weight bold
font create splainf -family $family -size $size -weight normal
font create sbolditalf -family $family -size $size -weight bold -slant italic
 
set w .newmail
 
toplevel $w -width 1 -height 1
wm group $w .
wm state $w withdrawn
canvas $w.c -bg $bgcolor -width $width -height [expr $height] \
        -relief solid -borderwidth 1
pack $w.c -fill y
 
set msg "[chopString "From: $senderData" $linelength]\n[chopString "Subject: $subjectData" $linelength]\n\n[chopString "Size: $sizeData" $linelength]"
#\nand\nmuch\nmore\ntext"
 
set notify_id [$w.c create text 5 5 -font sboldf \
-justify left -width [expr $width-10] -anchor nw -text "New Mail!"]
 
set notify_id [$w.c create text 5 20 -font splainf \
-justify left -width [expr $width-10] -anchor nw -text "$msg"]
 
wm title $w "New mail"
wm overrideredirect $w 1
#wm transient $w
wm state $w normal
 
wm geometry $w -$xpos-[expr {$ypos-$height}]
after 50 "growNotify $w $xpos [expr {$ypos-$height}] [expr $ypos]"
 
# Close after 8 seconds
after 8000 exit
 
# Copied from amsn popup:
proc growNotify { w xpos currenty finaly } {
 
        if { [winfo exists $w] == 0 } { return 0}
 
        if { $currenty>$finaly} {
                wm geometry $w -$xpos-$finaly
                raise $w
                return 0
        }
        wm geometry $w -$xpos-$currenty
        after 50 "growNotify $w $xpos [expr {$currenty+15}] $finaly"
}

Code highlighted using GeSHi
© Nigel McNie, 2004, released under the GNU GPL
^ Top ^