Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How can I reliably start Conky before the background window?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4974
Location: Dark side of the mood

PostPosted: Thu Jun 09, 2016 9:13 am    Post subject: How can I reliably start Conky before the background window? Reply with quote

Hi all.

I guess this question has come multiple times but here it is. It's been a couple of years that I delay-start Conky to account for the delay until the background is displayed, otherwise Conky's window becomes hidden by the one showing the background. This is precisely what happens: over the years I have had to progressively increase the startup delay, which as big as ten seconds seems not enough in some cases. Frustratingly enough I don't need a delay when I start Conky and the desktop is ready, it's only when I log on that I need it.

So is there a way to somehow determine when the background window is present or ready before I can safely run Conky? I'd like to set a delay no bigger than two or three seconds, that's the deal. My desktop environment is Xfce 4.12. It's also my opportunity to ask how Xfce (or xfdesktop) works as far as the background display is concerned; any info on that?

EDIT: After some time using my tweaked script, conky finally runs when, where and how I expect it to run. Here's my script:
/usr/local/bin/conky.sh:
#!/bin/sh

# Try to detect screen width to correctly position Conky
# to the right of the first monitor
eval $(xdpyinfo | sed -e '/screen\s\+#0/,+1!d' \
    -e '/screen/d' \
    -e 's@\s\+dimensions:\s\+\([0-9]\+\)x\([0-9]\+\).*@WIDTH=\1; HEIGHT=\2@g') 2>/dev/null \
    || WIDTH=1920

# Wait till the desktop window is ready (more or less)
# Method 1:
#while ! xwininfo -name Bureau 2>&1 > /dev/null; do sleep 1s; done
# Method 2:
while ! xwininfo -tree -root | grep -qE '\("xfdesktop"\s+"\w+"\)\s+'${WIDTH}x${HEIGHT}'\+0\+0'; do sleep 1s; done

# Don't change if screen width is already 1920, i.e. only one monitor
[ $WIDTH -eq 1920 ] && unset WIDTH

cd $HOME/.conky
exec /usr/bin/conky ${WIDTH:+-y 48 -x }${WIDTH:--a top_right} "$@"


You might have to tweak the first eval instruction to fit your display width and height. I've setup conky to run on the first display (the one that shows the Desktop). All displays, including the laptop's are 1920x1080 so it's rather simple to manage. YMMV.

And here's the related configuration part:
conkyrc:
# Window specifications #

own_window yes
# own_window_type desktop
own_window_type override
own_window_transparent yes
own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below

border_inner_margin 0
border_outer_margin 0

alignment tr

# Conky settings #

background no

double_buffer yes
no_buffers yes

Thanks anyway to all for your hints and suggestions.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!


Last edited by VinzC on Mon Aug 01, 2016 10:09 am; edited 2 times in total
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Thu Jun 09, 2016 2:04 pm    Post subject: Reply with quote

VinzC ...

I'm not familiar with conky, but from the above it would seem that it lacks a --float, or some similar option, so as to make it aways above the background (and I would think this a common enough use case that it would have some method of not starting under the background). Anyhow, from the above it seems you've probably looked at the available options, so perhaps this is not so common.

You might try the following ... 'xsetroot' has a '-name' option (which is generally uneeded for the background) you could set it to something memorable, then use 'xprop -root -display 0:0' and check for the name property ... that should/may give you some idea if the background is active (though, giving this some though, the background should always be active as it is the root window ... perhaps this isn't an x11 issue, but when/how xfce4 is setting the background).

HTH in some way & best ... khay
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4974
Location: Dark side of the mood

PostPosted: Fri Jun 10, 2016 7:22 am    Post subject: Reply with quote

khayyam wrote:
VinzC ...

I'm not familiar with conky, but from the above it would seem that it lacks a --float, or some similar option, so as to make it aways above the background (and I would think this a common enough use case that it would have some method of not starting under the background). Anyhow, from the above it seems you've probably looked at the available options, so perhaps this is not so common.

You might try the following ... 'xsetroot' has a '-name' option (which is generally uneeded for the background) you could set it to something memorable, then use 'xprop -root -display 0:0' and check for the name property ... that should/may give you some idea if the background is active (though, giving this some though, the background should always be active as it is the root window ... perhaps this isn't an x11 issue, but when/how xfce4 is setting the background).

HTH in some way & best ... khay

Thanks khay. I think I get what you mean. I've already tried to detect the root window. Fact is that very root window is covered/overlapped with the background image. Every time Conky fails to show it's hidden between the root window and the [window that contains the] background picture. I have sometimes witnessed that as I can see Conky appear then the background is displayed and Conky "vanishes" behind it. But it's there, just hidden. So far I haven't been able to detect which Xfce window displays the background picture as not all of those windows have a sensible name... if a name at all (using xwininfo). I suppose the hint you gave attempts at identifying that window, right?
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 521
Location: Germany

PostPosted: Fri Jun 10, 2016 8:06 am    Post subject: Reply with quote

Hm. One more reason why I prefer to use "startx" :)

I'm not sure if that helps at all, but if you put

Code:

own_window yes
own_window_type desktop
own_window_transparent yes


then in worst case you'll see conky at first with black background, but then on the next refresh it shall pickup the background set by the system.
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 829

PostPosted: Fri Jun 10, 2016 9:14 am    Post subject: Reply with quote

I'd tinker with the "own_window" variable in .conkyrc, and perhaps the "own_window_hints" variable. I don't know XFCE in enough detail to explain or to choose a definite solution.
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4974
Location: Dark side of the mood

PostPosted: Sat Jun 11, 2016 5:49 am    Post subject: Reply with quote

v_andal wrote:
Hm. One more reason why I prefer to use "startx" :)

8O ? I don't get it? The problem occurs whether I use startx or not...

v_andal wrote:
I'm not sure if that helps at all, but if you put

Code:

own_window yes
own_window_type desktop
own_window_transparent yes


then in worst case you'll see conky at first with black background, but then on the next refresh it shall pickup the background set by the system.


cboldt wrote:
I'd tinker with the "own_window" variable in .conkyrc, and perhaps the "own_window_hints" variable. I don't know XFCE in enough detail to explain or to choose a definite solution.


Here are the related parameters:
Code:
own_window yes
# own_window_type desktop
own_window_type override
own_window_transparent yes
own_window_hints undecorated,sticky,skip_taskbar,skip_pager,below

Those were determined years ago after hours of testing, as far as I can remember. I've had to comment out own_window_type desktop to have the hints work. Note that the hints were more a work of clueless attempts than educated experimenting. Conky's documentation (still) has absolutely no detailed explanation of the possible hints *sighs*. Anyway none of these did solve the problem of Conky being overlapped by the background picture/window by the time. The only possible way was to use a delay that would be longer than what the background takes to appear. Hence my question.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
cboldt
l33t
l33t


Joined: 24 Aug 2005
Posts: 829

PostPosted: Sat Jun 11, 2016 8:02 am    Post subject: Reply with quote

In own_window_hints, what happens if you remove the "below" hint? The other hints I more or less recognize from their counterparts in fvwm. None of them affect window appearance.

The first thing I would try though, is to set own_window to "no". This makes the own_window_hints inoperable. Instead, conky uses its own sense of how to display its output and interact with the WM. "own_window_type override", which you have, also disables the "own_window_hints". From the conky man page ...

Quote:
Override windows are not under the control of the window manager. Hints are ignored.


The next thing I would try is putting "own_window" back to "yes," and changing to "own_window_type normal"

If that didn't work, the next thing I would try is removing "below" from the "own_window_hints", and if that didn't work, substituting "above" for "below" in that switch.

Of course, try in any order you want! On the instances of conky here, "own_window" is set to "no", and conky is definitely above whatever is set in the root window. You can make the changes "on the fly" without restarting the WM. Conky polls its config file for changes.
Back to top
View user's profile Send private message
v_andal
Guru
Guru


Joined: 26 Aug 2008
Posts: 521
Location: Germany

PostPosted: Mon Jun 13, 2016 7:38 am    Post subject: Reply with quote

In my case, I'm using startx and have 'feh' to install background. So I have full control over the time when background is installed and when conky is started. YMMV.

As far as I understood conkys man page, then window type "desktop" simply sets certain set of hints, ignoring explicit hints provided with own_window_hints. Since type "desktop" means

Quote:

Desktop windows are special windows that have no window decorations; are always visible on your desktop; do not appear in your pager or
taskbar; and are sticky across all workspaces.


I've assumed that it does not make sense to use hints since "desktop" window is exactly what I want.

For experiment I've started conky before calling to feh for setting display. I've observed following behavior:

with own_window=no:

The background covers conky. After 2 seconds black screen with conky appears again. After another 2 seconds the background is restored and conky is drawn on top of it.


with own_window=yes, own_window_type=desktop, own_window_transparent=yes:

The background draws around conky window, which keeps black background. After 2 seconds conky window shows the background.
Back to top
View user's profile Send private message
VinzC
Advocate
Advocate


Joined: 17 Apr 2004
Posts: 4974
Location: Dark side of the mood

PostPosted: Mon Aug 01, 2016 10:03 am    Post subject: Reply with quote

I've updated my post. After a couple of weeks conky does exactly what I expect it to do. Script added, of course.
_________________
Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum