1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-17 10:35:10 +00:00

laptop_mode displays the current laptop mode

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1033 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Phil 2008-03-22 20:13:51 +00:00
parent 929f1d5878
commit d2ed065fdd
5 changed files with 29 additions and 1 deletions

View File

@ -897,6 +897,10 @@ Displays the number of unseen messages in your global IMAP inbox by default. You
\fB\*(T<\fBkernel\fR\*(T>\fR
Kernel version
.TP
\fB\*(T<\fBlaptop_mode\fR\*(T>\fR
value of /proc/sys/vm/laptop_mode
.TP
\fB\*(T<\fBloadavg\fR\*(T>\fR
(1,2,3)> System load average, 1 is for past 1 minute, 2 for past 5 minutes and 3 for past 15 minutes.

View File

@ -1177,6 +1177,15 @@
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>laptop_mode</option></command>
</term>
<listitem>
value of /proc/sys/vm/laptop_mode
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>loadavg</option></command>

View File

@ -1147,6 +1147,7 @@ enum text_object_type {
OBJ_if_gw,
OBJ_gw_iface,
OBJ_gw_ip,
OBJ_laptop_mode,
OBJ_pb_battery,
OBJ_voltage_mv,
OBJ_voltage_v,
@ -2476,6 +2477,7 @@ static struct text_object *construct_text_object(const char *s,
blockstart[blockdepth] = object_count;
obj->data.ifblock.pos = object_count + 2;
blockdepth++;
END OBJ(laptop_mode, 0)
END OBJ(pb_battery, 0)
if (arg && strcmp(arg, "status") == 0) {
obj->data.i = PB_BATT_STATUS;
@ -4428,6 +4430,9 @@ static void generate_text_internal(char *p, int p_max_size,
OBJ(gw_ip) {
snprintf(p, p_max_size, "%s", cur->gw_info.ip);
}
OBJ(laptop_mode) {
snprintf(p, p_max_size, "%d", get_laptop_mode());
}
OBJ(pb_battery) {
get_powerbook_batt_info(p, p_max_size, obj->data.i);
}

View File

@ -544,7 +544,7 @@ void get_freq_dynamic(char *, size_t, char *, int);
char get_voltage(char *, size_t, char *, int, unsigned int); /* ptarjan */
void update_load_average();
int interface_up(const char *dev);
int get_laptop_mode(void);
void update_gateway_info(void);
int open_sysfs_sensor(const char *dir, const char *dev, const char *type, int n,

View File

@ -168,6 +168,16 @@ void update_meminfo()
fclose(meminfo_fp);
}
int get_laptop_mode()
{
FILE *fp;
int val = -1;
if ((fp = fopen("/proc/sys/vm/laptop_mode", "r")) != NULL)
fscanf(fp, "%d\n", &val);
return val;
}
int interface_up(const char *dev)
{
int fd;