Commit Graph

30 Commits

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