A clock with date

I’d like to have a small clock with integrated date.
I want to use FvwmButtons for this, something like*Clock: Rows 3 *Clock: Columns 1 *Clock: (2x1, "Something that changes the title every second to the output from 'date +%H%M%S'") *Clock: (1x1, "Something that changes the title when the day changes)

I know that I should probably use PipeRead for this but I don’t know how I could update it every second, and if I knew i wouln’d know if it was very good at all (in terms of keeping the memory and cpu usage low)

Another thing: Can I use 2 different fonts in the time-line and the date-line?

Why not just use xclock which can display what you want?

This would be ineffecient, although it’s possibe to do via an external script which uses FvwmCommand to SendToModule an FvwmButtons instance. See the following for an idea:

starshine.org/xteddy/thomas/fvwm … aq.html#M1

No, but then you would really be using FvwmScript for this – in fact, there’s several examples of FvwmScript stuff in /usr/share/data/fvwm which already does what you want.

– Thomas Adam

ouch… xclock… that i havent thought about this…

I now have xdaliclock swallowed and it works fine.

Thank you.

Hehe … I was just looking at my swallowed xdaliclock and my swallowed xeyes when I read that … :smiley:

Hi Brain Fury,

I have created a clock with date vi FVWMScript:

Here’s the script:[code]WindowTitle {Time}
WindowSize 75 52

Init
Begin
Set $time = (GetOutput {exec date +%H:%M""} 1 -1)
Set $date = (GetOutput {date “+%a %e %b”} 1 -1)
ChangeTitle 1 $time
ChangeTitle 2 $date
End

PeriodicTasks
Begin
If (RemainderOfDiv (GetTime) 60)==0 Then
Begin
Set $time = (GetOutput {exec date +%H:%M""} 1 -1)
Set $date = (GetOutput {date “+%a %e %b”} 1 -1)
ChangeTitle 1 $time
ChangeTitle 2 $date
End
End

Widget 1
Property
Size 75 26
Position 0 0
Colorset 51
Font “xft:Arial:pixelsize=16:bold”
Type ItemDraw
Flags NoReliefString
End

Widget 2
Property
Size 75 26
Position 0 26
Colorset 52
Font “xft:Arial:pixelsize=15”
Type ItemDraw
Flags NoReliefString
End[/code]

Also the entry in my taskbar:*FvwmDocks: (5x7+27+0, Swallow "Time" `FvwmScript $[fvwm_script]/FvwmScript-Time`)

Best Regards,

TF

Thank you. This looks great! I changed the sizes a little. This is for sure better that xdaliclock.
HEre is what I made of it:

Hi, I’m new to fvwm. It’s cool clock, I like that. But I coundnt make it work with my fvwm.

I embeded your source into my .fvwm2rc file. and cited it as follows:

*FvwmButtons: Geometry 625x80-1-1
*FvwmButtons: Back aliceblue

*FvwmButtons: (Frame 2 Padding 2 2 Container(Rows 2 Columns 6 Frame 1 Padding 10 0))
*FvwmButtons: (1x2 Frame 2 Swallow(UseOld) "FvwmPager" "Module FvwmPager 0 0")
*FvwmButtons: (3x2 Frame 2 Swallow "FvwmIconMan" "Module FvwmIconMan")

*FvwmButtons: (2x2 Frame 0 Container(Rows 2 Columns 2 Frame 0))
#*FvwmButtons: (Frame 2 Swallow(UseOld,NoHints,Respawn) "xbiff" `Exec exec xbiff`)
#*FvwmButtons: (Frame 3 Swallow(UseOld,NoHints,Respawn)  "xload" `Exec exec xload -bg  aliceblue -fg black -update 5 -nolabel`)
#*FvwmButtons: (Frame 3 Swallow "Time" `Module FvwmScript $[fvwm_script]/FvwmScript-Time`)

[b]#*FvwmButtons: (1x2 Frame 2 Swallow(UseOld,NoHints,Respawn) "xclock" `Exec exec xclock -bg aliceblue  -fg black -hd black -hl black -padding 0 -update 1`)
*FvwmButtons: (1x2 Frame 2 Swallow "Time" `FvwmScript $[fvwm_script]/FvwmScript-Time`)[/b]
*FvwmButtons: (1x2, Swallow ( UseOld) "stalonetray" `Exec exec stalonetray -bg  aliceblue --grow-gravity W --icon-gravity W`)

*FvwmButtons: (End)
*FvwmButtons: (End)

I cut it out for clarity.As follows:

#*FvwmButtons: (1x2 Frame 2 Swallow(UseOld,NoHints,Respawn) "xclock" `Exec exec xclock -bg aliceblue  -fg black -hd black -hl black -padding 0 -update 1`)
*FvwmButtons: (1x2 Frame 2 Swallow "Time" `FvwmScript $[fvwm_script]/FvwmScript-Time`)

As you see, I want it to replace the poor xclock.But it didnt work(appear) at all.

Is there anything wrong ? Thanks a lot.

Where in your config is the line:

SetEnv fvwm_script /some/idiotic/path

It either doesn’t exist (good!) or if it does, it needs changing, and your FvwmScript file placed therein. To be honest, the declaration of fvwm_script as an environment variable is not needed, I would instead just copy your FvwmScript-Time file to $HOME/.fvwm and change the above line to:

*FvwmButtons: (1x2 Frame 2 Swallow "Time" `FvwmScript FvwmScript-Time`)

– Thomas Adam

It doesnt exist, You said that.

It works, Thank you very much.