On 17/08/2014 11:41, Thomas Adam wrote:
On Sun, Aug 17, 2014 at 11:11:42AM +0100, Jamie Griffin wrote:
Within my dock (FvwmButtons) I would like to have the day (number) and the
three letter abbreviation of the current date shown in-place of an icon
inside one of my buttons, sort-of like a simple calendar display. I believe
I can achieve this with PipeRead and echo but as I'm still learning about
the scripting part of fvwm I can't quite get it to do what I want.
You need to use the SendToModule command with the 'ChangeButton'
directive to do this.
So first step is to give your button some identifier:
*Foo: (1x1, Id MyButton, Title "Hello...")
Then from that you can do:
SendToModule Foo ChangeButton Id MyButton Title "Something different..."
Note that I wouldn't suggest you use PipeRead at all for this as you'll
block fvwm completely. You could spawn a separate script and use
FvwmCommand to do this instead.
AddToFunc StartFunction I Module FvwmCommandS
AddToFunc StartFunction I Module FvwmButtons Foo
AddToFunc StartFunction I Exec exec ~/bin/my_date_script.sh
~/bin/my_update_script.sh might look something like this:
#!/bin/sh
while :; do
text="$(date +'...')"
FvwmCommand "SendToModule Foo ChangeButton MyButton Title $text"
sleep 1
done
-- Thomas Adam
Thanks for explaining that. So, say I create a function for it rather
than starting the script in the startfunction, when I define the
particular button i reference the function to get the text like this:
*Foo: 1x1, Id MyButton, Title MyDateFunction)
Would that do it, do you think?