Commit Graph

44 Commits

Author SHA1 Message Date
Stefano Mazzucco ca6fb9dd7a Fix spelling mistake: Emtpy -> Empty 2020-04-10 07:27:01 +01:00
Stefano Mazzucco 5a7b421abb Add rockspec for version 0.5.3 2019-12-18 16:55:03 +00:00
Stefano Mazzucco 1511cb1af3 Tweak README a little bit 2019-12-18 13:25:31 +00:00
Stefano Mazzucco 0f1a1c726b Add shape and timeout to notification example in README 2019-12-18 13:22:01 +00:00
Stefano Mazzucco f469d040fc Get warning_level in maybe_warn only if needed 2019-12-18 10:50:41 +00:00
Stefano Mazzucco ca22180049 Compute percentace in maybe_warn only if needed 2019-12-18 10:50:10 +00:00
Stefano Mazzucco 402ad1bddf Add option to use custom message in warning 2019-12-16 21:30:26 +00:00
Stefano Mazzucco d149972d2e Don't warn for both critical and custom 2019-12-16 21:26:16 +00:00
Stefano Mazzucco c7f3a2a24d Destroy notification if device is not discharging 2019-12-16 21:25:17 +00:00
Stefano Mazzucco b26b4c25b0 Reformat code for indentation 2019-12-16 21:25:01 +00:00
Stefano Mazzucco 50866566f7 Remove unused argument from function 2019-12-13 16:35:41 +00:00
Stefano Mazzucco 1a108fcacf Fix default gui_client assignment
There was a typo and it said `ni` rather than `nil`. Luckily (or unluckily, it
depends on how you see it), the variable `ni` isn't defined anywhere so it
default to... `nil`.

Not worth making another release with this change only as nothing actually
breaks, so it will end up in the next release.
2019-12-13 11:50:40 +00:00
Stefano Mazzucco bf016cb2e6 Add rockspec for version 0.5.2 2019-12-13 11:35:35 +00:00
Stefano Mazzucco 95281fd286 Add option to show additional notification 2019-12-13 11:28:17 +00:00
Stefano Mazzucco 6ced769c55 Hide all implementation, expose just the widget and its config 2019-12-13 11:05:57 +00:00
Stefano Mazzucco 072c113f2a Make _maybe_warn take parameters 2019-12-13 10:49:04 +00:00
Stefano Mazzucco 5fa1cf3c25 Destroy the "low battery" notification if present
This avoids that multiple notifications pop up repeatedly on the screen, which
is pretty annoying.
2019-12-13 10:16:10 +00:00
Stefano Mazzucco 834530e200 Refactor code to update the widget 2019-12-13 10:09:00 +00:00
Stefano Mazzucco 9efe9f64c8 Add rockspec for v0.5.1 2019-11-11 00:38:43 +00:00
Stefano Mazzucco 1826fdcea9 Guard against nil in "time to empty/full" 2019-11-11 00:35:18 +00:00
Stefano Mazzucco 4f0f674771 Add rockspec for version 0.5.0 2019-11-10 11:28:57 +00:00
Stefano Mazzucco 18f379f323 [BREAKING] Initialize the widget when `require`d 2019-11-09 22:25:24 +00:00
Stefano Mazzucco bdb814d67c Don't attempt to spawn gui client if not set 2019-11-09 22:24:46 +00:00
Stefano Mazzucco c1272192d7 Add time to empy/full to tooltip 2019-11-09 22:14:12 +00:00
Stefano Mazzucco 51f43bd03e Add info about installing with NixOS to README 2019-08-21 20:58:24 +01:00
Stefano Mazzucco 38ad9710aa Add rockspec for version 0.4.0 2019-05-08 16:47:54 +01:00
Stefano Mazzucco 6f5d566ec0 Use lgi to get icons directly from GTK
Rather than setting a path to the icons, use lgi to get the current GTK theme
and then look up the icons. Then set the image as a cairo surface by using the
GTK api directly.

With this change, one can modify their GTK icon theme (e.g. with lxappearance),
restart AwesomeWM and have the widget's icon automatically updated.
2019-05-08 16:45:33 +01:00
Stefano Mazzucco 65e0f96115 Document workaround failure with requiring enum.lua 2019-04-25 20:41:39 +01:00
Stefano Mazzucco 6e447e88f0 Warn only if battery is discharging 2018-07-12 21:20:06 +01:00
Stefano Mazzucco 6844a9d3c0 Add a setting for critical battery level and default it to 5%
Some batteries do not set their levels, so we need a way to tell the widget to
display a "low battery" warning.
2018-07-03 07:23:49 +01:00
Stefano Mazzucco 388186cc28 Use /org/freedesktop/UPower/devices/DisplayDevice as self.device
DisplayDevice is a "special" device object that represent what a widget should
display, however it does *not* give information about Line Power. E.g. when a
laptop has no battery but is plugged on the mains, DisplayDevice says that no
device should be displayed and the icon is set to "battery-missing" (which is
in fact true).

However, if we are working, it means that we must be getting power from
somewhere, so let's display something in the tooltip anyway.

Command line example

$ upower -i /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         no
  updated:              Sun 05 Nov 2017 04:19:48 PM GMT (415 seconds ago)
  has history:          no
  has statistics:       no
  unknown
    warning-level:       none
    icon-name:          'battery-missing-symbolic'

See also https://upower.freedesktop.org/docs/UPower.html#UPower.GetDisplayDevice
2017-11-05 16:51:31 +00:00
Stefano Mazzucco 14f0f5a962 Use on_properties_changed on device to update the widget
Instead of using Awesome's DBus api, use directly the on_properties_changed
method on the device object. This change removes a lot of boilerplate code and
makes the module much simpler!
2017-11-05 16:00:49 +00:00
Stefano Mazzucco 584fb4b3f6 Add forgottend square brackets
Fixed broken code that was missing square brackets and would break on machines
with no battery.
2017-11-05 15:43:37 +00:00
Stefano Mazzucco 8ed443ed88 Update to use upower_dbus 0.3.0 2017-11-05 15:18:12 +00:00
Stefano Mazzucco bebe9fd845 Add "Contributing" section to README 2017-07-16 13:12:18 +01:00
Stefano Mazzucco 6511ed27a7 Improve documentation about installing the widget
- remove section about installing from source: this requires some juggling and
  symlinking, so I will leave it to people who *really* want to do it
- explain how to export the local luarocks path when installint locally with luarocks
2017-07-16 13:09:58 +01:00
Stefano Mazzucco 3426bb1262 Add rockspec for version 0.2.1 2017-04-11 09:01:58 +01:00
Stefano Mazzucco 4ddc1f5820 Do not use ctx:iteration() as it causes a Lua Stack Dump
Whenever `ctx:iteration()` is called, when the PropertiesChanges signal is
emitted, awesome reports a problem with data left in the Lua stack:

```
2017-04-11 07:08:52 W: awesome: a_glib_poll:372: Something was left on the Lua stack, this is a bug!
-------- Lua stack dump ---------
3: nil
2: userdata     #16     0x2251a78
1: userdata     #320    0x27c5408
------- Lua stack dump end ------
```

This may eventually result in crashes or freezes. To fix the problem, don't use
the GLib context, instead:

- grab all properties from the proxy and copy them over into a table
- use that table as the data for the widget
- update the table when the PropertiesChanged signal is emitted
2017-04-11 08:54:14 +01:00
Stefano Mazzucco e7b5727d40 Remove reference about DBus headers from README
Those headers were needed to build ldbus
2017-04-09 00:35:11 +01:00
Stefano Mazzucco 992378d509 Remove reference to ldbus from README
This module does not depend (implicitly) on ldbus any longer.
2017-04-09 00:29:38 +01:00
Stefano Mazzucco 1a52e3a910 Update widget to use upower_dbus 0.2 (with dbus_proxy)
This should allow more stability.
2017-04-09 00:03:57 +01:00
Stefano Mazzucco c6c22d4d53 Fix typo in README: upower_widget -> power_widget 2017-03-10 16:10:15 +00:00
Stefano Mazzucco 4f58002cb5 Release version 0.1.0
This commit adds the versioned rockspeck and will be tagged with v0.1.0
2017-03-10 16:05:05 +00:00
Stefano Mazzucco 93ccdd613c Initial commit 2017-03-10 16:01:01 +00:00