You are not logged in.

#1 2013-08-06 00:40:24

gtolden
Member
Registered: 2013-07-20
Posts: 13

[solved]Awesome Vicious: Is there any way use if command in a widget

Hi
I am using awesome windows manager with vicious widgets. I wonder if there is a way to change text color of my-battery widget depanding on charging status (i.e. green when charging, red when not; or green when the capacity > 90% etc. ).

Usually, the code of a battery widget should like this:

 vicious.register(batwid, vicious.widgets.bat, '$1 $2% $3', 60, "BAT0")

where $1 means charging status (+ or -), $2 means capacity (int) and $3 means time remain (int) , so I guess I can use

if $1 == + then ... else ... end 

or something. But I found no where to place this command: putting it inside the quotes, then the "if ... then ... " will also be shown, outside the quotes, then $1 won't be recognized.

THX

Last edited by gtolden (2013-08-06 13:04:05)

Offline

#2 2013-08-06 11:49:44

ilusi0n
Member
Registered: 2010-06-09
Posts: 187

Re: [solved]Awesome Vicious: Is there any way use if command in a widget

You can use a function to achieve what you want. With the function you can access those values and choose what to pipe in the statusbar. There is a lot of examples arround in arch foruns and the internet. But you can look at my battery widget and make your own widget https://github.com/ilusi0n/dotcats/blob … idgets.lua

Offline

#3 2013-08-06 13:03:29

gtolden
Member
Registered: 2013-07-20
Posts: 13

Re: [solved]Awesome Vicious: Is there any way use if command in a widget

Wow, awesome! Thanks, that's exactlly what I need, as well as many tips I can learn from your example. smile
many thanks for sharing

Offline

Board footer

Powered by FluxBB