Commit Graph

15 Commits

Author SHA1 Message Date
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