Hi All

Here is my simple widget for the UPS data…

                -- UPS widget
                myUPS = {}
                myUPS.widget = widget({type = "textbox"})
                myUPS.tooltip = awful.tooltip({ objects = { myUPS.widget },})
                myUPS.timer = timer({ timeout = 55 })

                myUPS.refresh =             function()            local f = 
io.popen("upsc myups")
                local str = f:read("*all")
               myUPS.widget.text = (( string.find(str, "ups.status: OL") ) ? 
"Line" : "Batt")
               myUPS.widget.text = fif( string.find(str, "ups.status: OL"), 
"Line", "Batt")
                if string.find(str, "ups.status: OL") then
                                myUPS.widget.text = "Line"
                                myUPS.widget.text = "Batt"

                myUPS.widget:buttons( awful.util.table.join( awful.button({ }, 
1, function() myUPS.refresh() end) ))

                myUPS.timer:add_signal("timeout", function() myUPS.refresh() 


Pending / Further questions…

1)      Get system messages / “wall” notifications to display as a popup 

2)      Is the ternary operator supported? [if so, what have I done wrong]

3)      Is “iif” supported? [if so, what have I done wrong]

4)      Graphical (possibly using Bashets as suggested by Riccardo)

5)      Suggested improvements?



From: Riccardo Sven Risuleo [mailto:riccardos...@gmail.com]
Sent: Wednesday, 27 July 2016 12:46 AM
To: David Sorkovsky <davidsorkov...@hotmail.com>; awesome@naquadah.org
Subject: Re: UPS Status [NUT]

Hi David,
I would advise you to use bashets (https://awesome.naquadah.org/wiki/Bashets); 
you get all kinds of widgets (barplots, graphs,numerical) to display raw data 
that gets extracted with your own bash scripts.
Hope this helps you,
All the best
On Tue, Jul 26, 2016 at 4:24 PM David Sorkovsky 
<davidsorkov...@hotmail.com<mailto:davidsorkov...@hotmail.com>> wrote:
Hi Aleksei,

I looked at most of the battery monitor widgets but the seemed to be for Laptops

The UPS is external (before) the PC and "NUT" runs to get status (upsc)

Just as an FYI, upower returns the following wether the UPS is powered or on 

          daemon-version:  0.9.23
          can-suspend:     no
          can-hibernate:   no
          on-battery:      no
          on-low-battery:  no
          lid-is-closed:   no
          lid-is-present:  no
          is-docked:       yes

Wondering if anyone has a widget the processes the info "upsc" provides (or do 
I write one)

Wondering if there is a way to get Awesome to show system messages from a 
script as notifications



-----Original Message-----
From: Aleksei Fedotov [mailto:l...@cfotr.com<mailto:l...@cfotr.com>]
Sent: Tuesday, 26 July 2016 11:01 PM
To: David Sorkovsky 
Cc: awesome@naquadah.org<mailto:awesome@naquadah.org>
Subject: Re: UPS Status [NUT]

Hi David,

Could you check if upowerd could see your UPS ? Run 'upower -d' in
your terminal and look if it has information about UPS status.

If upower provides information about UPS status, you can use widget
https://github.com/lexa/awesome_upower_battery . It grabs information
from upowerd via DBus and displays battery status and charge

On 7/26/16, David Sorkovsky 
<davidsorkov...@hotmail.com<mailto:davidsorkov...@hotmail.com>> wrote:
> Hi All,
> Anyone display information on a UPS [I am using NUT to monitor it]?
> Wanted:       Widget?
>               Notification popup?
> Regards,
> Dave
> ---
> This email has been checked for viruses by Avast antivirus software.
> https://www.avast.com/antivirus

Kind Regards,

This email has been checked for viruses by Avast antivirus software.


Reply via email to