deficient / battery-widget Goto Github PK
View Code? Open in Web Editor NEWBattery status indicator for awesome WM
License: The Unlicense
Battery status indicator for awesome WM
License: The Unlicense
Title is self explainatory. Widget always displays battery_prefix regardless of whether the ac cord is plugged in or not.
> awesome --version
awesome v4.2-289-g98e59225 (Human after all)
• Compiled against Lua 5.3.4 (running with Lua 5.3)
• D-Bus support: ✔
• execinfo support: ✔
• xcb-randr version: 1.6
• LGI version: 0.9.2
> lua -v
Lua 5.3.4 Copyright (C) 1994-2017 Lua.org, PUC-Rio
Nice work btw. Keep it up.
Using this widget in my wibar, I am not sure why, but the font of the widget is very small. I guess it is not respecting my bar config font & size. Here is my bar
Some stuff which might help
-- Battery
local battery_widget = require("battery-widget")
local BAT0 = battery_widget { adapter = "BAT0", ac = "AC" }
battery_widget {
ac = "AC",
adapter = "BAT0",
ac_prefix = "AC: ",
battery_prefix = "Bat: ",
percent_colors = {
{ 25, "red" },
{ 50, "orange"},
{999, "green" },
},
listen = true,
timeout = 10,
widget_text = "${AC_BAT}${color_on}${percent}%${color_off}",
widget_text = '<span font="Roboto Mono 10">${AC_BAT}</span>${color_on}${percent}%${color_off}',
tooltip_text = "Battery ${state}${time_est}\nCapacity: ${capacity_percent}%",
alert_threshold = 5,
alert_timeout = 0,
alert_title = "Low battery !",
alert_text = "${AC_BAT}${time_est}"
}
-- Add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
BAT0,
mytextclock,
},
}
end)
-- }}}
Thanks in advance :)
I am using a Pinebook Pro, which has a different battery device name than normal (/sys/class/power_supply/cw2015-battery/ instead of /sys/class/power_supply/BATx), which I adjusted for in my Awesome config. When running on AC power, the widget works perfectly. However, when just using the battery, the widget crashes with .config/awesome/battery-widget/init.lua:240: attempt to perform arithmetic on a nil value (field 'charge').
The relevant section of my config is
`local battery_widget = require("battery-widget")
local BAT0 = battery_widget { adapter = "cw2015-battery", ac = "dc-charger", timeout = 10, listen = true }
...
s.mywibox:setup {
...
( -- Right widgets
BAT0,
...`
I use your battery widget in Linux. I like it. I, however, need to maintain some machines running FreeBSD. FreeBSD doesn't have acpid (it has devd). It also doesn't use sysfs, it uses sysctls. The translations are relatively straightforward (well, acpid->devd is some work)
My lua sucks and I have no interest in improving it, but I can tell you how to accomplish most of what you need in FreeBSD if anyone is interested in porting this. Meanwhile I will try to find another battery monitor.
I follow the step to add the battery widget, but I get this error:
/home/user/.config/awesome/battery-widget/init.lua 143: bad argument # 1 to 'tolower' (string expected, got nil)
Hi, I am new to arch and I was wondering if there are any dependencies or unicode character support packages that work well with the widget. When I change the prefix "Bat:" to "U+1F50B" to display a battery icon, the widget renders "U+1F50B" instead of the icon. Any suggestion would be very much appreciated.
Using right_layout:add(battery.widget)
throws an error cause there is no object right_layout
. How may I add it to the wibar, after initial setup?
In your screenshot the battery capacity is 119%, is that normal?
Hey.
Renaming battery-widget.lua to init.lua would make using Your module slightly cleaner in dotfiles-repository-like environments.
By default require('MODULE')
will try to load MODULE.lua
, and then MODULE/init.lua
, thus this repo could be easily used as a submodule in git and such, without playing with symlinks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.