On 26 May, Adam Kopacz wrote:
> i'm using FvwmButtons.. but i'm missing a cool clock in a fvwmbutton.. xclock is shit
> because i want it digital and without this date..
I wrote a quick and dirty little tcl/tk utility that displays a clock
and allows me to launch a mailer on a mouse click. The script is easy
enough to modify to launch other applications or do other things based
on button clicks, etc.
The utility can be swallowed by FvwmButtons by using the following
line in you .fvwm2rc file:
*FvwmButtons(3x1, Swallow 'date.tk' 'Exec `$HOME/scripts/date.tk' &')
The '3x1' is due to the fact that I have a 'System Tray' portion of my
FvwmButtons that holds mini-icons for launching applications or tcl/tk
scripts. This means that the clock is as wide as three mini-icons.
Note that I use FvwmM4; if you don't you can prolly get rid of the
backquotes in the line above.
One other thing: using this script in a "System Tray," along with
binding a button to pop up a "Start Menu", and having FvwmButtons
swallowing FvwmIconMan, you can duplicate the functionality of the
Windows95 task bar quite well.
The date.tk script is small enough to enclose in this message. Note
the procedures 'click1' and 'click3' show how to perform Fvwm actions
from tcl/tk without having to run as a Fvwm module (using FvwmCommand
that comes with fvwm-2.0.45 in the extras directory). I use the
'insideClick' logic to allow the application to respond the same way
from single or multiple clicks.
date.tk follows (indented):
#! /bin/sh
#
# *-tcl-* \
exec wish4.2 $0 $*
set insideClick 0
global insideClick
set font "-*-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*"
proc getTime {args} {
set secs [clock seconds]
.lab configure -text [clock format $secs -format "%I:%M %p"]
after 10000 getTime
update
}
proc click1 {} {
global insideClick;
if $insideClick return;
set insideClick 1;
exec FvwmCommand {warp-or-run "tkrat" Exec /usr/lar3ry/bin/tkrat}
set insideClick 0;
}
proc click3 {} {
global insideClick;
if $insideClick return;
set insideClick 1;
exec FvwmCommand {Menu SystemMenu Nop}
set insideClick 0;
}
label .lab -font $font -text "xx:xx" -bg #c0c0c0
pack .lab -anchor c -fill both -expand yes
bind .lab <Button-1> click1
bind .lab <Button-3> click3
getTime
# end of date.tk script
--
(void) lar3ry(); gensch_at_zk3.dec.com
"Sometimes it happens. People just explode. Natural causes."
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to majordomo_at_hpc.uh.edu.
To report problems, send mail to fvwm-owner_at_hpc.uh.edu.
Received on Mon May 26 1997 - 09:52:16 BST