Update to use upower_dbus 0.3.0
This commit is contained in:
parent
bebe9fd845
commit
8ed443ed88
|
@ -22,6 +22,8 @@ local awful = require("awful")
|
|||
local naughty = require("naughty")
|
||||
|
||||
local power = require("upower_dbus")
|
||||
local WarningLevel = power.enums.BatteryWarningLevel
|
||||
local DeviceType = power.enums.DeviceType
|
||||
|
||||
-- Awesome DBus C API
|
||||
local cdbus = dbus -- luacheck: ignore
|
||||
|
@ -52,12 +54,12 @@ function widget:update()
|
|||
local warning_level = self.device.warninglevel
|
||||
|
||||
self.tooltip:set_text(
|
||||
percentage .. "%" .. " - " .. self.device.state)
|
||||
percentage .. "%" .. " - " .. self.device.state.name)
|
||||
|
||||
if warning_level == "Low" or warning_level == "Critical" then
|
||||
if warning_level == WarningLevel.Low or warning_level == WarningLevel.Critical then
|
||||
naughty.notify({
|
||||
preset = naughty.config.presets.critical,
|
||||
title = warning_level .. " battery!",
|
||||
title = warning_level.name .. " battery!",
|
||||
text = percentage .. "% remaining"})
|
||||
end
|
||||
else
|
||||
|
@ -121,7 +123,9 @@ function widget:init()
|
|||
for _, d in ipairs(self.manager.devices) do
|
||||
devices[d.type] = d
|
||||
end
|
||||
self.device = get_data(devices["Battery"] or devices["Line Power"])
|
||||
self.device = get_data(
|
||||
devices[DeviceType.Battery]
|
||||
or devices[DeviceType"Line Power"])
|
||||
|
||||
self.tooltip = awful.tooltip({ objects = { widget },})
|
||||
self.gui_client = ""
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package = "power_widget"
|
||||
version = "0.3.0-1"
|
||||
source = {
|
||||
url = "git://github.com/stefano-m/awesome-power_widget",
|
||||
tag = "v0.3.0"
|
||||
}
|
||||
description = {
|
||||
summary = "A Power widget for the Awesome Window Manager",
|
||||
detailed = [[
|
||||
Monitor your power devices in Awesome with UPower and DBus.
|
||||
]],
|
||||
homepage = "https://github.com/stefano-m/awesome-power_widget",
|
||||
license = "GPL v3"
|
||||
}
|
||||
supported_platforms = {
|
||||
"linux"
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1",
|
||||
"upower_dbus >= 0.3.0, < 0.4"
|
||||
}
|
||||
build = {
|
||||
type = "builtin",
|
||||
modules = {
|
||||
power_widget = "power_widget.lua"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue