1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-24 11:55:43 +00:00

added color[0-9] variable patch (thanks jieryn)

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@858 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Philip Kovacs 2007-04-25 17:22:06 +00:00
parent 7515d8319a
commit 60b842df90
6 changed files with 606 additions and 83 deletions

View File

@ -1,6 +1,9 @@
# $Id$
2007-04-5
2007-04-25
* Added color[0-9] variable patch (thanks jieryn)
2007-04-05
* Added if_empty patch (thanks Erik)
* Added if_existing patch for string matching (thanks cromka)
* Added hwmon support (thanks flitsch)

182
README
View File

@ -160,6 +160,36 @@ CONFIGURATION SETTINGS
Border width in pixels
color0 A color variable for use inside TEXT segments
color1 A color variable for use inside TEXT segments
color2 A color variable for use inside TEXT segments
color3 A color variable for use inside TEXT segments
color4 A color variable for use inside TEXT segments
color5 A color variable for use inside TEXT segments
color6 A color variable for use inside TEXT segments
color7 A color variable for use inside TEXT segments
color8 A color variable for use inside TEXT segments
color9 A color variable for use inside TEXT segments
cpu_avg_samples
The number of samples to average for CPU monitoring
@ -176,20 +206,6 @@ CONFIGURATION SETTINGS
Default shading color and border's shading color
dexter_client
Act as client and connect to libdexter server for remote moni-
toring?
dexter_config
Full path to libdexter configuration file (default search order:
$HOME/.dexterrc; /etc/libdexter/dexter.conf)
dexter_server
Act as server for libdexter services?
double_buffer
Use the Xdbe extension? (eliminates flicker) It is highly recom-
mended to use own window with this one so double buffer won't be
@ -491,6 +507,16 @@ VARIABLES
is BAT0).
battery_bar (height),(width) (num)
Battery percentage remaining of ACPI battery in a bar. ACPI bat-
tery number can be given as argument (default is BAT0).
battery_percent (num)
Battery percentage remaining for ACPI battery. ACPI battery num-
ber can be given as argument (default is BAT0).
battery_time (num)
Battery charge/discharge time remaining of ACPI battery. ACPI
battery number can be given as argument (default is BAT0).
@ -531,6 +557,36 @@ VARIABLES
Change drawing color to color
color0 Change drawing color to color0 configuration option
color1 Change drawing color to color1 configuration option
color2 Change drawing color to color2 configuration option
color3 Change drawing color to color3 configuration option
color4 Change drawing color to color4 configuration option
color5 Change drawing color to color5 configuration option
color6 Change drawing color to color6 configuration option
color7 Change drawing color to color7 configuration option
color8 Change drawing color to color8 configuration option
color9 Change drawing color to color9 configuration option
cpu (cpuN)
CPU usage in percents. For SMP machines, the CPU number can be
provided as an argument. ${cpu cpu0} is the total usage, and
@ -704,6 +760,16 @@ VARIABLES
Horizontal line, height is the height in pixels
hwmon N sensor number input
This has the ability to display the contents of hwmon files lo-
cated under "/sys/class/hwmon/hwmonX/device/N". For example, use
${hwmon 0 temp 1 input} to read the temperature of the CPU (in
oC) from "/sys/class/hwmon/hwmon0/device/temp1_input". If the
sensor name equals "temp", then the value read will be divided
by 1000, otherwise the number will be used unchanged. The factor
1000 is just for the Abit uGuru sensor.
iconv_start codeset_from codeset_to
Convert text from one codeset to another using GNU iconv. Needs
to be stopped with iconv_stop.
@ -806,18 +872,25 @@ VARIABLES
LCD (0-7).
if_empty (var)
if conky variable VAR is empty, display everything between
$if_empty and the matching $endif
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
if_existing (file)
if_existing file (string)
if FILE exists, display everything between if_existing and the
matching $endif
matching $endif. The optional second paramater checks for FILE
containing the specified string and prints everything between
$if_existing and the matching $endif.
if_mounted (mountpoint)
if MOUNTPOINT is mounted, display everything between if_mounted
if MOUNTPOINT is mounted, display everything between $if_mounted
and the matching $endif
@ -1175,6 +1248,79 @@ VARIABLES
ted, the parameter defaults to 1.
xmms2_artist
Artist in current XMMS2 song
xmms2_album
Album in current XMMS2 song
xmms2_title
Title in current XMMS2 song
xmms2_genre
Genre in current XMMS2 song
xmms2_comment
Comment in current XMMS2 song
xmms2_decoder
Decoder plugin used
xmms2_transport
Transport plugin used
xmms2_url
Full path to current song
xmms2_tracknr
Track number in current XMMS2 song
xmms2_bitrate
Bitrate of current song
xmms2_id
XMMS2 id of current song
xmms2_duration
Duration of current song
xmms2_elapsed
Song's elapsed time
xmms2_size
Size of current song
xmms2_percent
Percent of song's progress
xmms2_status
XMMS2 status (Playing, Paused, Stopped, or Disconnected)
xmms2_bar (height),(width)
Bar of XMMS2's progress
xmms2_smart
Prints the song name in either the form "artist - title" or file
name, depending on whats available
EXAMPLES
conky -t '${time %D %H:%m}' -o -u 30
Start Conky in its own window with date and clock as text and 30

View File

@ -27,6 +27,76 @@
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color0</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color1</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color2</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color3</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color4</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color5</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color6</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color7</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color8</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>color9</option></command></term>
<listitem>
A color variable for use inside TEXT segments
<para></para></listitem>
</varlistentry>
<varlistentry>
<term><command><option>cpu_avg_samples</option></command></term>
<listitem>

View File

@ -151,6 +151,46 @@ Border margin in pixels
\fB\*(T<\fBborder_width\fR\*(T>\fR
Border width in pixels
.TP
\fB\*(T<\fBcolor0\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor1\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor2\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor3\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor4\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor5\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor6\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor7\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor8\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcolor9\fR\*(T>\fR
A color variable for use inside TEXT segments
.TP
\fB\*(T<\fBcpu_avg_samples\fR\*(T>\fR
The number of samples to average for CPU monitoring
@ -167,18 +207,6 @@ Default outline color
\fB\*(T<\fBdefault_shade_color\fR\*(T>\fR
Default shading color and border's shading color
.TP
\fB\*(T<\fBdexter_client\fR\*(T>\fR
Act as client and connect to libdexter server for remote monitoring?
.TP
\fB\*(T<\fBdexter_config\fR\*(T>\fR
Full path to libdexter configuration file (default search order: $HOME/.dexterrc; /etc/libdexter/dexter.conf)
.TP
\fB\*(T<\fBdexter_server\fR\*(T>\fR
Act as server for libdexter services?
.TP
\fB\*(T<\fBdouble_buffer\fR\*(T>\fR
Use the Xdbe extension? (eliminates flicker) It is highly recommended to use own window with this one so double buffer won't be so big.
@ -463,6 +491,14 @@ Title of current tune with optional maximum length specifier
\fB\*(T<\fBbattery\fR\*(T>\fR \*(T<\fB(num)\fR\*(T>
Battery status and remaining percentage capacity of ACPI or APM battery. ACPI battery number can be given as argument (default is BAT0).
.TP
\fB\*(T<\fBbattery_bar\fR\*(T>\fR \*(T<\fB(height),(width) (num)\fR\*(T>
Battery percentage remaining of ACPI battery in a bar. ACPI battery number can be given as argument (default is BAT0).
.TP
\fB\*(T<\fBbattery_percent\fR\*(T>\fR \*(T<\fB(num)\fR\*(T>
Battery percentage remaining for ACPI battery. ACPI battery number can be given as argument (default is BAT0).
.TP
\fB\*(T<\fBbattery_time\fR\*(T>\fR \*(T<\fB(num)\fR\*(T>
Battery charge/discharge time remaining of ACPI battery. ACPI battery number can be given as argument (default is BAT0).
@ -503,6 +539,46 @@ Amount of memory cached
\fB\*(T<\fBcolor\fR\*(T>\fR \*(T<\fB(color)\fR\*(T>
Change drawing color to color
.TP
\fB\*(T<\fBcolor0\fR\*(T>\fR
Change drawing color to color0 configuration option
.TP
\fB\*(T<\fBcolor1\fR\*(T>\fR
Change drawing color to color1 configuration option
.TP
\fB\*(T<\fBcolor2\fR\*(T>\fR
Change drawing color to color2 configuration option
.TP
\fB\*(T<\fBcolor3\fR\*(T>\fR
Change drawing color to color3 configuration option
.TP
\fB\*(T<\fBcolor4\fR\*(T>\fR
Change drawing color to color4 configuration option
.TP
\fB\*(T<\fBcolor5\fR\*(T>\fR
Change drawing color to color5 configuration option
.TP
\fB\*(T<\fBcolor6\fR\*(T>\fR
Change drawing color to color6 configuration option
.TP
\fB\*(T<\fBcolor7\fR\*(T>\fR
Change drawing color to color7 configuration option
.TP
\fB\*(T<\fBcolor8\fR\*(T>\fR
Change drawing color to color8 configuration option
.TP
\fB\*(T<\fBcolor9\fR\*(T>\fR
Change drawing color to color9 configuration option
.TP
\fB\*(T<\fBcpu\fR\*(T>\fR \*(T<\fB(cpuN)\fR\*(T>
CPU usage in percents. For SMP machines, the CPU number can be provided as an argument. ${cpu cpu0} is the total usage, and ${cpu cpuX} (X >= 1) are individual CPUs.
@ -652,6 +728,10 @@ Displays first N lines of supplied text text file. If interval is not supplied,
\fB\*(T<\fBhr\fR\*(T>\fR \*(T<\fB(height)\fR\*(T>
Horizontal line, height is the height in pixels
.TP
\fB\*(T<\fBhwmon\fR\*(T>\fR \*(T<\fBN sensor number input\fR\*(T>
This has the ability to display the contents of hwmon files located under "/sys/class/hwmon/hwmonX/device/N". For example, use ${hwmon 0 temp 1 input} to read the temperature of the CPU (in \(deC) from "/sys/class/hwmon/hwmon0/device/temp1_input". If the sensor name equals "temp", then the value read will be divided by 1000, otherwise the number will be used unchanged. The factor 1000 is just for the Abit uGuru sensor.
.TP
\fB\*(T<\fBiconv_start\fR\*(T>\fR \*(T<\fBcodeset_from codeset_to\fR\*(T>
Convert text from one codeset to another using GNU iconv. Needs to be stopped with iconv_stop.
@ -729,16 +809,20 @@ If running the IBM ACPI, displays the brigtness of the
laptops's LCD (0-7).
.TP
\fB\*(T<\fBif_running\fR\*(T>\fR \*(T<\fB(process)\fR\*(T>
if PROCESS is running, display everything if_running and the matching $endif
\fB\*(T<\fBif_empty\fR\*(T>\fR \*(T<\fB(var)\fR\*(T>
if conky variable VAR is empty, display everything between $if_empty and the matching $endif
.TP
\fB\*(T<\fBif_existing\fR\*(T>\fR \*(T<\fB(file)\fR\*(T>
if FILE exists, display everything between if_existing and the matching $endif
\fB\*(T<\fBif_running\fR\*(T>\fR \*(T<\fB(process)\fR\*(T>
if PROCESS is running, display everything $if_running and the matching $endif
.TP
\fB\*(T<\fBif_existing\fR\*(T>\fR \*(T<\fBfile (string)\fR\*(T>
if FILE exists, display everything between if_existing and the matching $endif. The optional second paramater checks for FILE containing the specified string and prints everything between $if_existing and the matching $endif.
.TP
\fB\*(T<\fBif_mounted\fR\*(T>\fR \*(T<\fB(mountpoint)\fR\*(T>
if MOUNTPOINT is mounted, display everything between if_mounted and the matching $endif
if MOUNTPOINT is mounted, display everything between $if_mounted and the matching $endif
.TP
\fB\*(T<\fBimap_messages\fR\*(T>\fR \*(T<\fB(args)\fR\*(T>
@ -1131,7 +1215,7 @@ XMMS2 status (Playing, Paused, Stopped, or Disconnected)
.TP
\fB\*(T<\fBxmms2_bar\fR\*(T>\fR \*(T<\fB(height),(width)\fR\*(T>
XMMS2 progress bar
Bar of XMMS2's progress
.TP
\fB\*(T<\fBxmms2_smart\fR\*(T>\fR

View File

@ -352,6 +352,96 @@
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color0</option></command>
</term>
<listitem>
Change drawing color to color0 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color1</option></command>
</term>
<listitem>
Change drawing color to color1 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color2</option></command>
</term>
<listitem>
Change drawing color to color2 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color3</option></command>
</term>
<listitem>
Change drawing color to color3 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color4</option></command>
</term>
<listitem>
Change drawing color to color4 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color5</option></command>
</term>
<listitem>
Change drawing color to color5 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color6</option></command>
</term>
<listitem>
Change drawing color to color6 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color7</option></command>
</term>
<listitem>
Change drawing color to color7 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color8</option></command>
</term>
<listitem>
Change drawing color to color8 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>color9</option></command>
</term>
<listitem>
Change drawing color to color9 configuration option
<para></para></listitem>
</varlistentry>
<varlistentry>
<term>
<command><option>cpu</option></command>

View File

@ -296,6 +296,7 @@ static int draw_shades, draw_outline;
static int border_margin, border_width;
static long default_fg_color, default_bg_color, default_out_color;
static long color0, color1, color2, color3, color4, color5, color6, color7, color8, color9;
/* create own window or draw stuff to root? */
static int set_transparent = 0;
@ -953,6 +954,16 @@ enum text_object_type {
OBJ_buffers,
OBJ_cached,
OBJ_color,
OBJ_color0,
OBJ_color1,
OBJ_color2,
OBJ_color3,
OBJ_color4,
OBJ_color5,
OBJ_color6,
OBJ_color7,
OBJ_color8,
OBJ_color9,
OBJ_font,
OBJ_cpu,
OBJ_cpubar,
@ -2309,8 +2320,27 @@ static struct text_object *construct_text_object(const char *s, const char *arg,
#ifdef X11
obj->data.l = arg ? get_x11_color(arg) : default_fg_color;
#endif /* X11 */
END
OBJ(font, 0)
END OBJ(color0, 0)
obj->data.l = color0;
END OBJ(color1, 0)
obj->data.l = color1;
END OBJ(color2, 0)
obj->data.l = color2;
END OBJ(color3, 0)
obj->data.l = color3;
END OBJ(color4, 0)
obj->data.l = color4;
END OBJ(color5, 0)
obj->data.l = color5;
END OBJ(color6, 0)
obj->data.l = color6;
END OBJ(color7, 0)
obj->data.l = color7;
END OBJ(color8, 0)
obj->data.l = color8;
END OBJ(color9, 0)
obj->data.l = color9;
END OBJ(font, 0)
obj->data.s = scan_font(arg);
END
OBJ(downspeed, INFO_NET)
@ -3503,6 +3533,36 @@ static void generate_text_internal(char *p, int p_max_size, struct text_object *
OBJ(color) {
new_fg(p, obj->data.l);
}
OBJ(color0) {
new_fg(p, color0);
}
OBJ(color1) {
new_fg(p, color1);
}
OBJ(color2) {
new_fg(p, color2);
}
OBJ(color3) {
new_fg(p, color3);
}
OBJ(color4) {
new_fg(p, color4);
}
OBJ(color5) {
new_fg(p, color5);
}
OBJ(color6) {
new_fg(p, color6);
}
OBJ(color7) {
new_fg(p, color7);
}
OBJ(color8) {
new_fg(p, color8);
}
OBJ(color9) {
new_fg(p, color9);
}
#if defined(__linux__)
OBJ(i8k_version) {
snprintf(p, p_max_size, "%s", i8k.version);
@ -6457,6 +6517,16 @@ static void set_default_configurations(void)
default_fg_color = WhitePixel(display, screen);
default_bg_color = BlackPixel(display, screen);
default_out_color = BlackPixel(display, screen);
color0 = default_fg_color;
color1 = default_fg_color;
color2 = default_fg_color;
color3 = default_fg_color;
color4 = default_fg_color;
color5 = default_fg_color;
color6 = default_fg_color;
color7 = default_fg_color;
color8 = default_fg_color;
color9 = default_fg_color;
draw_shades = 1;
draw_borders = 0;
draw_graph_borders = 1;
@ -6593,6 +6663,66 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
else
CONF_ERR;
}
CONF("color0") {
if (value)
color0 = get_x11_color(value);
else
CONF_ERR;
}
CONF("color1") {
if (value)
color1 = get_x11_color(value);
else
CONF_ERR;
}
CONF("color2") {
if (value)
color2 = get_x11_color(value);
else
CONF_ERR;
}
CONF("color3") {
if (value)
color3 = get_x11_color(value);
else
CONF_ERR;
}
CONF("color4") {
if (value)
color4 = get_x11_color(value);
else
CONF_ERR;
}
CONF("color5") {
if (value)
color5 = get_x11_color(value);
else
CONF_ERR;
}
CONF("color6") {
if (value)
color6 = get_x11_color(value);
else
CONF_ERR;
}
CONF("color7") {
if (value)
color7 = get_x11_color(value);
else
CONF_ERR;
}
CONF("color8") {
if (value)
color8 = get_x11_color(value);
else
CONF_ERR;
}
CONF("color9") {
if (value)
color9 = get_x11_color(value);
else
CONF_ERR;
}
CONF("default_color") {
if (value)
default_fg_color = get_x11_color(value);