Friday, April 30, 2010

Plasmoids in windows

Since forever (where we define the start of time to be when I started working on Plasma) it has been possible to run Plasmoids, or any widget that Plasma can display, in a window on its own using plasmoidviewer. It isn't completely satisfactory for running widgets in a window, though, because at its heart plasmoidviewer is a development tool meant for testing and debugging Plasmoids.

(By the way, did you know that there are similar apps for DataEngines and Wallpapers? plasmaengineexplorer and plasmawallpaperviewer.)

Marco worked up a small proof-of-concept app in playground some time ago that lets us run Plasmoids in windows slightly more satisfactorily. Here's a shot of a clock and the microblogging Plasmoids running with a Konversation window in behind and the pretty KRuner window nearby:



Right clicking on a Plasmoid gets you the usual suspects in the context menu along with a "Quit" entry that quits that Plasmoid. What's really cool is that they all run in the same process, keeping overhead down. Now, the goal for this isn't just to allow us to run Plasmoids in random windows on the desktop, but to provide an infrastructure for running Plasmoids full screen with Plasma Mobile in a way that is resource friendly but which also keeps the apps away from the main UI.

You can move the Plasmoids around, run them with or without a window border and background and more. It is currently in kdereview, and I'm busy polishing this up for 4.5. The name of this little wonder? plasma-windowed.

It currently knows about the following command line flags: -b, --border or --noborder to control the window borders (default is to have borders), -f and --fulscreen which starts the app fullscreen. This is just the start (it's only 368 LOC right now), however, and I have lots of ideas on how to make this even spiffier. :)

Now we can show Plasmoids on the desktop, in panels, on a dashboard, on a mobile device, on a netbook, on a screensaver, floating about and in Amarok. Soonish we'll have them on KDM, Kontact, Skrooge and KDevelop, too. Woo!

13 comments:

yokem55 said...

Could this be a means of integrating out of process plasmoids into the desktop for plasmoids that could misbehave? I know previously you haven't been big on the idea, but would this kind of a souped up plasmoidviewer be a way to make this happen?

Aaron J. Seigo said...

@yokem55: no it isn't; if it was this simple, it would've been done this way from the start.

SMR said...

"What's really cool is that they all run in the same process, keeping overhead down." -> I'm not sure I understand this. What is the overhead from having multiple plasma processes (pixmap caching?) and why does avoiding the overhead trump all the benefits that process isolation provides? Not too long ago there was a post on the Planet remarking/ranting about how process aggregation is a step backwards. I agreed with the posters sentiments. Given Pyne's ongoing work for a shared caching mechanism, is a shared Plasma process an idea that will stay? That is, is the design of Plasma architecture such that processes can later be separated to take advantage of both caching and process isolation?

Aaron J. Seigo said...

@SMR: mpyne's work is great, but it's a different set of issues from that which produces the overhead of running separate processes for each widget. so discussing the two together doesn't have much meaning :)

"is the design of Plasma architecture such that processes can later be separated to take advantage of both caching and process isolation?"

as can be seen from plasmoidviewer, this is already possible. that plasma-windowed is meant to run aside plasma-[mobile|desktop|netbook] does as well.

the point of plasma-windowed is to provide a way to run plasmoids in separate windows while providing some persistence for their settings.

Aaron J. Seigo said...

one other interesting bit to note: while people go on and on about process isolation, it's amazing how many of those same people fret about bloat. and yes, on a device with 128 or 256 MB of RAM, this stuff matters.

SMR said...

I'm sure you've heard this all before, but, the primary concern is not so much about memory and caching but of a buggy plug-in (be it Plasma or otherwise) taking down the whole framework. As long as binary (i.e., non-scripted) plasmoids can share the same process context as one's other windowed plasmoids, or for that matter, as long as programmers can make mistakes, there is a risk of well-behaved plasmoids being nuked by an unisolated buggy neighbor. Bad apples and all.

By the way, I should have included this in my first comment: I'm pretty excited about the way this looks. Will these still be controlled by kwin in a way that allows for the usual window-specific settings on a per-plasmoid basis? E.g., I'd be running plasma-windowed and I want my clock plasmoid to be always on top (but not in a panel for whatever reason), yet I'd also want my notes plasmoid to behave like a normal stackable window.

Aaron J. Seigo said...

@SMR: which is one of the primary reasons why we encouraging scripted, and particularly Javascripted, Plasmoids.

we get sandboxing and runtime control without having to deal with multiple processes and the overhead they bring in this case.

"Will these still be controlled by kwin in a way that allows for the usual window-specific settings on a per-plasmoid basis?"

yes

binarylooks said...

Great work Aaron. Could we somehow use this to have plasmoids in the Media Center? Lik on the home screen for example?

Shantanu said...

@binarylooks
Plasma windowed is not required for applets for the home screen. You can just add normal applets to the media containment :)

Inukaze said...

Hi there , i just need 2 Plasmoids for Windows

1 - Show Desktop
2 - Bar of Task ( List Of Window ? )

Well , under Windows XP SP3 , i dont have that 2 Plasmoids for the actual lastest version KDE 4.4.4.

Someone can tell me how i can get this 2 plasmoids for Windows plz , i really need.

Thank you for help

Shantanu said...

@Inukaze

Actually what he means in windows as in the windows you see on the computer, not the Windows OS ;)
Plasma doesn't run on Windows OS as far as I know, however you can run other KDE applications, goto windows.kde.org

Aaron J. Seigo said...

@Inukaze: this blog posting wasn't about Plasmoids on Microsoft Windows, but Plasmoids in windows (like any other application).

that said:

"Well , under Windows XP SP3 , i dont have that 2 Plasmoids"

they need to have MS Windows support added to them. showing the desktop is a platform-specific API, so that plasmoid would need to get patched to include support for MS Windows. patches are welcome :)

the taskbar is available for windows in 4.5, though, as we did get patches for that!

the window list menu should also be available in 4.5, though i have to backport 2 small changes in trunk to make that happen.

Aaron J. Seigo said...

@Shantanu: "Plasma doesn't run on Windows OS as far as I know"

libplasma certianly works on MS Windows, as do many of the individual Plasmoids. plasma-desktop even works, for certain values of "works". which is to say, it isn't perfect, but it is functional.

it isn't an officially supported platform for us, and the core team doesn't actively work on it. patches do get contributed, however.