You are not logged in.

#1 2010-04-15 16:24:33

tartan
Member
From: Moscow, Russia
Registered: 2009-09-24
Posts: 61

FvwmButtons and dynamically set icons

Hello again, Arch community!

Does anybody know if there is a way to make fvwm buttons show definite icons if definite statement is true, e.g.

if
battery_charged = 1
then icon batt.green.png
else if
battery_charged = 0
then icon batt.red

etc.

I can write the script which would return the icon name, but how do I make it interact with FvwmButtons?

//Would be really really great together with shaped icons and conky: 'live' desktop with rather useful buttons.

Last edited by tartan (2010-04-15 16:35:57)

Offline

#2 2010-04-15 17:50:13

ThomasAdam
Member
From: Southampton, England
Registered: 2005-10-26
Posts: 149

Re: FvwmButtons and dynamically set icons

tartan wrote:

Hello again, Arch community!

Does anybody know if there is a way to make fvwm buttons show definite icons if definite statement is true, e.g.

if
battery_charged = 1
then icon batt.green.png
else if
battery_charged = 0
then icon batt.red

etc.

I can write the script which would return the icon name, but how do I make it interact with FvwmButtons?

You use the SendToModule command.

Let's say you have a FvwmButtons such as this:

*FvwmB: (1x1, Id "SomeButton", Title "Hello", Icon foo.png)

By giving it an id, you are then able to refer to it with SendToModule and change some of its properties.  So in your example, your script would have to do something like this (again, contrived):

if charging then:
    FvwmCommand 'SendToModule FvwmB Icon charging.png, Title "Charging"'
else:
    FvwmCommand 'SendToModule FvwmB Icon charged.png, Title "Charged"'
endif

The important part here are the FvwmCommand lines.  In order for this external script to use that, you will need to have:

AddToFunc StartFunction I Module FvwmCommandS

... in your .fvwm2rc file.  Then the socket that FvwmCommand uses to talk to FVWM is present.

-- Thomas Adam

Offline

#3 2010-04-15 18:26:36

tartan
Member
From: Moscow, Russia
Registered: 2009-09-24
Posts: 61

Re: FvwmButtons and dynamically set icons

Thank you, Adam!
Thank you!

I keep thinking fvwm is more a library or a programming language than a wm. Damn mighty.

I will share the result if it would worth it.

Offline

Board footer

Powered by FluxBB