-local bat = {
- status = "not present",
- perc = "N/A",
- time = "N/A",
-}
-
-function worker(args)
- local args = args or {}
- local battery = args.battery or "BAT0"
- local show_all = args.show_all or false
- local refresh_timeout = args.refresh_timeout or 30
- local header = args.header or " Bat "
- local header_color = args.header_color or beautiful.fg_normal or "#FFFFFF"
- local color = args.color or beautiful.fg_focus or "#FFFFFF"
- local shadow = args.shadow or false
-
- local mybattery = wibox.widget.textbox()
-
- local mybatteryupdate = function()
- local present = first_line("/sys/class/power_supply/"
- .. battery
- .. "/present")
+
+local function worker(args)
+ local bat = {}
+ local args = args or {}
+ local timeout = args.timeout or 30
+ local battery = args.battery or "BAT0"
+ local ac = args.ac or "AC0"
+ local notify = args.notify or "on"
+ local settings = args.settings or function() end
+
+ bat.widget = wibox.widget.textbox('')
+
+ bat_notification_low_preset = {
+ title = "Battery low",
+ text = "Plug the cable!",
+ timeout = 15,
+ fg = "#202020",
+ bg = "#CDCDCD"
+ }
+
+ bat_notification_critical_preset = {
+ title = "Battery exhausted",
+ text = "Shutdown imminent",
+ timeout = 15,
+ fg = "#000000",
+ bg = "#FFFFFF"
+ }
+
+ function update()
+ bat_now = {
+ status = "Not present",
+ ac_status = "N/A",
+ perc = "N/A",
+ time = "N/A",
+ watt = "N/A"
+ }
+
+ local bstr = "/sys/class/power_supply/" .. battery
+ local astr = "/sys/class/power_supply/" .. ac
+ local present = first_line(bstr .. "/present")