mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-23 19:39:06 +00:00
- added patch from peter tarjan for ibm acpi\
- updated xft docs git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@620 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
parent
da74e54d4c
commit
090f757823
3
AUTHORS
3
AUTHORS
@ -125,6 +125,9 @@ nathanj439 <nathanj439 at users dot sourceforge dot net>
|
||||
|
||||
Pascal Eberhard <pascal dor eberhard at gmail dot com>
|
||||
graph and bar fix for right alignment
|
||||
|
||||
Peter Tarjan <ptarjan at citromail dot hu>
|
||||
IBM acpi support patch
|
||||
|
||||
Petr Holub <hopet@users.sourceforge.net>
|
||||
fix autotools on FreeBSD in autogen.sh
|
||||
|
@ -1,5 +1,8 @@
|
||||
# $Id$
|
||||
|
||||
2006-04-15
|
||||
* Added patch from Peter Tarjan to add support for IBM ACPI
|
||||
|
||||
2006-04-11
|
||||
* Removed sa_restorer crap (may fix some compile errors for some
|
||||
people)
|
||||
|
30
README
30
README
@ -346,6 +346,14 @@ CONFIGURATION SETTINGS
|
||||
Manually set the WM_CLASS name. Defaults to "conky".
|
||||
|
||||
|
||||
xftalpha
|
||||
Alpha of Xft font. Must be a value at or between 1 and 0.
|
||||
|
||||
|
||||
xftfont
|
||||
Xft font to use.
|
||||
|
||||
|
||||
xmms_player
|
||||
Use specified player/plugin for the xmms status variables. Valid
|
||||
items are: none, xmms, bmp, audacious and infopipe. (default is
|
||||
@ -1020,6 +1028,26 @@ VARIABLES
|
||||
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
|
||||
conky -t '${time %D %H:%m}' -o -u 30
|
||||
Start Conky in its own window with date and clock as text and 30
|
||||
@ -1054,4 +1082,4 @@ AUTHORS
|
||||
|
||||
|
||||
|
||||
2006-03-12 conky(1)
|
||||
2006-04-15 conky(1)
|
||||
|
@ -335,6 +335,20 @@
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>xftalpha</option></command></term>
|
||||
<listitem>
|
||||
Alpha of Xft font. Must be a value at or between 1 and 0.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>xftfont</option></command></term>
|
||||
<listitem>
|
||||
Xft font to use.
|
||||
<para></para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><command><option>xmms_player</option></command></term>
|
||||
<listitem>
|
||||
|
30
doc/conky.1
30
doc/conky.1
@ -1,5 +1,5 @@
|
||||
.\" -*- coding: us-ascii -*-
|
||||
.TH conky 1 2006-03-12
|
||||
.TH conky 1 2006-04-15
|
||||
.SH NAME
|
||||
conky \- A system monitor for X originally based on the torsmo code, but more kickass. It just keeps on given'er. Yeah.
|
||||
.SH SYNOPSIS
|
||||
@ -316,6 +316,14 @@ Use Xft (anti-aliased font and stuff)
|
||||
\fBwm_class_name\fR
|
||||
Manually set the WM_CLASS name. Defaults to "conky".
|
||||
|
||||
.TP
|
||||
\fBxftalpha\fR
|
||||
Alpha of Xft font. Must be a value at or between 1 and 0.
|
||||
|
||||
.TP
|
||||
\fBxftfont\fR
|
||||
Xft font to use.
|
||||
|
||||
.TP
|
||||
\fBxmms_player\fR
|
||||
Use specified player/plugin for the xmms status variables. Valid items are: none, xmms, bmp, audacious and infopipe. (default is none). Note that bmpx is currently handled separately.
|
||||
@ -909,6 +917,26 @@ xmms / bmp / audacious / infopipe: player status (Playing/Paused/Stopped/Not run
|
||||
\fBxmms_title\fR
|
||||
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
|
||||
.TP
|
||||
conky \fB\-t '${time %D %H:%m}' \-o \-u 30\fR
|
||||
|
@ -16,7 +16,7 @@
|
||||
<firstname>Brenden</firstname>
|
||||
<surname>Matthews</surname>
|
||||
</author>
|
||||
<date>2006-03-12</date>
|
||||
<date>2006-04-15</date>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
|
@ -1306,5 +1306,45 @@
|
||||
<para></para></listitem>
|
||||
</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>
|
||||
|
34
src/conky.c
34
src/conky.c
@ -804,6 +804,10 @@ enum text_object_type {
|
||||
OBJ_i8k_right_fan_rpm,
|
||||
OBJ_i8k_ac_status,
|
||||
OBJ_i8k_buttons_status,
|
||||
OBJ_ibm_fan,
|
||||
OBJ_ibm_temps,
|
||||
OBJ_ibm_volume,
|
||||
OBJ_ibm_brightness,
|
||||
#endif /* __linux__ */
|
||||
OBJ_if_existing,
|
||||
OBJ_if_mounted,
|
||||
@ -955,7 +959,8 @@ struct text_object {
|
||||
char *s; /* some string */
|
||||
int i; /* some integer */
|
||||
long l; /* some other integer */
|
||||
struct net_stat *net;
|
||||
unsigned int sensor;
|
||||
struct net_stat *net;
|
||||
struct fs_stat *fs;
|
||||
unsigned char loadavg[3];
|
||||
unsigned int cpu_index;
|
||||
@ -1370,6 +1375,19 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
|
||||
END OBJ(i8k_right_fan_rpm, INFO_I8K)
|
||||
END OBJ(i8k_ac_status, INFO_I8K)
|
||||
END OBJ(i8k_buttons_status, INFO_I8K)
|
||||
END OBJ(ibm_fan, 0)
|
||||
END OBJ(ibm_temps, 0)
|
||||
if (!isdigit(arg[0])
|
||||
|| strlen(arg) >=2
|
||||
|| atoi(&arg[0]) >=8)
|
||||
{
|
||||
obj->data.sensor=0;
|
||||
ERR("Invalid temperature sensor! Sensor number must be 0 to 7. Using 0 (CPU temp sensor).");
|
||||
}
|
||||
obj->data.sensor = atoi(&arg[0]);
|
||||
END OBJ(ibm_volume, 0)
|
||||
END OBJ(ibm_brightness, 0)
|
||||
|
||||
#endif /* __linux__ */
|
||||
END OBJ(buffers, INFO_BUFFERS)
|
||||
END OBJ(cached, INFO_BUFFERS)
|
||||
@ -2481,6 +2499,20 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
|
||||
snprintf(p, p_max_size, "%s", i8k.buttons_status);
|
||||
|
||||
}
|
||||
OBJ(ibm_fan) {
|
||||
get_ibm_acpi_fan(p, p_max_size);
|
||||
}
|
||||
OBJ(ibm_temps) {
|
||||
get_ibm_acpi_temps();
|
||||
snprintf(p, p_max_size, "%d",
|
||||
ibm_acpi.temps[obj->data.sensor]);
|
||||
}
|
||||
OBJ(ibm_volume) {
|
||||
get_ibm_acpi_volume(p, p_max_size);
|
||||
}
|
||||
OBJ(ibm_brightness) {
|
||||
get_ibm_acpi_brightness(p, p_max_size);
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
||||
#ifdef X11
|
||||
|
11
src/conky.h
11
src/conky.h
@ -448,6 +448,16 @@ double get_acpi_temperature(int fd);
|
||||
void get_acpi_ac_adapter( char *, size_t ); /* pk */
|
||||
void get_acpi_fan( char *, size_t ); /* pk */
|
||||
void get_battery_stuff(char *buf, unsigned int n, const char *bat);
|
||||
void get_ibm_acpi_fan(char *buf, size_t client_buffer_size);
|
||||
void get_ibm_acpi_temps(void);
|
||||
void get_ibm_acpi_volume(char *buf, size_t client_buffer_size);
|
||||
void get_ibm_acpi_brightness(char *buf, size_t client_buffer_size);
|
||||
|
||||
struct ibm_acpi_struct {
|
||||
unsigned int temps[8];
|
||||
};
|
||||
|
||||
struct ibm_acpi_struct ibm_acpi;
|
||||
|
||||
struct process {
|
||||
struct process *next;
|
||||
@ -560,7 +570,6 @@ int get_mldonkey_status(mldonkey_config * config, mldonkey_info * info);
|
||||
/* nothing to see here */
|
||||
|
||||
/* in cairo.c */
|
||||
|
||||
extern int do_it(void);
|
||||
|
||||
#endif
|
||||
|
224
src/linux.c
224
src/linux.c
@ -1317,3 +1317,227 @@ void update_diskio()
|
||||
diskio_value = tot;
|
||||
}
|
||||
|
||||
/* Here come the IBM ACPI-specific things. For reference, see
|
||||
http://ibm-acpi.sourceforge.net/README
|
||||
If IBM ACPI is installed, /proc/acpi/ibm contains the following files:
|
||||
bay
|
||||
beep
|
||||
bluetooth
|
||||
brightness
|
||||
cmos
|
||||
dock
|
||||
driver
|
||||
ecdump
|
||||
fan
|
||||
hotkey
|
||||
led
|
||||
light
|
||||
thermal
|
||||
video
|
||||
volume
|
||||
The content of these files is described in detail in the aforementioned
|
||||
README - some of them also in the following functions accessing them.
|
||||
Peter Tarjan (ptarjan@citromail.hu)
|
||||
*/
|
||||
|
||||
#define IBM_ACPI_DIR "/proc/acpi/ibm"
|
||||
|
||||
void get_ibm_acpi_fan( char * p_client_buffer, size_t client_buffer_size )
|
||||
{
|
||||
/* get fan speed on IBM/Lenovo laptops running the ibm acpi.
|
||||
/proc/acpi/ibm/fan looks like this (3 lines):
|
||||
status: disabled
|
||||
speed: 2944
|
||||
commands: enable, disable
|
||||
Peter Tarjan (ptarjan@citromail.hu)
|
||||
*/
|
||||
|
||||
if ( !p_client_buffer || client_buffer_size <= 0 )
|
||||
return;
|
||||
|
||||
FILE *fp;
|
||||
unsigned int speed=0;
|
||||
char fan[128];
|
||||
snprintf(fan, 127, "%s/fan",IBM_ACPI_DIR);
|
||||
|
||||
fp = fopen(fan, "r");
|
||||
if (fp != NULL)
|
||||
{
|
||||
while (!feof(fp))
|
||||
{
|
||||
char line[256];
|
||||
if (fgets(line, 255, fp) == NULL) break;
|
||||
if (sscanf(line, "speed: %d", &speed)) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CRIT_ERR("can't open '%s': %s\nYou are not using the IBM ACPI. Remove ibm* from your Conky config file.", fan, strerror(errno));
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
snprintf( p_client_buffer, client_buffer_size, "%d", speed );
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
static double last_ibm_acpi_temp_time;
|
||||
void get_ibm_acpi_temps()
|
||||
{
|
||||
/* get the measured temperatures from the temperature sensors
|
||||
on IBM/Lenovo laptops running the ibm acpi.
|
||||
There are 8 values in /proc/acpi/ibm/thermal, and according to
|
||||
http://ibm-acpi.sourceforge.net/README
|
||||
these mean the following (at least on an IBM R51...)
|
||||
0: CPU (also on the T series laptops)
|
||||
1: Mini PCI Module (?)
|
||||
2: HDD (?)
|
||||
3: GPU (also on the T series laptops)
|
||||
4: Battery (?)
|
||||
5: N/A
|
||||
6: Battery (?)
|
||||
7: N/A
|
||||
I'm not too sure about those with the question mark, but the values I'm
|
||||
reading from *my* thermal file (on a T42p) look realistic for the
|
||||
hdd and the battery.
|
||||
#5 and #7 are always -128.
|
||||
/proc/acpi/ibm/thermal looks like this (1 line):
|
||||
temperatures: 41 43 31 46 33 -128 29 -128
|
||||
Peter Tarjan (ptarjan@citromail.hu)
|
||||
*/
|
||||
|
||||
/* don't update too often */
|
||||
if (current_update_time - last_ibm_acpi_temp_time < 10.00)
|
||||
{
|
||||
return;
|
||||
}
|
||||
last_ibm_acpi_temp_time = current_update_time;
|
||||
|
||||
/* if ( !p_client_buffer || client_buffer_size <= 0 )
|
||||
return; */
|
||||
|
||||
FILE *fp;
|
||||
|
||||
char thermal[128];
|
||||
snprintf(thermal, 127, "%s/thermal",IBM_ACPI_DIR);
|
||||
fp = fopen(thermal, "r");
|
||||
|
||||
if (fp != NULL)
|
||||
{
|
||||
while (!feof(fp))
|
||||
{
|
||||
char line[256];
|
||||
if (fgets(line, 255, fp) == NULL) break;
|
||||
if (sscanf(line, "temperatures: %d %d %d %d %d %d %d %d",
|
||||
&ibm_acpi.temps[0], &ibm_acpi.temps[1],
|
||||
&ibm_acpi.temps[2], &ibm_acpi.temps[3],
|
||||
&ibm_acpi.temps[4], &ibm_acpi.temps[5],
|
||||
&ibm_acpi.temps[6], &ibm_acpi.temps[7])) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CRIT_ERR("can't open '%s': %s\nYou are not using the IBM ACPI. Remove ibm* from your Conky config file.", thermal, strerror(errno));
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void get_ibm_acpi_volume( char * p_client_buffer, size_t client_buffer_size )
|
||||
{
|
||||
|
||||
/* get volume (0-14) on IBM/Lenovo laptops running the ibm acpi.
|
||||
"Volume" here is none of the mixer volumes, but a "master of masters"
|
||||
volume adjusted by the IBM volume keys.
|
||||
/proc/acpi/ibm/fan looks like this (4 lines):
|
||||
level: 4
|
||||
mute: off
|
||||
commands: up, down, mute
|
||||
commands: level <level> (<level> is 0-15)
|
||||
Peter Tarjan (ptarjan@citromail.hu)
|
||||
*/
|
||||
|
||||
if ( !p_client_buffer || client_buffer_size <= 0 )
|
||||
return;
|
||||
|
||||
FILE *fp;
|
||||
|
||||
char volume[128];
|
||||
snprintf(volume, 127, "%s/volume",IBM_ACPI_DIR);
|
||||
unsigned int vol=-1;
|
||||
char mute[3]="";
|
||||
|
||||
fp = fopen(volume, "r");
|
||||
if (fp != NULL)
|
||||
{
|
||||
while (!feof(fp))
|
||||
{
|
||||
char line[256];
|
||||
if (fgets(line, 255, fp) == NULL) break;
|
||||
if (sscanf(line, "level: %d", &vol)) continue;
|
||||
if (sscanf(line, "mute: %s", mute)) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CRIT_ERR("can't open '%s': %s\nYou are not using the IBM ACPI. Remove ibm* from your Conky config file.", volume, strerror(errno));
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
if (strcmp(mute, "on")==0)
|
||||
{
|
||||
snprintf( p_client_buffer, client_buffer_size, "%s", "mute" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf( p_client_buffer, client_buffer_size, "%d", vol );
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*static FILE *fp=NULL;*/
|
||||
|
||||
void get_ibm_acpi_brightness(char * p_client_buffer, size_t client_buffer_size)
|
||||
{
|
||||
/* get LCD brightness on IBM/Lenovo laptops running the ibm acpi.
|
||||
/proc/acpi/ibm/brightness looks like this (3 lines):
|
||||
level: 7
|
||||
commands: up, down
|
||||
commands: level <level> (<level> is 0-7)
|
||||
Peter Tarjan (ptarjan@citromail.hu)
|
||||
*/
|
||||
|
||||
if ( !p_client_buffer || client_buffer_size <= 0 )
|
||||
return;
|
||||
|
||||
FILE *fp;
|
||||
unsigned int brightness=0;
|
||||
char filename[128];
|
||||
snprintf(filename, 127, "%s/brightness",IBM_ACPI_DIR);
|
||||
|
||||
fp = fopen(filename, "r");
|
||||
if (fp != NULL)
|
||||
{
|
||||
while (!feof(fp))
|
||||
{
|
||||
char line[256];
|
||||
if (fgets(line, 255, fp) == NULL) break;
|
||||
if (sscanf(line, "level: %d", &brightness)) break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CRIT_ERR("can't open '%s': %s\nYou are not using the IBM ACPI. Remove ibm* from your Conky config file.", filename, strerror(errno));
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
|
||||
snprintf( p_client_buffer, client_buffer_size, "%d", brightness );
|
||||
return;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user