Widget returns speed and cache information for all available
CPUs/cores. It stores cpu speed in mhz and ghz in a table as well as
cpu cache in kb and mb. Values are retrieved using the CPU ID, i.e. we
would retrieve speed in ghz for CPU or core 1 with this format string:
${1 ghz}.
It is somewhat lighter, faster and simpler than wget. It is as common
as wget these days... from GnuPG to Git and Gimp, they all depend on
it, and we all have it installed.
Pacman 3.3 returns one package on a line, without any other
information. So now we count lines, while before the list of packages
was provided on one line along with the number of updates - so we
didn't have to count them. Old code was commented out, and is waiting
for removal.
Function takes two arguments, the text to be truncated and the max
lenght. Last three characters will be replaced by "...". Mbox and MPD
widgets that previously did it them selves are now using this helper.
The cpufreq widget supplements the cpu widget. It returns the current
CPU scaling frequency (in MHz and GHz), voltage (in mV and V) and
governor information for a requested CPU. If supported by the
processor and correct kernel modules are loaded.
It is simillar to the awful.util.escape now, using a table which we
could expand (and rename) with other unwated characters if it comes to
that. I saw awesome break on many occasions because of encoding
problems.
The, mboxc, widget supplements the mbox widget. The mbox widget
returns the subject of the last e-mail in a mbox, while the mboxc
widget returns the count of total, old and new messages. Dealing with
potentially *HUGE* files is not easy, I tried to find some middle
ground for now, comments in the file discuss it in detail. Having the
LuaFileSystem lib would be nice, so we could do caching and avoid 90%
of the reads, but I didn't rely on external libraries to this point so
I'm not going to start now.
The widget reads /proc/acpi/battery/*/{info,state} and doesn't require
an external utility like 'acpi' or 'acpitool'. It returns state,
charge and remaining time information, just like the old bat (now
batat) widget. Using /sys/class/power_supply we would need to open
much more file descriptors so we use /proc for now.
It's time for a standalone battery widget that reads
/proc/acpi/battery/*/{info,state} alone. However the old battery
widget that uses 'acpitool' will not be deleted, let it serve as an
alternative widget as a convenience. Some might also prefer it over
reading multiple files in /proc
The widget uses 'wget' to grab the information. The Lua socket library
would be nicer, of course, but let's not introduce external libraries
at this point. Wget will write to stdout with a timeout of 5s. This
has the potential to block everything else in case of problems... But
let's not introduce temporary files at this point. Besides having to
handle files, operations while running on battery power are to be
avoided.