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")
                                                                                
                f:close()
--                                                                              
               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"
                                                                                
                else
                                                                                
                                myUPS.widget.text = "Batt"
                                                                                
                end
                                                                                
                myUPS.tooltip:set_text(str)
                                                                                
                myUPS.timer:again()
                                                                                
end

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

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

                myUPS.refresh()

Pending / Further questions…


1)      Get system messages / “wall” notifications to display as a popup 
(naughty.notify)


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?


Regards,

Dave

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 
battery...

        Daemon:
          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


Regards,

Dave


-----Original Message-----
From: Aleksei Fedotov [mailto:l...@cfotr.com<mailto:l...@cfotr.com>]
Sent: Tuesday, 26 July 2016 11:01 PM
To: David Sorkovsky 
<davidsorkov...@hotmail.com<mailto:davidsorkov...@hotmail.com>>
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
percentage.

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,
Aleksei


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

[https://ipmcdn.avast.com/images/2016/icons/icon-envelope-tick-round-orange_184x116-v1.png]<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
    Virus-free. 
www.avast.com<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>

Reply via email to