Previous version could return 1 on one update and 900 on the next (1st
being GB, 2nd MB) a user appending "GB" to the value suddenly has a
900GB disk available. Returned keys are now: size_mb, size_gb,
used_mb, used_gb, avail_mb, avail_gb, and percentage is now: used_p.
The regular expression did not match the following output from
hddtemp: |/dev/sg0|ST9160823ASG|38|C|. Fixed by allowing digits in the
"disk" part of the expression.
Signed-off-by: Michael Unterkalmsteiner <miciu@gmx.de>
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
I wrote this module with graphs in mind and returned values were
somewhat hostile towards textbox widgets. Now KB/MB values are
formatted to one decimal point. There is still work to be done.
Default path is set to /sys/class/thermal but at least it's easier to
switch to /sys/class/hwmon (i.e. coretemp) now without much code
modification. Note; zone IDs are probably different than those in
/proc/acpi/thermal_zone
Initial widget code was sent by Benedikt Sauer. After some cleanup it
is ready to go into master. It uses data exposed trough /sys and it is
used in the exact same way as the bat widget (and /proc). This widget
will replace batat and acpitool, it will be moved to contrib and
retired.
Widget argument can now be a string (full path to the mbox) or a
table. In case of a table 1st field is full path to the mbox and 2nd
is maximum text lenght after which it will be truncated. If there is a
third field scrolling will be used - if so, 3rd field should be the
widget name.
Widget takes an optional argument that controls truncate and
scrolling. In case of a number truncate is used, it represents the
maximum lenght of widget text. In case of a table scrolling is used,
1st field is maximum lenght, and 2nd is widget name. An example:
{24, "mpdwidget"}
Thanks to Felix for bringing this to my attention. Obviously there was
already a safety net for feeding progressbars and graphs... and while
this makes for a good coding practice it's not a big deal. We have
widgets of type textbox for one, and a lot of string concatenation
happens. Strings are formatted, markup is applied...
This simplifies the code, in addition string.format is now used to
ensure all values have one decimal point at all time. We'll see how
recent changes and this one will affect people that use network graphs.
Vicious will now divide values by 100 to match the default graph
max_value of 1. Graphs support changing this value, but progressbars
don't. We shouldn't use 100 for one and 1 for the other.
If we return "N/A" like we usually do then format string "$1$2" would
look like "N/AN/A". If "/" is returned a progressbar could be
broken. Now returns are: symbol for state "unknown", 0 for battery
charge, N/A for remaining time.
If we return "N/A" like we usually do then format string "$1$2" would
look like "N/AN/A". If "/" is returned a progressbar could be
broken. Now returns are: symbol for state "unknown", 0 for battery
charge, N/A for remaining time.
Previous commit had redudant string > number conversions, and only
covered one scenario - when battery is charged. bioe007 suggested to
use math.min. Now lets explain why this is needed. Some (lousy)
batteries report "remaining capacity" higher than "last full capacity"
when AC is connected. That leads to battery charges like "160%".