More print-manager progress

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.


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. 🙂


17 Responses to More print-manager progress

  1. warnec says:

    Would You mind telling me what plasma theme are You using? 😉

  2. Aaron Seigo says:

    the quit action is in the actionCollection(); so you should be able to do something like:

    KActionCollection *actions = notifierItem->actionCollection();

  3. Lincoln says:

    Yeah, C++!

    If I’m not mistaking, the current applet is in python, right? What performance boost can we expect from a move to C++?

    • echidnaman says:

      RAM usage should go way down, pretty much. Other than that I don’t think you’ll be able to notice any changes.

      • Lincoln says:

        Great news 🙂

        Do you plan to make it the default applet, or will both coexist side by side?

      • echidnaman says:

        There’s pretty much no need for two applets. If things progress nicely, I can see the print-manager project replacing both system-config-printer-kde and printer-applet, as both are sore for proper maintenance. (Plus a bit heavy and susceptible to runtime issues due to python)

  4. Anonyrat says:

    What’s that plasma theme?

  5. Rob J. Caskey says:

    Can we ditch Queued?

    Stylus CX-7400
    Printing: A Really Long Doc…
    Page: 991/1012

    And of course if it is not printing it should be

    Error: Error instead of Printing:

  6. Eckhart says:

    I’d say display the queue length only if it makes sense:

    Stylus CX-7400
    Printing: printd.cpp
    (+ 7 more jobs in queue)

    Similar to how it’s done for Kopete message notifications

  7. jamboarder says:

    Hey Jonathan. Thanks for your hard work. Loking forward to Kubuntu 10.04!

    Below is what I did in Bangarang to set my custom context menu:


    Only the contents of myCustomContextMenu show up. 🙂

    Good luck and thanks again!

    • echidnaman says:

      Oha, neat. That’s a bit cleaner than removing that particular action from the action collection.

      Oh, and to be clear, this won’t be a part of 10.04. It’s just too late along in the cycle and print-manager is still in its infancy.

  8. Thanks for all your hard work!

  9. RichiH says:

    Action icons should be generic so that you can recognize the generic action quickly; application icons should be specific so you can recognize the specific application quickly.

    When looking at the icon of the printer applet, I do not see a printer immediately. It takes time and actual effort to see a printer.
    While it looks really sleek, I think a different icon would be better.

    And yes, this is not feedback about the applet per se.

  10. Alexander says:

    Thanks, it’s really great news! When it will to replace current printer-applet which written on python?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: