Re: FVWM: best way to update a button or menu item

2015-01-21 Thread Lucio Chiappetti

On Wed, 21 Jan 2015, Lucio Chiappetti wrote:


2) I want to keep the current date on the screen (and time as well, but
   time is no problem)



   Is there a smart way to have a button periodically refresh its
   content ?


thanks to the previous hint to SendToModule ... ChangeButton my solution 
is to run via crontab at midnight the following two line shell script


set a = `date +%a %b %d`
/usr/bin/FvwmCommand  SendToModule MyBox ChangeButton myDate Title '$a[1] 
$a[2] $a[3]'



--

Lucio Chiappetti - INAF/IASF - via Bassini 15 - I-20133 Milano (Italy)
For more info : http://www.iasf-milano.inaf.it/~lucio/personal.html

Do not like Firefox =29 ?  Get Pale Moon !  http://www.palemoon.org



Re: FVWM: best way to update a button or menu item

2015-01-21 Thread Chris Siebenmann
 2) I want to keep the current date on the screen (and time as well, but
 time is no problem)
 
 In my old configuration I do this already, I stick in a corner of the
 screen, one above the other, two applications.
 
 - one is a xdaliclock with the (hh:mm:ss) time (no title, etc.)
 - the other one is a rclock with a geometry of 150x1-0+12, so the
   display of the analog clock is suppressed, and the date is shown
   in the window title bar

 You want the old standby 'xclock', specifically 'xclock -digital'
(possibly with '-strftime' as well, which will let you specify the exact
format of the clock).

- cks



Re: FVWM: best way to update a button or menu item

2015-01-21 Thread Lucio Chiappetti

On Wed, 21 Jan 2015, Chris Siebenmann wrote:


2) I want to keep the current date on the screen



You want the old standby 'xclock', specifically 'xclock -digital'
(possibly with '-strftime' as well


Don't know why I junked it with a don't like back in 2006. As a clock I 
rather liked Jamie Zawinksi's xdaliclock (although at the time I did not 
realize he was the author).  For date I liked rclock (which is also an 
appointment manager ... just use it to tell me when to take a pill and 
when to go home, or occasional to the dentist :-))


Anyhow now I have a solution which works with a crontab, so it is a waste 
to keep there a process for something which occurs once a day.


--

Lucio Chiappetti - INAF/IASF - via Bassini 15 - I-20133 Milano (Italy)
For more info : http://www.iasf-milano.inaf.it/~lucio/personal.html

Do not like Firefox =29 ?  Get Pale Moon !  http://www.palemoon.org



Re: FVWM: best way to update a button or menu item

2015-01-21 Thread Lucio Chiappetti

On Wed, 21 Jan 2015, Thomas Adam wrote:

On Wed, Jan 21, 2015 at 02:23:21PM +0100, Lucio Chiappetti wrote:

On Wed, 21 Jan 2015, Thomas Adam wrote:



This is why you use FvwmEvent and the SendToModule directive:

DestroyModuleConfig FE-UpdateDeskNum
*FE-UpdateDeskNum: new_desk NewFunc

DestroyFunc NewFunc
AddToFunc   NewFunc
+ I SendToModule MyDesk0 ChangeButton desklabel Title $0



in fact I do not understand ho FvmwEvent passes argument $0 to the function
!!



As for your other problem, see: $[desk.n] and: $[desk.name$[desk.n]]
You should really pass those to 'NewFunc'.


not really pass, more hardcode so they are automatically expanded !

With the code above, doing NewFunc anything was correctly changing the 
label to argument anything.


I tried calling NewFunc from FvwmEvent with desktop as argument


mod DestroyModuleConfig FE-UpdateDeskNum
mod *FE-UpdateDeskNum: new_desk NewFunc $[desk.n]


but that is WRONG
the correct way is instead


mod AddToFunc   NewFunc
mod + I SendToModule MyDesk0 ChangeButton desklabel Title desk

$[desk.n]

I was aware of the $-variables, only I noted that inserting them in menus 
or buttons, the value at the moment of the menu or button defintion was 
used. Instead for the function, the value at the moment of function call 
is used !


So it works, even with desktop names (the only provision is that the 
button title shall be created at beginning with a string long enough to 
cater for the longest value it would receive in the future)


--

Lucio Chiappetti - INAF/IASF - via Bassini 15 - I-20133 Milano (Italy)
For more info : http://www.iasf-milano.inaf.it/~lucio/personal.html

Do not like Firefox =29 ?  Get Pale Moon !  http://www.palemoon.org



Re: FVWM: best way to update a button or menu item

2015-01-21 Thread Thomas Adam
On Wed, Jan 21, 2015 at 12:27:49PM +0100, Lucio Chiappetti wrote:
 1) I want to keep (e.g. in the lower left corner of my screen) a text
label with the desktop number or name
 
After some experiments, I think the best is to use FvwmButtons

Yes.

I define a transparent color set
Colorset 10 Transparent,Fore White
 
then for each desktop I define a FvwmButtons like this (only I
call them 0,1,2 ...)
 
Style MyDesk0 StartsOnDesk 0, SkipMapping,NoTitle,WindowListSkip,
  !Borders,!Handles,ParentalRelativity,StickyAcrossPages,
  !StickyAcrossDesks,StaysOnBottom
DestroyModuleConfig MyDesk0*
*MyDesk0: (Title desk 0, Action Nop)
*MyDesk0: Colorset 10
 
Module FvwmButtons -g -0-0 MyDesk0
 
Each one has hardcoded the desk number (or potentially name).
I hoped I could use $[desk.n] as a dynamic content. but I found with
some disappointment that it is the current desk at the moment the
button or menu or whatever is created.
 
Is there any smarter solution (with a single fvwmbutton or other
widget for all desks, which displays the current desk number as soon
as one moves to it ?)

This is why you use FvwmEvent and the SendToModule directive:

DestroyModuleConfig FE-UpdateDeskNum
*FE-UpdateDeskNum: new_desk NewFunc

AddToFunc StartFunction I Module FvwmEvent FE-UpdateDeskNum

DestroyFunc NewFunc
AddToFunc   NewFunc
+ I SendToModule MyDesk0 ChangeButton desklabel Title $0

The above assumes you have in your FvwmButtons configuration a suitable
button with the id of desklabel, something like:

*MyDesk0: (1x1, Id desklabel, Title ...)

 2) I want to keep the current date on the screen (and time as well, but
time is no problem)

There's numerous FvwmScript examples doing this; see fvwm-themes and
friends.

-- Thomas Adam



Re: FVWM: best way to update a button or menu item

2015-01-21 Thread Lucio Chiappetti

On Wed, 21 Jan 2015, Thomas Adam wrote:


This is why you use FvwmEvent and the SendToModule directive:

DestroyModuleConfig FE-UpdateDeskNum
*FE-UpdateDeskNum: new_desk NewFunc

AddToFunc StartFunction I Module FvwmEvent FE-UpdateDeskNum

DestroyFunc NewFunc
AddToFunc   NewFunc
+ I SendToModule MyDesk0 ChangeButton desklabel Title $0


Thanks for the hints towards FvwmEvent (I thought something like that but 
first of all did not know the names of the applicable event !)


anyhow, I did that (testing in FvwmConsole), I just replaced the last 
statement with


+ I SendToModule MyDesk0 ChangeButton desklabel Title desk $0

If I call NewFunc x the button label is updated fine

However as soon as invoke Module FvwmEvent FE-UpdateDeskNum I get in the 
error console twice this message


FE-UpdateDeskNum: incomplete event definition *FE-UpdateDeskNumnew_desk
FE-UpdateDeskNum: incomplete event definition *FE-UpdateDeskNumnew_desk

in fact I do not understand ho FvmwEvent passes argument $0 to the 
function  !!


(BTW I am using fvwm 2.5.26)

Thanks in advance for any further hint

--

Lucio Chiappetti - INAF/IASF - via Bassini 15 - I-20133 Milano (Italy)
For more info : http://www.iasf-milano.inaf.it/~lucio/personal.html

Do not like Firefox =29 ?  Get Pale Moon !  http://www.palemoon.org




Re: FVWM: best way to update a button or menu item

2015-01-21 Thread Thomas Adam
On Wed, Jan 21, 2015 at 02:23:21PM +0100, Lucio Chiappetti wrote:
 On Wed, 21 Jan 2015, Thomas Adam wrote:
 
 This is why you use FvwmEvent and the SendToModule directive:
 
  DestroyModuleConfig FE-UpdateDeskNum
  *FE-UpdateDeskNum: new_desk NewFunc
 
  AddToFunc StartFunction I Module FvwmEvent FE-UpdateDeskNum
 
  DestroyFunc NewFunc
  AddToFunc   NewFunc
  + I SendToModule MyDesk0 ChangeButton desklabel Title $0
 
 Thanks for the hints towards FvwmEvent (I thought something like that but
 first of all did not know the names of the applicable event !)
 
 anyhow, I did that (testing in FvwmConsole), I just replaced the last
 statement with
 
 + I SendToModule MyDesk0 ChangeButton desklabel Title desk $0
 
 If I call NewFunc x the button label is updated fine
 
 However as soon as invoke Module FvwmEvent FE-UpdateDeskNum I get in the
 error console twice this message
 
 FE-UpdateDeskNum: incomplete event definition *FE-UpdateDeskNumnew_desk
 FE-UpdateDeskNum: incomplete event definition *FE-UpdateDeskNumnew_desk
 
 in fact I do not understand ho FvmwEvent passes argument $0 to the function
 !!
 
 (BTW I am using fvwm 2.5.26)

Use 2.6.5; 2.5.x hasn't been supported in years.

As for your other problem, see:

$[desk.n] and: $[desk.name$[desk.n]]

You should really pass those to 'NewFunc'.

-- Thomas Adam