Re: FVWM: multiple

From: Larry Gensch <gensch_at_zk3.dec.com>
Date: Mon, 23 Jun 1997 11:48:54 -0400 (EDT)

On 23 Jun, Richard Lister wrote:

>> First, I have not benn sucessful in getting FVWM buttons to swallow a
>> digital clock (month/day/date - red on black background). Second, I
>
> I used to use this, before I switched to asclock (available from
> http://rif3.iiic.ethz.ch:1313/spiff/asclock/):
>
> *FvwmButtons(5x1, Frame 0, Swallow "xclock" "Exec xclock -d -update 1
> -bg Black -fg LimeGreen -padding 4
> -fn '-adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*' &")

The problem with using xclock in this way is that the digital clock
isn't very configurable... you cannot select exactly how the digital
display will be viewed. I also remember problem with resizing the
window and not having the display center properly. Yet another
limitation is that the clock has no interaction... it cannot be used
to launch an application or do anything useful.

In the past, I have found that when I want something (like a
programmable "biff") that isn't already a standard utility, the
fastest way to create such a facility is with tcl/tk.

So, I created a useful digital clock using tcl/tk and FvwmCommand.
Feel free to use this, modify it, and do anything you want with it.

******* start of date.tk *********

    #! /bin/sh
    #
    # *-tcl-* \
        exec wish4.2 $0 $*

    # Configuration:

    # cmd_1 Command to execute when Mouse Button 1 is pressed
    # cmd_3 Command to execute when Mouse Button 3 is pressed
    # format Format of time display (see 'man n clock')
    # mask Mask to use for initial display of data
    # bg Background color of the label
    # font Font to use to display the time

    set cmd_1 {FvwmCommand {warp-or-run "tkrat" Exec /usr/lar3ry/bin/tkrat}}
    set cmd_3 {FvwmCommand {Menu SystemMenu Nop}}
    set format "%I:%M %p"
    set mask "00:00 PM"
    set bg "#c0c0c0"
    set font "-*-helvetica-medium-r-normal-*-*-100-*-*-*-*-*-*"

    global insideClick cmd_1 cmd_3 format

    set insideClick 0

    proc getTime {args} {
        global format

        set secs [clock seconds]
        .lab configure -text [clock format $secs -format $format]
        after 10000 getTime
        update
    }

    proc click1 {} {
        global insideClick cmd_1

        if $insideClick return

        set insideClick 1

        eval exec $cmd_1

        set insideClick 0
    }

    proc click3 {} {
        global insideClick cmd_3

        if $insideClick return

        set insideClick 1

        eval exec $cmd_3

        set insideClick 0
    }

    label .lab -font $font -text $mask -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 *********

-- 
(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 Jun 23 1997 - 11:00:29 BST

This archive was generated by hypermail 2.3.0 : Mon Aug 29 2016 - 19:38:00 BST