By daneli (User), on Thu
Jun 15 23:18:03 2006: Solution for "always on top".
Here's what I do to add an always on top option to any
desklets:
1) Take the following line of code from test.py in
..adesklets-0.6.1/test/:
adesklets.window_reset(adesklets.WINDOW_MANAGED)
Add it to the desklet you want to run always on top. For
example, in modubar.py this is inserted right before
"adesklets.window_show()" Here is the block of code in
question:
# Finish setting things up, then display the window
#
adesklets.context_set_blend(False)
adesklets.window_set_transparency(True)
adesklets.menu_add_separator()
adesklets.menu_add_item('Configure')
self._display_icons()
if self.config['modules_on']:
self._display_modules()
# ADD WINDOW_MANAGED OPTION BELOW:
adesklets.window_reset(adesklets.WINDOW_MANAGED)
adesklets.window_show()
2) Use the devilspie utility
(http://www.burtonini.com/blog/computers/devilspie) to set
the always on top option and to remove the managed window
decorations. Devilspie looks for window matching scripts in
~/.devilspie. My script for adesklets is called
"adesklets.ds" and contains the following:
(if (is (application_name) "adesklets") (begin (above) (pin)
(undecorate)))
"Above" makes the window run always on top, "pin" makes it
appear on all workspaces and "undecorate" removes window
decorations. Start devilspie before you start
adesklets.
That's all there is to it. Devilspie will see to it that each
desklets to which you have added
"adesklets.window_reset(adesklets.WINDOW_MANAGED)" will run
always on top. (Of course an always on top window can be
covered over by another window which also has the "always on
top" attribute set.)
By the way, if you want to hide a running desklet - whether
or not it is set to run always on top - check out kdocker.
(http://kdocker.sourceforge.net/) Kdocker lets you dock/hide
adesklets into the system tray.
dan
By syfou (Core Developer
& Desklet Author), on Fri Jun 16 03:37:45 2006.
Yeah, why not? I will keep it around, just in case people are
interested. Three problems with that:
- adesklets uses simple
pseudo-transparency, so this will look weird under many
circumstances.
- Focus events are slightly
broken when used in conjunction with managed windows, so
the behavior of some desklets (especially yab) will be
strange.
- adesklets.window_reset(adesklets.WINDOW_MANAGED)
is just a debug mode: desklet placement (recording and
setting) is completely disabled when it is used... This
mean that you will have to either place the desklets
manually each time, or script the position externally using
devilspie.
Thanks for sharing anyway! Yours,
By daneli (User), on Fri
Jun 16 09:34:04 2006.
Thanks syfou.
Yes you have to place the window by hand or use the devilspie
"geometry" command to move the window. (I think the wmctrl
utility would probably also work to place the window.)
The pseudo-transparency doesn't look weird with some
desklets, especially those that are rectangular in shape - if
you size the window properly. For example, modubar looks ok,
especially if the icon maximum height is set low enough so
that the focused icons don't exceed the height of the bar
itself. In this way no pseudo-transparent space is reserved
outside the icon bar. I also set the captions to run below
the bar, and then make the window small enough so that the
captions don't show. (Even though the caption fade-in is
cool, I need a bar that is always available more than I need
the captions.)
Using "always on top" in this way requires some trade-offs,
but so does keeping desklets at the bottom of the window
stack, without window manager controls available to bring
them to the top!
dan