Modern batteries should expose information about their design capacity
which we can compare to current capacity and deduce how much 'wear'
the battery got and expose that as a negative value percentage.
Feature sent in August took a while to convince the maintainer many
modern batteries provide this information.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Previously, a simple hyphen (“-”) was used to show that the battery is
discharging. The minus sign is a distinct char, and also distinct from
the en-dash (“–”) and the em-dash (“—”).
With this commit, I put in a unicode “MINUS SIGN” (0x2212) which I
created with a Digraph in Vim `^k-2`.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
This reverts commit a6a73f47, because the issue was solved in mpd
release 0.18.2. I imported the workaround for historical reasons and
in case someone gets stuck with version 0.18 on his preferred OS
distribution.
Checkupdates is a good tool avoiding any need for period pacman -Sy
jobs from root crontab, however it works by maintaining its own
database in /tmp by default (and _that_ is a tmpfs by default) so on
every initialization it would stall awesome until it makes the first
sync. Better approach would be to keep its db inside $HOME for
persistence, and then to initiate the first (and longest) sync
manually before converting your package widgets to "Arch C".
All this is the reason I can't recommend it as the default right
now...
Years ago iwconfig started its life in /sbin. Then some distributions
moved it to /usr/bin. Then in 2012 some projects started pushing for
deprecation of /usr/sbin and merging everything into /usr/bin.
We now search paths including /usr/bin for the iwconfig binary. This
is because sbin paths are not usually in non privileged user PATH, so
we help io.popen locate the binary on the file-system.
We do this search in the following way:
- default to basename only, 'iwconfig' for the iwconfig variable
- search paths one by one once and redeclare variable iwconfig with
full path if binary is found in any
- avoid searching paths on next execution if iwconfig variable
already contains a path
Test case:
lua> foo = require("vicious.widgets.os")
lua> print(foo()[1])
/usr/share/lua/5.1/vicious/widgets/os.lua:66: attempt to call
field 'getenv' (a nil value)
In Lua 5.2 io.lines() has to be used to iterate until EOF, otherwise
the fd will not be closed and eventually tons of naughty messages
will start to pop up saying that no more fd can be opened.
Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Now that we are so nice to provide default frequency values check if
frequency exists before calculating voltage, not to screw up *those*
default values.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
In some cases not all cpu informations will be provided.
(ex. in virtual machines)
Therefore default to "N/A".
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Since Linux 3.0 most if not all people have temp1_input file missing,
so default to temp2_input. But also allow an optional third argument
to change to yet another file to avoid this kind of problem in the
future.
If the battery state change from charging to full,
power_now is reseted to zero for a little time.
This cause division by zero, which was visible as a very big negative
number because of the behaviour of string.format.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
In cpufreq widget, governor char is the same for ondemand and
conservative which makes it impossible to overload symbols to
different values for these two governors in a format function.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
There's no more need to edit init files and manually disable widgets.
Signed-off-by: Joerg T. (Mic92) <jthalheim@gmail.com>
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
Old dio.lua was moved to contrib. New one is used like CPU widget is,
request the device or parition in the format argument, {sda read_mb}
as an example. New widget doesn't provide scheduler information, but I
don't know anyone who used that. If you think this is wrong let me
know.
Current regular expression only matches two words ESSIDs, the other day
I was at a friend's home with SSID "The Dark Tower". I was getting N/A.
Signed-off-by: Amir Mohammad Saied <amirsaied@gmail.com>
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>
The os.time() call should not be passed as an argument it self,
because of a chance it will be stored internally and so we would
always get the same time. Instead we can pass time offsets in seconds,
i.e. to go 6 hours forward we can use the widget argument 21600, to go
6 hours back we use -21600 instead.
This commit adds support for mandriva tools in the pkg widget through
the use of urpmq --auto-select. Note: this command only checks for
hdlists files available on the computer. To get "live" statistics one
should run urpmi.update which has to be run with higher privileges.
Signed-off-by: Adrian C. (anrxc) <anrxc@sysphere.org>