Getting Email Done: The Stack and the Heap of Lion Mail

In my previous article on this subject, I have introduced Akonadi as the personal information beehive on your computer, explained how it works, how it is designed and what the migration process to an Akonadi-based Kontact looks like. (openSUSE users should also take a look here.) In this article, I will dive into the workspace parts we’re introducing on top of Akonadi, notably the new email notifier system in Plasma – Lion Mail.
The Lion Mail email notifier is at its base your "you’ve got mail" icon in the panel. For users with more complex and high-traffic email habits, it offers a basic set of workflow tools to manage the daily stream of emails more efficiently and ergonomically. In this article, I’m describing some of the design concepts behind Lion Mail’s email notifier and its workflow features.

In the panel, you can quickly see if there are new emailsComplex email workflows are something I wanted Lion Mail to excel at. The idea is to make dealing with email as flexible as we can, so you can project your workflow onto it and have it make the daily flow of email more manageable, and less disturbing in the real work you want to get done. By default, the Lion Mail email notifier shows up in your panel when a new email arrived in your inbox, by clicking on it you can access the list of your latest unread emails in a small popup-window. The basic use-case is quickly checking if you’ve got new email. I will not dive too much into implementation details, as this article is all about work-flows and how it affects the user experience.

The idea is that, at all times you can see if there’s email to deal with. but not have it jump in your face. In order to be able to quickly dismiss something as "I’ll deal with that one later", or "ok, got it", there’s two queues in Lion Mail, the stack and the heap of Lion Mail.

The Stack — Incoming Emails

The popup shows a list of the new emailsThe stack is your incoming emails queue, it lists new emails in one or more folders. By default, that’s your inbox, but you can configure it to monitor any folders you like (yes, combining them from multiple folders is built-in). The incoming emails queue is a transient thing, it’s your stream of incoming emails, and the first time a new email gets your attention (but doesn’t shout for it). The stack allows you to dismiss new emails, or mark them as read or important. The idea is that new emails might fall into the following categories:

  • "Not right now" – A new email will get your attention later. You take notice of its existence now, but don’t have time right now to tend to it. It stays marked as unread, you’ll get back to it later.
  • "This I really have to deal with, later" — If you don’t respond to this email, the world implodes into dark matter, or your head gets torn off by zombie-chinchillas. You mark the email as important, for extra attention, you can leave it marked as unread.
  • "I am bored enough" — An email you deal with right away, either because it’s important or more interesting than what you’re currently doing, or maybe because it’s quicker to reply right now. In those cases, you open the email in your mail client to read it and possibly reply.
  • "OK" — You notice an email and know enough by peeking at it. It can drown in your inbox from here on, you mark it as read.
  • "v14gra on loan" – Something slipped the spam filters. You just want it gone. You hit the delete button and it won’t bother you again.

These are a couple of possible reactions to new emails. By offering the tools to deal with such situations at hand, in the context of these incoming emails, we can pre-sort the stream of mail while we receive it.

The Heap — Important Emails

Important emails are accessible in a separate listThis is where the heap comes in. The heap is an optional second list of emails you can show in the Lion Mail email notifier. It simply shows the important emails in your monitored folders. This way, it offers you a list of things you need to deal with, in essence your to-do list of emails. By putting them into a separate list, we have two overlapping categories of emails you want to deal with. Lion Mail can either display those important emails in a combined list, or using separate tabs for new and important emails. The latter is likely to appeal to David Allen fans, Lion Mail certainly is inspired by some of his ideas.

In the setup you can specify which folders to monitor and wether or not to show important emails

Email Items

The individual email items in the heap or stack offer a couple of options to open emails in your mail client, for marking emails as read and as important, and for deleting it. Needless to say that these buttons operate directly on the email, so the moment you mark an email in Lion Mail, it’ll change in KMail (or any other Akonadi-based email client) as well. When an email doesn’t satisfy the criteria for the heap of stack anymore, it fades out over a period of 5 seconds, so you get some "undo grace-time" if you clicked wrongly. The emails themselves show by default subject, sender, date and flags, you can expand to show some of the body as well. Email items employ a hover interface, when you move the mouse over an email, it reveals three controls as an overlay which offer flagging and trashing an email. Clicking on the icon opens the email in your mail client, you can also drag an email from these lists into your email client or Plasma workspace. I’ve chosen for a hover interface mainly for two reasons: less clicks and more discoverability. The emails don’t have a context menu right now, but there are a couple of useful options we could add there, for example forwarding or replying.

Emails can be sorted using flags directly from the popup

Excerpts — NLP people, listen up!

If someone comes up with a clever and useful implementation for email excerpts, I’m all open. Right now, I’m just showing the first couple of hundred characters in order to not blow the size of the widget beyond what’s reasonable in a small popup. As you can deduct, I’m not the most inspired mind in the world of language processing. In the UI, I’d rather avoid having to use scroll bars inside the expanded email body, as the list already might have scroll-bars. Nested scroll-bars will lead to annoying behaviour for mouse-wheel and flick-scrolling, so that should be avoided. The most elegant thing to do here is excerpting the interesting parts of the email, by skipping empty lines and possibly line-breaks, by removing reply-quoted parts, and so on. K9-Mail (a really good email client for Android) does this quite well, it’s often possible even from one line to judge an email’s content. We can easily fit 5 lines into the expanded email widget, and possibly even more, so I’d expect that with the right algorithm, we could do excellent there. If you’re into that kind of stuff, send me a piece of code that turns an email body (as QString, if you want) into a 200-300 character long excerpt, it should be LGPLed code and you’ll be properly credited. Sounds like a nice small, self-contained hacking project for a fall evening, no?

Otherwise, I wonder if "the other Sebastian"’s recent Nepomuk accomplishments in excerpting documents play into our collective hands, or we’re in his of course. :-)

Emails as first-class citizens in your workspace

There’s if course a lot more in the pipeline. In principle, Lion Mail can hold any email collection, existing folders, but also virtual collections, such as search folders or combinations of multiple folders. Lion Mail represents itself as an icon in the panel’s notification area, you can enable it in the notification area’s settings. It’s also possible to put Lion Mail widgets on the dashboard, desktop or netbook’s new page, you can of course add multiple Lion Mail applets holding different collections one one or different activities, and this way depending on what you are doing, think of showing your work’s inbox in your "work" activity, showing private emails in your "freetime" activity or showing neither in your hacking activity. In Lion Mail itself, that would be very easy to do, It’s built in mind with showing arbitrary sets of emails, the new email and important email queues are just specialized version of a generic email list.Email lists can be put on the desktop, and switched depending on your activity

Drag and drop is also one of the things that got a little bit of attention while developing Lion Mail. You can drag emails from Lion Mail into KMail for example to move or copy them to another folder. Plasma is also receptive to dropping mails (and in the future mail folders) onto the desktop. Lion Mail includes a Plasma widget showing an individual email. It can take different sizes, so you can either have a bunch of small emails floating around, or individual emails with full text on your desktop or dashboard for reference while working, as it often comes handy to have a related email available for a quick check if you’re looking into something.Single emails can be put on the desktop as well, for quick reference

Release plans and test-driving

In its current state, Lion Mail email notifier is already quite usable. The work to make it release-ready consists of completing some features, refreshing of monitored folders directly from the applet, and trashing emails. There’s also some smaller interaction glitches I’ll fix before it can make its way into Plasma cq. Kontact 4.6.0. There’s suspending removing items under your mouse (or finger) so you don’t accidentally click on the wrong email, some display funkiness here and there (spot the lack of space underneath emails in the screenshots), and the excerpts extraction I invited input to above. You’re already most welcome to try it and give feedback. It’s currently located in playground and will eventually move through the kdereview process into one of the released modules — I haven’t figured out which one would be the most suitable exactly. If you want to build it right now, I have to admit that it’s not completely trivial from scratch, as it requires kdelibs and kdepimlibs from trunk. If you have a reasonably recent 4.6 (trunk) snapshot installed, you should be good to go. Lion Mail does not offer the option to configure email accounts, you can do that from KMail2 or akonadiconsole.

Famous last words

The heap and the stack of Lion Mail offer the opportunity to create a more efficient workflow with your emails. By dealing with emails effectively as they come in, but without a context-switch to the full email application, it offers more workflow-based email management. The underlying idea behind Lion Mail is that emails become first-class object in your user experience, to integrate them as artifacts of your interesting information, rather than banning them into a monolithic application like traditional email clients. "Light-weight email work" can be done directly from the workspace, referencing emails in other tasks becomes a lot easier, the traditional email reader still serves as the work horse for most email reading (as opposed to noticing and referencing). Lion Mail provides the usual feature set in a more elegant and context-rich way. It is also heavily optimized for people with larger amounts of emails, and integration these streams of new and interesting emails deeper into the workflow of the user.

23 thoughts on “Getting Email Done: The Stack and the Heap of Lion Mail

  1. For additional actions, my unified communication UI idea might be useful. From what I read, you’re already awfully close to it on the GUI side :)

    Generic actions you can do with any communication medium:

    * Reply (to the sender)
    * Forward/Resend/Spread to all possibly interested people
    * Fave/Remember (publicly/privately)

    and Write New/Send/Post

    What it means for mail:

    * Reply: to sender or to all.
    * Forward: Select from lists or addresses. Have a configurable default list by topic/tag.
    * Fave/Remember: Put into a specified folder, maybe also tag.

    1. These more specialised or “extra” options would be too much in the hover overlays, but probably make a lot of sense in context menu of email items (which is something I’m planning to implement as well).

      As to whether or not to turn Lion Mail into an “all communications hub”, that is indeed one possible direction to take it. I’ve kept this case in mind while developing, and as a result its design is very suitable for this kind of thing. The way to go here would probably be creating individual widgets (such as the email one) for types of messages (tweets, notices on forums, emails, IM, IRC messages, etc.).

  2. Surely for a mail that has slipped through spam filters hitting “delete” is not an appropriate response…presumably the filtering is of a Bayesian nature so ought we not to train the filter by alerting it that it missed a spam item?

    1. There’s a balance that we need to make here. On the one hand, marking a message as spam might prevent similar emails from popping up in your face. I’ve thought a bit about this problem as well, and probably Mark as Spam is one of those options I’d put in a context menu, but not in the primary UI as to prevent clutter.

      I agree that it would potentially be very useful, it’s more a matter of how we can present this to the user in an elegant way.

  3. Wow, awesome work!

    I think you should use a monochrome icon for lion mail, just like klipper, neworkmanager, …

    really looking forward to the release

  4. slightliy offtopic: i wish it was possible to have KDE installed without akonadi-server package. there are usecases when user doesnt want them, for example on netbooks. right now removing it triggers removing a package with skartkde script

  5. I had read all of your previous blog entries about Lion Mail and I compiled it once a few months back. But the beauty of what you have accomplished and present here has blown my mind. This is the best thing ever and will most probably save my life and career. I am awful in dealing with the amounts of emails I receive daily. I have often dreamed of such a work flow of sifting through incoming mail and doing quickly solvable tasks right away while leaving the actually challenging tasks for a scheduled and focused effort. This is wonderful!

    Thank you for this amazing application. You are a visionary.

    Cheers, mutlu

  6. Will the following also be possible: dragging an email from KMail and dropping it on the desktop creates an “individual email plasma widget” showing the email?

    1. In short: Yes, that is all completely transparent.

      Let me explain this quickly. Drag and drop works by attaching either data with a certain mimetype to the “mouse cursor” (actually a buffer in X if I recall correctly) and making this data available to the widget it is dropped onto. Akonadi applications such as KMail2 and Lion Mail don’t attach data to the drag, but use akonadi:/ urls. These contain an ID (an int) and a mime-type, for example message/rfc822). (Of course these URLs are only valid on the local machine, since they’re limited to the scope of the local akonadi cache.) The application sees the dropped akonadi:/ URL, it checks its content, and decides based on the mimetype in the URL whether or not to accept the dropped data (indicated by the mouse cursor). It’s in short, passing the items around by reference, rather than copying the data.

      I’ve explained this generic mechanism in Plasma in an earlier blog entry, which you can find here:

      There’s a refinement for Lion Mail, so the .desktop file for the email applet offers itself as “renderer for Akonadi emails” with:


      Likewise, one can implement moving other Akonadi items, such as Contacts, appointments, etc around in Plasma.

      1. So if you drop a message that is part of a thread on the desktop, is just the message placed there, or the whole thread?

        1. Just the message of course.

          I’ve not implemented dropping folders yet, but that’s surely among the possibilities as well. The idea is: messages dropped create individual email items, email folders dropped create mail box plasma widgets like the email list you can see in the screenshots.

  7. for sensible action like “delete mail”, it could be great to have some kind of special buttons where the users must do a “long push” (like 2 seconds) to trigger the action (maybe a normal push could display a “yes/no” dialog box or something). Not sure if this kind of button could find its place in other places in plasma but I kinda like this idea

    1. I find the delay usually good enough, as it allows to roll back from accidental clicks quite easily, and without switching context. If you try it, you’ll find that it feels quite natural as it’s implemented now (you click on the [x] and the item starts fading out over 5 seconds, then collapses, during those 5 seconds it’s fully interactive so you can easily undo by clicking again).

      Whether this UI design pattern is generally applicable is something interesting to think about. A similar problem is currently tackled by Aurelien Gateau for so called “dual-actions”, like the toggles for flags in Lion Mail: should the icon change, or only the press state, should the label in such cases also change? If you start thinking about it, it’s actually quite complex. I’ve right now ‘solved’ it by explaining it in the tooltip, and not changing the icon, but only the sunk state of the toolbutton. It is quite clear this way, though I’m not overly happy with those long tooltips.

  8. As I watch those beautiful screenshots, I see the marvels of border detection (when you click on your clock, and get the Calendar, there are some ugly transparent borders between Calendar and the edge of screen, I can’t see those borders with Lion Mail or the KDE Plasma NetworkManager). Will every plasmoid have this nice border-detection code? Will we ever see a notification (i) icon with such border detection?

    Thanks. And this is pure awesomeness.

  9. That looks fantastic!

    Is it possible, I wonder, to show ’31 new messages’ collapsed into threads?

    1. Glad you like it :-)

      Threading is not implemented, and it would probably not be quite trivial to do it properly. I’m not sure how well it’d work, either, since your emails leave the incoming queue so you end up with large holes in the threads. Maybe grouping would be a cleaner solution here.

  10. Wow,

    This applet alone makes me want to ditch xmonad and go back to kde (yes I know that I can use xmonad and plasma together, but I never got it working well before) and try desktop based email again. I only wonder if kmail plays well with gmails imap already. I know this was something that didn’t work exactly like I wanted it.

  11. Lionmail has many features what I had in mind to post to to brainstorm areas. What I really would love to see is to have emails more like a physical mail.

    You get side of the screen or a nice notification (KNotify is not so nice currently) about email with animated logo (different animations like flpping mail, circling E-Mail -logo or so on, you get the point).

    And the received emails would be someway nicely stacked or hided until you check the “stack”.

    You said: “It’s also possible to put Lion Mail widgets on the dashboard, desktop or netbook’s new page, you can of course add multiple Lion Mail applets holding different collections one one or different activities, and this way depending on what you are doing, think of showing your work’s inbox in your “work” activity, showing private emails in your “freetime” activity or showing neither in your hacking activity.”

    Personally I don tlike that widget is a button in panel but when it is on desktop/dashboard it is a fullsized view. Example with KickOff menu, you can not place it anywhere else than to panel itself. When it is placed to desktop/dashboard, it takes the space as it would take when it is open.

    What is needed, is to have a button-only function. So you get KickOff menu or now, a LionMail button what you can resize and move or choose what icon to use on it when there is no new email and when there is new email. And when you click the button, you get pop-up list and it stays open until you click again to close it (and optional timeout after the mouse have left it).

    But what I really, really REALLY want to see, is a folderview support. Think about it. You have multiple folder views on desktop/dashboard. But one is empty. Topic says “Received emails”. When you get a email, the email gets added as a letter icon and text would be just the subject.

    And then later printing a email would be as easy as just draggin and dropping the email to printer icon or clickin “print” button.

    But to get whole plasma actually better, it would need support animations. Currently the lack of good widget locking does not allow interactive and usable desktop unless user likes to keep plasma all the time unlocked. Like you can not drag a folder or file to desktop. A URL from browser addressbar to desktop or even a image to get it as wallpaper. Everything demans you have desktop unlocked.

    Think about how you click a email icon and it would nicely transform to letter or bigger size. Or something.

    * Need to go pull lionmail now

Comments are closed.