1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-25 04:06:03 +00:00

added own_window_hints

git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@543 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Philip Kovacs 2006-03-06 23:35:41 +00:00
parent a72572328f
commit 1d6a4ddde9
7 changed files with 287 additions and 93 deletions

175
README
View File

@ -289,6 +289,11 @@ CONFIGURATION SETTINGS
valid RGB name (see /usr/lib/X11/rgb.txt) valid RGB name (see /usr/lib/X11/rgb.txt)
own_window_hints undecorated,below,above,sticky,skip_taskbar,skip_pager
If own_window is yes, you may use these window manager hints to
affect the way conky displays
out_to_console out_to_console
Print text to stdout. Print text to stdout.
@ -302,7 +307,7 @@ CONFIGURATION SETTINGS
total_run_times total_run_times
Total number of times for Conky to update before quitting. Zero Total number of times for Conky to update before quitting. Zero
makes Conky run forever makes Conky run forever
@ -330,7 +335,7 @@ CONFIGURATION SETTINGS
xmms_player xmms_player
Use specified player/plugin for the xmms status variables. Valid Use specified player/plugin for the xmms status variables. Valid
items are: none, xmms, bmp, audacious and infopipe. (default is items are: none, xmms, bmp, audacious and infopipe. (default is
none). Note that bmpx is currently handled separately. none). Note that bmpx is currently handled separately.
@ -338,7 +343,7 @@ CONFIGURATION SETTINGS
VARIABLES VARIABLES
Colors are parsed using XParsecolor(), there might be a list of them: Colors are parsed using XParsecolor(), there might be a list of them:
/usr/X11R6/lib/X11/rgb.txt. Also, http://sedition.com/perl/rgb.html /usr/X11R6/lib/X11/rgb.txt. Also, http://sedition.com/perl/rgb.html
[http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for- [http://sedition.com/perl/rgb.html]. Color can be also in #rrggbb for-
mat (hex). Note that when displaying bytes, power is 1024 and not 1000 mat (hex). Note that when displaying bytes, power is 1024 and not 1000
@ -389,12 +394,12 @@ VARIABLES
apm_battery_time apm_battery_time
Display remaining APM battery life in hh:mm:ss or "unknown" if Display remaining APM battery life in hh:mm:ss or "unknown" if
AC adapterstatus is on-line or charging (FreeBSD only) AC adapterstatus is on-line or charging (FreeBSD only)
battery (num) battery (num)
Remaining capacity in ACPI or APM battery. ACPI battery number Remaining capacity in ACPI or APM battery. ACPI battery number
can be given as argument (default is BAT0). can be given as argument (default is BAT0).
@ -434,28 +439,28 @@ VARIABLES
cpu (cpuN) cpu (cpuN)
CPU usage in percents. For SMP machines, the CPU number can be CPU usage in percents. For SMP machines, the CPU number can be
provided as an argument. cpu0 is the total usage, and >=cpu1 are provided as an argument. cpu0 is the total usage, and >=cpu1 are
individual CPUs. individual CPUs.
cpubar (cpu number) (height),(width) cpubar (cpu number) (height),(width)
Bar that shows CPU usage, height is bar's height in pixels. See Bar that shows CPU usage, height is bar's height in pixels. See
$cpu for more info on SMP. $cpu for more info on SMP.
cpugraph (cpu number) (height),(width) (gradient colour 1) (gradient cpugraph (cpu number) (height),(width) (gradient colour 1) (gradient
colour 2) colour 2)
CPU usage graph, with optional colours in hex, minus the #. See CPU usage graph, with optional colours in hex, minus the #. See
$cpu for more info on SMP. $cpu for more info on SMP.
diskio Displays current disk IO. diskio Displays current disk IO.
diskiograph (height),(width) (gradient colour 1) (gradient colour 2) diskiograph (height),(width) (gradient colour 1) (gradient colour 2)
(scale) (scale)
Disk IO graph, colours defined in hex, minus the #. If scale is Disk IO graph, colours defined in hex, minus the #. If scale is
non-zero, it becomes the scale for the graph. non-zero, it becomes the scale for the graph.
@ -469,7 +474,7 @@ VARIABLES
downspeedgraph net (height),(width) (gradient colour 1) (gradient downspeedgraph net (height),(width) (gradient colour 1) (gradient
colour 2) (scale) colour 2) (scale)
Download speed graph, colours defined in hex, minus the #. If Download speed graph, colours defined in hex, minus the #. If
scale is non-zero, it becomes the scale for the graph. scale is non-zero, it becomes the scale for the graph.
@ -478,13 +483,13 @@ VARIABLES
exec command exec command
Executes a shell command and displays the output in conky. warn- Executes a shell command and displays the output in conky. warn-
ing: this takes a lot more resources than other variables. I'd ing: this takes a lot more resources than other variables. I'd
recommend coding wanted behaviour in C and posting a patch. recommend coding wanted behaviour in C and posting a patch.
execbar command execbar command
Same as exec, except if the first value return is a value Same as exec, except if the first value return is a value
between 0-100, it will use that number for a bar. The size for between 0-100, it will use that number for a bar. The size for
the bar is currently fixed, but that may change in the future. the bar is currently fixed, but that may change in the future.
@ -493,7 +498,7 @@ VARIABLES
execi interval command execi interval command
Same as exec but with specific interval. Interval can't be less Same as exec but with specific interval. Interval can't be less
than update_interval in configuration. See also $texeci than update_interval in configuration. See also $texeci
@ -516,19 +521,19 @@ VARIABLES
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
x86/amd64. x86/amd64.
freq_dyn_g freq_dyn_g
Returns CPU frequency in GHz, but is calculated by counting to Returns CPU frequency in GHz, but is calculated by counting to
clock cycles to complete an instruction. Only available for clock cycles to complete an instruction. Only available for
x86/amd64. x86/amd64.
fs_bar (height),(width) fs fs_bar (height),(width) fs
Bar that shows how much space is used on a file system. height Bar that shows how much space is used on a file system. height
is the height in pixels. fs is any file on that file system. is the height in pixels. fs is any file on that file system.
@ -549,8 +554,8 @@ VARIABLES
head logfile lines (interval) head logfile lines (interval)
Displays first N lines of supplied text text file. If interval Displays first N lines of supplied text text file. If interval
is not supplied, Conky assumes 2x Conky's interval. Max of 30 is not supplied, Conky assumes 2x Conky's interval. Max of 30
lines can be displayed, or until the text buffer is filled. lines can be displayed, or until the text buffer is filled.
@ -559,90 +564,90 @@ VARIABLES
i2c (dev) type n i2c (dev) type n
I2C sensor from sysfs (Linux 2.6). dev may be omitted if you I2C sensor from sysfs (Linux 2.6). dev may be omitted if you
have only one I2C device. type is either in (or vol) meaning have only one I2C device. type is either in (or vol) meaning
voltage, fan meaning fan or temp/tempf (first in C, second in F) voltage, fan meaning fan or temp/tempf (first in C, second in F)
meaning temperature. n is number of the sensor. See meaning temperature. n is number of the sensor. See
/sys/bus/i2c/devices/ on your local computer. /sys/bus/i2c/devices/ on your local computer.
i8k_ac_status i8k_ac_status
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
whether ac power is on, as listed in /proc/i8k (translated to whether ac power is on, as listed in /proc/i8k (translated to
human-readable). Beware that this is by default not enabled by human-readable). Beware that this is by default not enabled by
i8k itself. i8k itself.
i8k_bios i8k_bios
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the bios version as listed in /proc/i8k. the bios version as listed in /proc/i8k.
i8k_buttons_status i8k_buttons_status
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the volume buttons status as listed in /proc/i8k. the volume buttons status as listed in /proc/i8k.
i8k_cpu_temp i8k_cpu_temp
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the cpu temperature in Celsius, as reported by /proc/i8k. the cpu temperature in Celsius, as reported by /proc/i8k.
i8k_cpu_tempf i8k_cpu_tempf
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the cpu temperature in Farenheit, as reported by /proc/i8k. the cpu temperature in Farenheit, as reported by /proc/i8k.
i8k_left_fan_rpm i8k_left_fan_rpm
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the left fan's rate of rotation, in revolutions per minute as the left fan's rate of rotation, in revolutions per minute as
listed in /proc/i8k. Beware, some laptops i8k reports these fans listed in /proc/i8k. Beware, some laptops i8k reports these fans
in reverse order. in reverse order.
i8k_left_fan_status i8k_left_fan_status
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the left fan status as listed in /proc/i8k (translated to human- the left fan status as listed in /proc/i8k (translated to human-
readable). Beware, some laptops i8k reports these fans in readable). Beware, some laptops i8k reports these fans in
reverse order. reverse order.
i8k_right_fan_rpm i8k_right_fan_rpm
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the right fan's rate of rotation, in revolutions per minute as the right fan's rate of rotation, in revolutions per minute as
listed in /proc/i8k. Beware, some laptops i8k reports these fans listed in /proc/i8k. Beware, some laptops i8k reports these fans
in reverse order. in reverse order.
i8k_right_fan_status i8k_right_fan_status
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the right fan status as listed in /proc/i8k (translated to the right fan status as listed in /proc/i8k (translated to
human-readable). Beware, some laptops i8k reports these fans in human-readable). Beware, some laptops i8k reports these fans in
reverse order. reverse order.
i8k_serial i8k_serial
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
your laptop serial number as listed in /proc/i8k. your laptop serial number as listed in /proc/i8k.
i8k_version i8k_version
If running the i8k kernel driver for Inspiron laptops, displays If running the i8k kernel driver for Inspiron laptops, displays
the version formatting of /proc/i8k. the version formatting of /proc/i8k.
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
if_existing (file) if_existing (file)
if FILE exists, display everything between if_existing and the if FILE exists, display everything between if_existing and the
matching $endif matching $endif
if_mounted (mountpoint) 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 and the matching $endif
@ -662,8 +667,8 @@ VARIABLES
Machine, i686 for example Machine, i686 for example
mails Mail count in mail spool. You can use program like fetchmail to mails Mail count in mail spool. You can use program like fetchmail to
get mails from some server using your favourite protocol. See get mails from some server using your favourite protocol. See
also new_mails. also new_mails.
@ -812,20 +817,20 @@ VARIABLES
lservice - local service name from /etc/services lservice - local service name from /etc/services
The connection index provides you with access to each connection The connection index provides you with access to each connection
in the port monitor. The monitor will return information for in the port monitor. The monitor will return information for
index values from 0 to n-1 connections. Values higher than n-1 index values from 0 to n-1 connections. Values higher than n-1
are simply ignored. For the "count" item, the connection index are simply ignored. For the "count" item, the connection index
must be omitted. It is required for all other items. must be omitted. It is required for all other items.
Examples: Examples:
${tcp_portmon 6881 6999 count} - displays the number of connec- ${tcp_portmon 6881 6999 count} - displays the number of connec-
tions in the bittorrent port range tions in the bittorrent port range
${tcp_portmon 22 22 rip 0} - displays the remote host ip of the ${tcp_portmon 22 22 rip 0} - displays the remote host ip of the
first sshd connection first sshd connection
${tcp_portmon 22 22 rip 9} - displays the remote host ip of the ${tcp_portmon 22 22 rip 9} - displays the remote host ip of the
tenth sshd connection tenth sshd connection
${tcp_portmon 1 1024 rhost 0} - displays the remote host name of ${tcp_portmon 1 1024 rhost 0} - displays the remote host name of
@ -834,22 +839,22 @@ VARIABLES
${tcp_portmon 1 1024 rport 4} - displays the remote host port of ${tcp_portmon 1 1024 rport 4} - displays the remote host port of
the fifth connection on a privileged port the fifth connection on a privileged port
${tcp_portmon 1 65535 lservice 14} - displays the local service ${tcp_portmon 1 65535 lservice 14} - displays the local service
name of the fifteenth connection in the range of all ports name of the fifteenth connection in the range of all ports
Note that port monitor variables which share the same port range Note that port monitor variables which share the same port range
actually refer to the same monitor, so many references to a sin- actually refer to the same monitor, so many references to a sin-
gle port range for different items and different indexes all use gle port range for different items and different indexes all use
the same monitor internally. In other words, the program avoids the same monitor internally. In other words, the program avoids
creating redundant monitors. creating redundant monitors.
texeci interval command texeci interval command
Runs a command at an interval inside a thread and displays the Runs a command at an interval inside a thread and displays the
output. Same as $execi, except the command is run inside a output. Same as $execi, except the command is run inside a
thread. Use this if you have a slow script to keep Conky updat- thread. Use this if you have a slow script to keep Conky updat-
ing. You should make the interval slightly longer then the time ing. You should make the interval slightly longer then the time
it takes your script to execute. For example, if you have a it takes your script to execute. For example, if you have a
script that take 5 seconds to execute, you should make the script that take 5 seconds to execute, you should make the
interval at least 6 seconds. See also $execi. interval at least 6 seconds. See also $execi.
@ -864,21 +869,21 @@ VARIABLES
time (format) time (format)
Local time, see man strftime to get more information about for- Local time, see man strftime to get more information about for-
mat mat
totaldown net totaldown net
Total download, overflows at 4 GB on Linux with 32-bit arch and Total download, overflows at 4 GB on Linux with 32-bit arch and
there doesn't seem to be a way to know how many times it has there doesn't seem to be a way to know how many times it has
already done that before conky has started. already done that before conky has started.
top type, num top type, num
This takes arguments in the form:top (name) (number) Basically, This takes arguments in the form:top (name) (number) Basically,
processes are ranked from highest to lowest in terms of cpu processes are ranked from highest to lowest in terms of cpu
usage, which is what (num) represents. The types are: "name", usage, which is what (num) represents. The types are: "name",
"pid", "cpu", and mem". There can be a max of 10 processes "pid", "cpu", and mem". There can be a max of 10 processes
listed. listed.
@ -902,9 +907,9 @@ VARIABLES
Upload speed in kilobytes with one decimal Upload speed in kilobytes with one decimal
upspeedgraph net (height),(width) (gradient colour 1) (gradient colour upspeedgraph net (height),(width) (gradient colour 1) (gradient colour
2) (scale) 2) (scale)
Upload speed graph, colours defined in hex, minus the #. If Upload speed graph, colours defined in hex, minus the #. If
scale is non-zero, it becomes the scale for the graph. scale is non-zero, it becomes the scale for the graph.
@ -928,7 +933,7 @@ VARIABLES
voffset (pixels) voffset (pixels)
Change vertical offset by N pixels. Negative values will cause Change vertical offset by N pixels. Negative values will cause
text to overlap. See also $offset. text to overlap. See also $offset.
@ -941,12 +946,12 @@ VARIABLES
xmms_channels xmms_channels
xmms / bmp / audacious / infopipe: number of audio channels of xmms / bmp / audacious / infopipe: number of audio channels of
current tune current tune
xmms_filename xmms_filename
xmms / bmp / audacious / infopipe: full path and filename of xmms / bmp / audacious / infopipe: full path and filename of
current tune current tune
@ -956,17 +961,17 @@ VARIABLES
xmms_length xmms_length
xmms / bmp / audacious / infopipe: total length of current tune xmms / bmp / audacious / infopipe: total length of current tune
as MM:SS as MM:SS
xmms_length_seconds xmms_length_seconds
xmms / bmp / audacious / infopipe: total length of current tune xmms / bmp / audacious / infopipe: total length of current tune
in seconds in seconds
xmms_playlist_position xmms_playlist_position
xmms / bmp / audacious / infopipe: playlist position of current xmms / bmp / audacious / infopipe: playlist position of current
tune tune
@ -975,12 +980,12 @@ VARIABLES
xmms_position xmms_position
xmms / bmp / audacious / infopipe: MM:SS position of current xmms / bmp / audacious / infopipe: MM:SS position of current
tune tune
xmms_position_seconds xmms_position_seconds
xmms / bmp / audacious / infopipe: position of current tune in xmms / bmp / audacious / infopipe: position of current tune in
seconds seconds
@ -1007,11 +1012,11 @@ FILES
BUGS BUGS
Drawing to root or some other desktop window directly doesn't work with Drawing to root or some other desktop window directly doesn't work with
all window managers. Especially doesn't work well with Gnome and it has all window managers. Especially doesn't work well with Gnome and it has
been reported that it doesn't work with KDE either. Nautilus can be been reported that it doesn't work with KDE either. Nautilus can be
disabled from drawing to desktop with program gconf-editor. Uncheck disabled from drawing to desktop with program gconf-editor. Uncheck
show_desktop in /apps/nautilus/preferences/. There is -w switch in show_desktop in /apps/nautilus/preferences/. There is -w switch in
Conky to set some specific window id. You might find xwininfo -tree Conky to set some specific window id. You might find xwininfo -tree
useful to find the window to draw to. You can also use -o argument useful to find the window to draw to. You can also use -o argument
which makes Conky to create its own window. which makes Conky to create its own window.
SEE ALSO SEE ALSO

View File

@ -250,6 +250,15 @@
<para></para></listitem> <para></para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><command><option>own_window_hints</option></command>
<option>undecorated,below,above,sticky,skip_taskbar,skip_pager</option>
</term>
<listitem>
If own_window is yes, you may use these window manager hints to affect the way conky displays
<para></para></listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><command><option>out_to_console</option></command> <term><command><option>out_to_console</option></command>
</term> </term>

View File

@ -266,6 +266,10 @@ Boolean, set pseudo-transparency?
\fBown_window_colour\fR \fBcolour\fR \fBown_window_colour\fR \fBcolour\fR
If own_window_transparent no, set a specified background colour (defaults to black). Takes either a hex value (#ffffff) or a valid RGB name (see /usr/lib/X11/rgb.txt) If own_window_transparent no, set a specified background colour (defaults to black). Takes either a hex value (#ffffff) or a valid RGB name (see /usr/lib/X11/rgb.txt)
.TP
\fBown_window_hints\fR \fBundecorated,below,above,sticky,skip_taskbar,skip_pager\fR
If own_window is yes, you may use these window manager hints to affect the way conky displays
.TP .TP
\fBout_to_console\fR \fBout_to_console\fR
Print text to stdout. Print text to stdout.

View File

@ -59,6 +59,9 @@ own_window_transparent yes
# If own_window_transparent is set to no, you can set the background colour here # If own_window_transparent is set to no, you can set the background colour here
own_window_colour hotpink own_window_colour hotpink
# If own_window is yes, these window manager hints may be used
#own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
# Use double buffering (reduces flicker, may not work for everyone) # Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes double_buffer yes
@ -179,7 +182,7 @@ $stippled_hr
${color #ddaa00}Port(s)${alignr}#Connections ${color #ddaa00}Port(s)${alignr}#Connections
$color ALL: ${alignr}$color ${tcp_portmon 1 65535 count} $color ALL: ${alignr}$color ${tcp_portmon 1 65535 count}
$color mpd: ${alignr}$color ${tcp_portmon 6600 6600 count} $color mpd: ${alignr}$color ${tcp_portmon 6600 6600 count}
$color sshd: ${alignr}$color ${tcp_portmon 9229 9229 count} $color sshd: ${alignr}$color ${tcp_portmon 22 22 count}
$color torrent: ${alignr}$color ${tcp_portmon 6881 6999 count} $color torrent: ${alignr}$color ${tcp_portmon 6881 6999 count}
${color #ddaa00}Remote Address ${alignr} Local Service/Port$color ${color #ddaa00}Remote Address ${alignr} Local Service/Port$color
${tcp_portmon 1 65535 rhost 0} ${alignr} ${tcp_portmon 1 65535 lservice 0} ${tcp_portmon 1 65535 rhost 0} ${alignr} ${tcp_portmon 1 65535 lservice 0}

View File

@ -241,7 +241,6 @@ static int set_transparent = 0;
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
static int own_window = 0; static int own_window = 0;
static int background_colour = 0; static int background_colour = 0;
static char wm_class_name[256];
/* fixed size/pos is set if wm/user changes them */ /* fixed size/pos is set if wm/user changes them */
static int fixed_size = 0, fixed_pos = 0; static int fixed_size = 0, fixed_pos = 0;
#endif #endif
@ -4831,7 +4830,7 @@ static void set_default_configurations(void)
maximum_width = 0; maximum_width = 0;
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
own_window = 0; own_window = 0;
strcpy(wm_class_name, "conky"); strcpy(window.wm_class_name, "conky");
#endif #endif
stippled_borders = 0; stippled_borders = 0;
border_margin = 3; border_margin = 3;
@ -4943,7 +4942,11 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
} }
CONF("on_bottom") { CONF("on_bottom") {
if(value) if(value)
ERR("on_bottom is deprecated. use own_window_hints below");
on_bottom = string_to_bool(value); on_bottom = string_to_bool(value);
if (on_bottom)
SET_HINT(window.hints,HINT_BELOW);
else else
CONF_ERR; CONF_ERR;
} }
@ -5230,8 +5233,8 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
own_window = string_to_bool(value); own_window = string_to_bool(value);
} }
CONF("wm_class_name") { CONF("wm_class_name") {
strncpy(wm_class_name, value, sizeof(wm_class_name)-1); memset(window.wm_class_name,0,sizeof(window.wm_class_name));
wm_class_name[sizeof(wm_class_name)-1] = 0; strncpy(window.wm_class_name, value, sizeof(window.wm_class_name)-1);
} }
CONF("own_window_transparent") { CONF("own_window_transparent") {
set_transparent = string_to_bool(value); set_transparent = string_to_bool(value);
@ -5243,6 +5246,35 @@ else if (strcasecmp(name, a) == 0 || strcasecmp(name, b) == 0)
ERR("Invalid colour for own_winder_colour (try omitting the '#' for hex colours"); ERR("Invalid colour for own_winder_colour (try omitting the '#' for hex colours");
} }
} }
CONF("own_window_hints") {
if (value) {
char *p_hint, *p_save;
char delim[] = ", ";
/* tokenize the value into individual hints */
if ((p_hint=strtok_r(value, delim, &p_save)) != NULL)
do {
/*fprintf(stderr, "hint [%s] parsed\n", p_hint);*/
if (strncmp(p_hint,"undecorate",10) == 0)
SET_HINT(window.hints,HINT_UNDECORATED);
else if (strncmp(p_hint,"below",5) == 0)
SET_HINT(window.hints,HINT_BELOW);
else if (strncmp(p_hint,"above",5) == 0)
SET_HINT(window.hints,HINT_ABOVE);
else if (strncmp(p_hint,"sticky",6) == 0)
SET_HINT(window.hints,HINT_STICKY);
else if (strncmp(p_hint,"skip_taskbar",12) == 0)
SET_HINT(window.hints,HINT_SKIP_TASKBAR);
else if (strncmp(p_hint,"skip_pager",10) == 0)
SET_HINT(window.hints,HINT_SKIP_PAGER);
else
CONF_ERR;
p_hint=strtok_r(NULL, delim, &p_save);
}
while (p_hint!=NULL);
}
}
#endif #endif
CONF("stippled_borders") { CONF("stippled_borders") {
if (value) if (value)
@ -5603,6 +5635,7 @@ int main(int argc, char **argv)
(stderr, (stderr,
"Conky: forked to background, pid is %d\n", "Conky: forked to background, pid is %d\n",
ret); ret);
fflush(stderr);
return 0; return 0;
} }
} }

View File

@ -299,6 +299,18 @@ char tmpstring2[TEXT_BUFFER_SIZE];
#define ATOM(a) XInternAtom(display, #a, False) #define ATOM(a) XInternAtom(display, #a, False)
#ifdef OWN_WINDOW
enum _window_hints {
HINT_UNDECORATED = 0,
HINT_BELOW,
HINT_ABOVE,
HINT_STICKY,
HINT_SKIP_TASKBAR,
HINT_SKIP_PAGER
};
#define SET_HINT(mask,hint) (mask |= (1<<hint))
#define TEST_HINT(mask,hint) (mask & (1<<hint))
#endif
struct conky_window { struct conky_window {
Window root,window; Window root,window;
Drawable drawable; Drawable drawable;
@ -313,8 +325,10 @@ struct conky_window {
int width; int width;
int height; int height;
#ifdef OWN_WINDOW #ifdef OWN_WINDOW
char wm_class_name[256];
int x; int x;
int y; int y;
unsigned long hints;
#endif #endif
}; };

132
src/x11.c
View File

@ -119,6 +119,7 @@ static Window find_desktop_window()
XFree(children); XFree(children);
fprintf(stderr, fprintf(stderr,
"Conky: desktop window (%lx) found from __SWM_VROOT property\n", win); "Conky: desktop window (%lx) found from __SWM_VROOT property\n", win);
fflush(stderr);
return win; return win;
} }
@ -147,6 +148,7 @@ static Window find_desktop_window()
else else
fprintf(stderr, "Conky: desktop window (%lx) is root window\n",win); fprintf(stderr, "Conky: desktop window (%lx) is root window\n",win);
fflush(stderr);
return win; return win;
} }
@ -199,6 +201,7 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour, c
XClassHint classHint; XClassHint classHint;
XWMHints wmHint; XWMHints wmHint;
Atom xa;
char window_title[256]; char window_title[256];
window.root = find_desktop_window(); window.root = find_desktop_window();
@ -208,11 +211,13 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour, c
CopyFromParent, CopyFromParent,
InputOutput, InputOutput,
CopyFromParent, CopyFromParent,
CWBackPixel|CWOverrideRedirect, &attrs); CWBackPixel|CWOverrideRedirect,
&attrs);
fprintf(stderr, "Conky: drawing to created window (%lx)\n", window.window); fprintf(stderr, "Conky: drawing to created window (%lx)\n", window.window);
fflush(stderr);
classHint.res_name = "conky"; classHint.res_name = window.wm_class_name;
classHint.res_class = classHint.res_name; classHint.res_class = classHint.res_name;
wmHint.flags = InputHint | StateHint; wmHint.flags = InputHint | StateHint;
@ -228,7 +233,128 @@ void init_window(int own_window, int w, int h, int set_trans, int back_colour, c
/* Sets an empty WM_PROTOCOLS property */ /* Sets an empty WM_PROTOCOLS property */
XSetWMProtocols(display,window.window,NULL,0); XSetWMProtocols(display,window.window,NULL,0);
XLowerWindow(display, window.window);
/* Set NORMAL window type for _NET_WM_WINDOW_TYPE. */
xa = ATOM(_NET_WM_WINDOW_TYPE);
if (xa != None) {
Atom prop = ATOM(_NET_WM_WINDOW_TYPE_NORMAL);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeReplace,
(unsigned char *) &prop,
1);
}
/* Set desired hints */
/* Window decorations */
if (TEST_HINT(window.hints,HINT_UNDECORATED)) {
fprintf(stderr, "Conky: hint - undecorated\n"); fflush(stderr);
xa = ATOM(_MOTIF_WM_HINTS);
if (xa != None) {
long prop[5] = { 2, 0, 0, 0, 0 };
XChangeProperty(display, window.window, xa,
xa, 32, PropModeReplace,
(unsigned char *) prop, 5);
}
}
/* Below other windows */
if (TEST_HINT(window.hints,HINT_BELOW)) {
fprintf(stderr, "Conky: hint - below\n"); fflush(stderr);
xa = ATOM(_WIN_LAYER);
if (xa != None) {
long prop = 0;
XChangeProperty(display, window.window, xa,
XA_CARDINAL, 32,
PropModeReplace,
(unsigned char *) &prop, 1);
}
xa = ATOM("_NET_WM_STATE");
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_BELOW);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
/* Above other windows */
if (TEST_HINT(window.hints,HINT_ABOVE)) {
fprintf(stderr, "Conky: hint - above\n"); fflush(stderr);
xa = ATOM(_WIN_LAYER);
if (xa != None) {
long prop = 6;
XChangeProperty(display, window.window, xa,
XA_CARDINAL, 32,
PropModeReplace,
(unsigned char *) &prop, 1);
}
xa = ATOM("_NET_WM_STATE");
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_ABOVE);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
/* Sticky */
if (TEST_HINT(window.hints,HINT_STICKY)) {
fprintf(stderr, "Conky: hint - sticky\n"); fflush(stderr);
xa = ATOM("_NET_WM_STATE");
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_STICKY);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
/* Skip taskbar */
if (TEST_HINT(window.hints,HINT_SKIP_TASKBAR)) {
fprintf(stderr, "Conky: hint - skip_taskbar\n"); fflush(stderr);
xa = ATOM("_NET_WM_STATE");
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_TASKBAR);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
/* Skip pager */
if (TEST_HINT(window.hints,HINT_SKIP_PAGER)) {
fprintf(stderr, "Conky: hint - skip_pager\n"); fflush(stderr);
xa = ATOM("_NET_WM_STATE");
if (xa != None) {
Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_PAGER);
XChangeProperty(display, window.window, xa,
XA_ATOM, 32,
PropModeAppend,
(unsigned char *) &xa_prop,
1);
}
}
XMapWindow(display, window.window); XMapWindow(display, window.window);
} }