Smarter desktop applet placement
Ambroz Bizjak
ambro at b4ever.net
Fri Aug 1 13:40:35 CEST 2008
Hi,
I've coded a little algorithm to make Plasma place desktop applet where
there's actually space. It has the ability to stack applets into any of
the four corners of the desktop, and can stack them both vertically and
horizontally.
How it works (for top-left corner, horizontal stacking):
It tries to place the applet in the top-left corner, and if there are
obstacles, it advances horizontally to the end of the horizontally
longest-outreaching obstacle, then repeats the checking. If it runs out of
X space, it locates the obstacle on the whole horizontal strap that
vertically ends first. Then it starts trying a new row with the
Y-coordinate that obstacle ended.
Currently I've just thrown the code into containment.c,
Containment::Private class; do you think there's a better place for it?
Also, any ideas in how that could be integrated into the desktop? I mean
the ability to choose the type of stacking. I was thinking about the
"Desktop Settings" from Plasma's main context menu. And some option to
reposition all applets on the desktop.
Otherwise, there are currently some problems:
- Some applets don't report their size immediately, causing them to be
placed where there is no space for them (calendar, character selector)
- Applets are placed over the whole screen, ignoring panels - how can I
get only the available screen? I use containment->geometry().
- There is no spacing between applets
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plasma-placement.patch
Type: application/octet-stream
Size: 8767 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20080801/66360e0f/attachment.obj
More information about the Plasma-devel
mailing list