Hello,

First, if you use 3.4, please upgrade to something newer. 3.4 is 7 years
old and is _not_ supported anymore and hasn't been since 2012. The git
version of Awesome is currently recommended, the official release is 3.5.9
(from 2012 + bug fixes until ~2017).

Then, please don't use io.popen. Awesome is single threaded and this
block/lock your whole X11 session (all application and mouse/keyboard
events) while the command is being executed. Newer Awesome version have
either LGI async API or, in case of the git version of awesome, awful.spawn
async functions.

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

 naughty.notify is the correct API

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

Yes, there is:

 local result = condition1 and object_when_true or object_when_false

 local first_non_false_or_nil_object = object1 or object2 or object3 or
object4

lua syntax is very consistent and small, but, beside switch(), everything
is there for sequential, object and functional programming

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

 The Awesome 3.4 graphical API has been replaced. The current API
documentation is here
http://new.awesomewm.org/apidoc/documentation/03-declarative-layout.md.html
5)      Suggested improvements?

See above

On 30 July 2016 at 01:50, David Sorkovsky <davidsorkov...@hotmail.com>
wrote:

> Update / Share - Answered questions 2 & 3 myself…
>
>
>
> 2) Ternary:
>
>
>
> x = condition ? if_true : if_false                                 --
> Doesn’t work
>
>
>
> x = condition and if_true or if_false                         -- Works
>
>
>
>
>
> 3) fif:
>
>
>
>                 Doesn’t exist – make it…
>
>
>
>                 function fif(condition, if_true, if_false)
>
>                                 if condition then return if_true else
> return if_false end
>
>                 end
>
>
>
> Regards ,
>
>
>
> Dave
>
>
>
> *From:* David Sorkovsky [mailto:davidsorkov...@hotmail.com]
> *Sent:* Friday, 29 July 2016 9:21 PM
> *To:* 'Riccardo Sven Risuleo' <riccardos...@gmail.com>;
> awesome@naquadah.org
> *Subject:* RE: UPS Status [NUT]
>
>
>
> 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> 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]
> Sent: Tuesday, 26 July 2016 11:01 PM
> To: David Sorkovsky <davidsorkov...@hotmail.com>
> Cc: 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> 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
>
>
>
> [image: Image removed by sender.]
> <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>
>
>
>
>
> <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