mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-23 19:39:06 +00:00
fixed order of variables and stuff (credit peter tarjan), small battery fix (credit Nexox sf.net patch 1500014)
git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@671 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
7698ec7c7f
commit
2c990192cc
@ -1,5 +1,9 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
|
2006-06-07
|
||||||
|
* Small battery fix (thanks Nexox, sf.net patch 1500014)
|
||||||
|
* Fixed order of variables/objects in docs (thanks Peter Tarjan)
|
||||||
|
|
||||||
2006-05-27
|
2006-05-27
|
||||||
* Fixed a bug with $font
|
* Fixed a bug with $font
|
||||||
|
|
||||||
|
60
README
60
README
@ -561,16 +561,6 @@ VARIABLES
|
|||||||
omitted, the parameter defaults to 1.
|
omitted, the parameter defaults to 1.
|
||||||
|
|
||||||
|
|
||||||
voltage_mv (n)
|
|
||||||
Returns CPU #n's voltage in mV. CPUs are counted from 1. If
|
|
||||||
omitted, the parameter defaults to 1.
|
|
||||||
|
|
||||||
|
|
||||||
voltage_v (n)
|
|
||||||
Returns CPU #n's voltage in V. CPUs are counted from 1. If omit-
|
|
||||||
ted, the parameter defaults to 1.
|
|
||||||
|
|
||||||
|
|
||||||
freq_dyn
|
freq_dyn
|
||||||
Returns CPU frequency in MHz, but is calculated by counting to
|
Returns CPU frequency in MHz, but is calculated by counting to
|
||||||
clock cycles to complete an instruction. Only available for
|
clock cycles to complete an instruction. Only available for
|
||||||
@ -696,6 +686,26 @@ VARIABLES
|
|||||||
the version formatting of /proc/i8k.
|
the version formatting of /proc/i8k.
|
||||||
|
|
||||||
|
|
||||||
|
ibm_fan
|
||||||
|
If running the IBM ACPI, displays the fan speed.
|
||||||
|
|
||||||
|
|
||||||
|
ibm_temps N
|
||||||
|
If running the IBM ACPI, displays the temperatures from the IBM
|
||||||
|
temperature sensors (N=0..7) Sensor 0 is on the CPU, 3 is on the
|
||||||
|
GPU.
|
||||||
|
|
||||||
|
|
||||||
|
ibm_volume
|
||||||
|
If running the IBM ACPI, displays the "master" volume, con-
|
||||||
|
trolled by the volume keys (0-14).
|
||||||
|
|
||||||
|
|
||||||
|
ibm_brightness
|
||||||
|
If running the IBM ACPI, displays the brigtness of the laptops's
|
||||||
|
LCD (0-7).
|
||||||
|
|
||||||
|
|
||||||
if_running (process)
|
if_running (process)
|
||||||
if PROCESS is running, display everything if_running and the
|
if PROCESS is running, display everything if_running and the
|
||||||
matching $endif
|
matching $endif
|
||||||
@ -1064,6 +1074,16 @@ VARIABLES
|
|||||||
text to overlap. See also $offset.
|
text to overlap. See also $offset.
|
||||||
|
|
||||||
|
|
||||||
|
voltage_mv (n)
|
||||||
|
Returns CPU #n's voltage in mV. CPUs are counted from 1. If
|
||||||
|
omitted, the parameter defaults to 1.
|
||||||
|
|
||||||
|
|
||||||
|
voltage_v (n)
|
||||||
|
Returns CPU #n's voltage in V. CPUs are counted from 1. If omit-
|
||||||
|
ted, the parameter defaults to 1.
|
||||||
|
|
||||||
|
|
||||||
xmms_bar (height),(width)
|
xmms_bar (height),(width)
|
||||||
xmms / bmp / audacious / infopipe: progress bar
|
xmms / bmp / audacious / infopipe: progress bar
|
||||||
|
|
||||||
@ -1125,26 +1145,6 @@ VARIABLES
|
|||||||
xmms / bmp / audacious / infopipe: title of current tune
|
xmms / bmp / audacious / infopipe: title of current tune
|
||||||
|
|
||||||
|
|
||||||
ibm_fan
|
|
||||||
If running the IBM ACPI, displays the fan speed.
|
|
||||||
|
|
||||||
|
|
||||||
ibm_temps N
|
|
||||||
If running the IBM ACPI, displays the temperatures from the IBM
|
|
||||||
temperature sensors (N=0..7) Sensor 0 is on the CPU, 3 is on the
|
|
||||||
GPU.
|
|
||||||
|
|
||||||
|
|
||||||
ibm_volume
|
|
||||||
If running the IBM ACPI, displays the "master" volume, con-
|
|
||||||
trolled by the volume keys (0-14).
|
|
||||||
|
|
||||||
|
|
||||||
ibm_brightness
|
|
||||||
If running the IBM ACPI, displays the brigtness of the laptops's
|
|
||||||
LCD (0-7).
|
|
||||||
|
|
||||||
|
|
||||||
EXAMPLES
|
EXAMPLES
|
||||||
conky -t '${time %D %H:%m}' -o -u 30
|
conky -t '${time %D %H:%m}' -o -u 30
|
||||||
Start Conky in its own window with date and clock as text and 30
|
Start Conky in its own window with date and clock as text and 30
|
||||||
|
@ -6,9 +6,6 @@ dnl
|
|||||||
dnl C Compiler
|
dnl C Compiler
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
if test x$CFLAGS = x; then
|
|
||||||
AC_SUBST(CFLAGS, [ ])
|
|
||||||
fi
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
PKG_PROG_PKG_CONFIG([0.17.2])
|
PKG_PROG_PKG_CONFIG([0.17.2])
|
||||||
|
66
doc/conky.1
66
doc/conky.1
@ -504,7 +504,7 @@ Specify a different font. This new font will apply to the current line and every
|
|||||||
\fBfreq\fR \fB(n)\fR
|
\fBfreq\fR \fB(n)\fR
|
||||||
Returns CPU #n's frequency in MHz. CPUs are
|
Returns CPU #n's frequency in MHz. CPUs are
|
||||||
counted from 1. If omitted, the parameter
|
counted from 1. If omitted, the parameter
|
||||||
defaults to 1.
|
defaults to 1.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBfreq_g\fR \fB(n)\fR
|
\fBfreq_g\fR \fB(n)\fR
|
||||||
@ -512,18 +512,6 @@ Returns CPU #n's frequency in GHz. CPUs are
|
|||||||
counted from 1. If omitted, the parameter
|
counted from 1. If omitted, the parameter
|
||||||
defaults to 1.
|
defaults to 1.
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBvoltage_mv\fR \fB(n)\fR
|
|
||||||
Returns CPU #n's voltage in mV. CPUs are
|
|
||||||
counted from 1. If omitted, the parameter
|
|
||||||
defaults to 1.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBvoltage_v\fR \fB(n)\fR
|
|
||||||
Returns CPU #n's voltage in V. CPUs are
|
|
||||||
counted from 1. If omitted, the parameter
|
|
||||||
defaults to 1.
|
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBfreq_dyn\fR
|
\fBfreq_dyn\fR
|
||||||
Returns CPU frequency in MHz, but is calculated by counting to clock cycles to complete an instruction. Only available for x86/amd64.
|
Returns CPU frequency in MHz, but is calculated by counting to clock cycles to complete an instruction. Only available for x86/amd64.
|
||||||
@ -616,6 +604,26 @@ If running the i8k kernel driver for Inspiron laptops, displays your laptop seri
|
|||||||
\fBi8k_version\fR \fB\fR
|
\fBi8k_version\fR \fB\fR
|
||||||
If running the i8k kernel driver for Inspiron laptops, displays the version formatting of /proc/i8k.
|
If running the i8k kernel driver for Inspiron laptops, displays the version formatting of /proc/i8k.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBibm_fan\fR
|
||||||
|
If running the IBM ACPI, displays the fan speed.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBibm_temps\fR \fBN\fR
|
||||||
|
If running the IBM ACPI, displays the temperatures
|
||||||
|
from the IBM temperature sensors (N=0..7) Sensor 0 is
|
||||||
|
on the CPU, 3 is on the GPU.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBibm_volume\fR
|
||||||
|
If running the IBM ACPI, displays the "master" volume,
|
||||||
|
controlled by the volume keys (0-14).
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBibm_brightness\fR
|
||||||
|
If running the IBM ACPI, displays the brigtness of the
|
||||||
|
laptops's LCD (0-7).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBif_running\fR \fB(process)\fR
|
\fBif_running\fR \fB(process)\fR
|
||||||
if PROCESS is running, display everything if_running and the matching $endif
|
if PROCESS is running, display everything if_running and the matching $endif
|
||||||
@ -937,6 +945,18 @@ Seti@home total user credit
|
|||||||
\fBvoffset\fR \fB(pixels)\fR
|
\fBvoffset\fR \fB(pixels)\fR
|
||||||
Change vertical offset by N pixels. Negative values will cause text to overlap. See also $offset.
|
Change vertical offset by N pixels. Negative values will cause text to overlap. See also $offset.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBvoltage_mv\fR \fB(n)\fR
|
||||||
|
Returns CPU #n's voltage in mV. CPUs are
|
||||||
|
counted from 1. If omitted, the parameter
|
||||||
|
defaults to 1.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBvoltage_v\fR \fB(n)\fR
|
||||||
|
Returns CPU #n's voltage in V. CPUs are
|
||||||
|
counted from 1. If omitted, the parameter
|
||||||
|
defaults to 1.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBxmms_bar\fR \fB(height),(width)\fR
|
\fBxmms_bar\fR \fB(height),(width)\fR
|
||||||
xmms / bmp / audacious / infopipe: progress bar
|
xmms / bmp / audacious / infopipe: progress bar
|
||||||
@ -989,26 +1009,6 @@ xmms / bmp / audacious / infopipe: player status (Playing/Paused/Stopped/Not run
|
|||||||
\fBxmms_title\fR
|
\fBxmms_title\fR
|
||||||
xmms / bmp / audacious / infopipe: title of current tune
|
xmms / bmp / audacious / infopipe: title of current tune
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBibm_fan\fR
|
|
||||||
If running the IBM ACPI, displays the fan speed.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBibm_temps\fR \fBN\fR
|
|
||||||
If running the IBM ACPI, displays the temperatures
|
|
||||||
from the IBM temperature sensors (N=0..7) Sensor 0 is
|
|
||||||
on the CPU, 3 is on the GPU.
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBibm_volume\fR
|
|
||||||
If running the IBM ACPI, displays the "master" volume,
|
|
||||||
controlled by the volume keys (0-14).
|
|
||||||
|
|
||||||
.TP
|
|
||||||
\fBibm_brightness\fR
|
|
||||||
If running the IBM ACPI, displays the brigtness of the
|
|
||||||
laptops's LCD (0-7).
|
|
||||||
|
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.TP
|
.TP
|
||||||
conky \fB\-t '${time %D %H:%m}' \-o \-u 30\fR
|
conky \fB\-t '${time %D %H:%m}' \-o \-u 30\fR
|
||||||
|
@ -361,71 +361,48 @@
|
|||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>freq</option></command>
|
||||||
|
<option>(n)</option>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
Returns CPU #n's frequency in MHz. CPUs are
|
||||||
|
counted from 1. If omitted, the parameter
|
||||||
|
defaults to 1.
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>freq_g</option></command>
|
||||||
|
<option>(n)</option>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
Returns CPU #n's frequency in GHz. CPUs are
|
||||||
|
counted from 1. If omitted, the parameter
|
||||||
|
defaults to 1.
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command><option>freq</option></command>
|
<command><option>freq_dyn</option></command>
|
||||||
<option>(n)</option>
|
</term>
|
||||||
</term>
|
<listitem>
|
||||||
<listitem>
|
|
||||||
Returns CPU #n's frequency in MHz. CPUs are
|
|
||||||
counted from 1. If omitted, the parameter
|
|
||||||
defaults to 1.
|
|
||||||
<para></para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<command><option>freq_g</option></command>
|
|
||||||
<option>(n)</option>
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
Returns CPU #n's frequency in GHz. CPUs are
|
|
||||||
counted from 1. If omitted, the parameter
|
|
||||||
defaults to 1.
|
|
||||||
<para></para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<command><option>voltage_mv</option></command>
|
|
||||||
<option>(n)</option>
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
Returns CPU #n's voltage in mV. CPUs are
|
|
||||||
counted from 1. If omitted, the parameter
|
|
||||||
defaults to 1.
|
|
||||||
<para></para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<command><option>voltage_v</option></command>
|
|
||||||
<option>(n)</option>
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
Returns CPU #n's voltage in V. CPUs are
|
|
||||||
counted from 1. If omitted, the parameter
|
|
||||||
defaults to 1.
|
|
||||||
<para></para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<command><option>freq_dyn</option></command>
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
Returns CPU frequency in MHz, but is calculated by counting to clock cycles to complete an instruction. Only available for x86/amd64.
|
Returns CPU frequency in MHz, but is calculated by counting to clock cycles to complete an instruction. Only available for x86/amd64.
|
||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
|
||||||
<term>
|
<varlistentry>
|
||||||
<command><option>freq_dyn_g</option></command>
|
<term>
|
||||||
</term>
|
<command><option>freq_dyn_g</option></command>
|
||||||
<listitem>
|
</term>
|
||||||
Returns CPU frequency in GHz, but is calculated by counting to clock cycles to complete an instruction. Only available for x86/amd64.
|
<listitem>
|
||||||
<para></para></listitem>
|
Returns CPU frequency in GHz, but is calculated by counting to clock cycles to complete an instruction. Only available for x86/amd64.
|
||||||
</varlistentry>
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command><option>fs_bar</option></command>
|
<command><option>fs_bar</option></command>
|
||||||
<option>(height),(width) fs</option>
|
<option>(height),(width) fs</option>
|
||||||
@ -635,6 +612,47 @@
|
|||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>ibm_fan</option></command>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
If running the IBM ACPI, displays the fan speed.
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>ibm_temps</option></command>
|
||||||
|
<option>N</option>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
If running the IBM ACPI, displays the temperatures
|
||||||
|
from the IBM temperature sensors (N=0..7) Sensor 0 is
|
||||||
|
on the CPU, 3 is on the GPU.
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>ibm_volume</option></command>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
If running the IBM ACPI, displays the "master" volume,
|
||||||
|
controlled by the volume keys (0-14).
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>ibm_brightness</option></command>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
If running the IBM ACPI, displays the brigtness of the
|
||||||
|
laptops's LCD (0-7).
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
@ -1301,6 +1319,7 @@
|
|||||||
Seti@home total user credit
|
Seti@home total user credit
|
||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command><option>voffset</option></command>
|
<command><option>voffset</option></command>
|
||||||
@ -1311,6 +1330,30 @@
|
|||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>voltage_mv</option></command>
|
||||||
|
<option>(n)</option>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
Returns CPU #n's voltage in mV. CPUs are
|
||||||
|
counted from 1. If omitted, the parameter
|
||||||
|
defaults to 1.
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>
|
||||||
|
<command><option>voltage_v</option></command>
|
||||||
|
<option>(n)</option>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
Returns CPU #n's voltage in V. CPUs are
|
||||||
|
counted from 1. If omitted, the parameter
|
||||||
|
defaults to 1.
|
||||||
|
<para></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command><option>xmms_bar</option></command>
|
<command><option>xmms_bar</option></command>
|
||||||
@ -1429,45 +1472,4 @@
|
|||||||
<para></para></listitem>
|
<para></para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<command><option>ibm_fan</option></command>
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
If running the IBM ACPI, displays the fan speed.
|
|
||||||
<para></para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<command><option>ibm_temps</option></command>
|
|
||||||
<option>N</option>
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
If running the IBM ACPI, displays the temperatures
|
|
||||||
from the IBM temperature sensors (N=0..7) Sensor 0 is
|
|
||||||
on the CPU, 3 is on the GPU.
|
|
||||||
<para></para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<command><option>ibm_volume</option></command>
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
If running the IBM ACPI, displays the "master" volume,
|
|
||||||
controlled by the volume keys (0-14).
|
|
||||||
<para></para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<command><option>ibm_brightness</option></command>
|
|
||||||
</term>
|
|
||||||
<listitem>
|
|
||||||
If running the IBM ACPI, displays the brigtness of the
|
|
||||||
laptops's LCD (0-7).
|
|
||||||
<para></para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
23
src/linux.c
23
src/linux.c
@ -1264,7 +1264,7 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
|
|||||||
/* charging */
|
/* charging */
|
||||||
if (strcmp(charging_state, "charging") == 0) {
|
if (strcmp(charging_state, "charging") == 0) {
|
||||||
if (acpi_last_full != 0 && present_rate > 0) {
|
if (acpi_last_full != 0 && present_rate > 0) {
|
||||||
strcpy(last_battery_str, "charging ");
|
strncpy(last_battery_str, "charging ", 64);
|
||||||
format_seconds(last_battery_str + 9,
|
format_seconds(last_battery_str + 9,
|
||||||
63 - 9,
|
63 - 9,
|
||||||
(acpi_last_full -
|
(acpi_last_full -
|
||||||
@ -1272,39 +1272,42 @@ void get_battery_stuff(char *buf, unsigned int n, const char *bat)
|
|||||||
60 / present_rate);
|
60 / present_rate);
|
||||||
} else if (acpi_last_full != 0
|
} else if (acpi_last_full != 0
|
||||||
&& present_rate <= 0) {
|
&& present_rate <= 0) {
|
||||||
sprintf(last_battery_str, "charging %d%%",
|
snprintf(last_battery_str, 64, "charging %d%%",
|
||||||
remaining_capacity * 100 /
|
remaining_capacity * 100 /
|
||||||
acpi_last_full);
|
acpi_last_full);
|
||||||
} else {
|
} else {
|
||||||
strcpy(last_battery_str, "charging");
|
strncpy(last_battery_str, "charging", 63);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* discharging */
|
/* discharging */
|
||||||
else if (strcmp(charging_state, "discharging") == 0) {
|
else if (strncmp(charging_state, "discharging", 64) == 0) {
|
||||||
if (present_rate > 0)
|
if (present_rate > 0) {
|
||||||
format_seconds(last_battery_str, 63,
|
format_seconds(last_battery_str, 63,
|
||||||
(remaining_capacity * 60 *
|
(remaining_capacity * 60 *
|
||||||
60) / present_rate);
|
60) / present_rate);
|
||||||
else
|
} else if (present_rate == 0) { /* Thanks to Nexox for this one */
|
||||||
sprintf(last_battery_str,
|
snprintf(last_battery_str, 64, "full");
|
||||||
|
} else {
|
||||||
|
snprintf(last_battery_str, 64,
|
||||||
"discharging %d%%",
|
"discharging %d%%",
|
||||||
remaining_capacity * 100 /
|
remaining_capacity * 100 /
|
||||||
acpi_last_full);
|
acpi_last_full);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* charged */
|
/* charged */
|
||||||
/* thanks to Lukas Zapletal <lzap@seznam.cz> */
|
/* thanks to Lukas Zapletal <lzap@seznam.cz> */
|
||||||
else if (strcmp(charging_state, "charged") == 0) {
|
else if (strncmp(charging_state, "charged", 64) == 0) {
|
||||||
strcpy(last_battery_str, "charged");
|
strcpy(last_battery_str, "charged");
|
||||||
}
|
}
|
||||||
/* unknown, probably full / AC */
|
/* unknown, probably full / AC */
|
||||||
else {
|
else {
|
||||||
if (acpi_last_full != 0
|
if (acpi_last_full != 0
|
||||||
&& remaining_capacity != acpi_last_full)
|
&& remaining_capacity != acpi_last_full)
|
||||||
sprintf(last_battery_str, "unknown %d%%",
|
snprintf(last_battery_str, 64, "unknown %d%%",
|
||||||
remaining_capacity * 100 /
|
remaining_capacity * 100 /
|
||||||
acpi_last_full);
|
acpi_last_full);
|
||||||
else
|
else
|
||||||
strcpy(last_battery_str, "AC");
|
strncpy(last_battery_str, "AC", 64);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* APM */
|
/* APM */
|
||||||
|
Loading…
Reference in New Issue
Block a user