On the heels of my wish for a C++ version of printer-applet, Dantti announced just such a project. He invited me to contribute, so I did.

Since print-manager is a from-scratch project, it needed a tray icon daemon. Well, it sorta had a stub based on KPackageKit’s tray icon daemon, but nothing really functional. A few weeks ago I ported the stub to KStatusNotifierItem and left it in an uninstallable, never-tested state. (This was because at the time I was not hacking in a place where I could print things) Today I fiddled around with library names and .desktop files until the KDED module loaded. The result? Every 5 seconds I’d get a new printer icon! 😀

So today I cleaned up the code. I got it to the point where it pretty much has feature parity with the applet included in KDE 4.4. In fact, it’s a bit more, nifty, even; it now tells you the name of the printer currently printing as well as the name of the document it is printing.

Neat!

Things work mostly as before. As long as your jobs are consolidated to a single printer, clicking the icon will load up the queue for that printer. But since print-manager currently can only show the queue for one printer at a time, if the active jobs are spread across multiple printers, clicking the tray icon will make a context menu with all the printers pop up, and clicking these menu entries will open up the print queue for that printer. I should note that I’ve not actually tested this, for the lack of two printers.

I am wondering, though; is the amount of documents in queue important enough to include in a third line in the tooltip? I could see how it might, and it should be easy enough to do so.

The last thing on the todo list is to fix a pretty nasty bug. Since this tray icon is spawned by the KDE Daemon (KDED), the “quit” action automagically added to the icon’s context menu will quit the whole of KDED, bringing down services such as PowerDevil, KHotkeys and so forth. I’m at a loss on how to get around this. Setting a custom context menu won’t work, as the setContextMenu() function of KStatusNotifierItem just adds your custom Menu to the preexisting menu that comes by default. Any bright ideas would be welcome here.

So, perhaps not the most exciting blog post on Earth, seeing as I’m just replacing already-existing functionality, but hopefully a few of the new features are a bit interesting. It’s certainly been quite interesting to code. 🙂

Share this: Twitter

Reddit

Like this: Like Loading... Related