Jérôme Belleman
Home  •  Tools  •  Posts  •  Talks  •  Travels  •  Graphics  •  About Me

Notification Sinks in Notion

9 Jun 2013

I devised a simple mechanism with this window manager to non-intrusively open notifications. One of these delightfully useful things Notion makes easy.

1 The Idea

The idea is to keep a frame dedicated to those notifications, and to send them all there by opening a window for each of them. This prevents stealing the focus or masking a portion of the screen you might be looking at. Instead, you will be appropriately notified that something happened in that frame, since opening a window which doesn't currently have focus triggers a notification, e.g. with the name of the window appearing with a red banner in the bottom-left corner of the screen. Hit Mod1 k k and Notion will take you straight to it.

Since each notification has a window of its own, you will be able to manage them the way you always comfortably manage windows with Notion: you will be able to page through them, move them to other frames, close them once you're done with them.

This approach is simple, reliable and only relies on familiar concepts. You get an easy-to-use, yet versatile notification system for free.

2 Implementation on the Notion Front

Notion offers the concept of winprops which can alter the way specific windows are handled. The documentation says about the winprop target that it specifies the object that should manage the window. For a frame, this means which one the window should go to. It is therefore suitable for a sink.

I defined the notsink.set() function which sets the notification sink status to the current frame. In effect, this means giving it the notsink name:

ioncore.current():set_name('notsink')

You could have notsink.set() mapped to key bindings or even have it automatically run for a given frame when Notion starts up. In my Notion setup, I chose to add an entry to the mainmenu to call it:

defmenu("mainmenu", {
    menuentry("setnotsink", "notsink.set()"),
})

Define a new winprop to have all windows called notsink (instances) be managed by the frame called notsink (the target).

defwinprop{
    instance = 'notsink',
    target = 'notsink',
}

3 Implementation on the Notification Windows Front

You could use simple terminal emulators to open windows for each of your notification. This would work well because several of them (xterm, urxvt, ...) share the -name option to which you could pass notsink to drive them to the notification sink frame. This is what I did for instance with the Remind calendar to open a window called notsink for each due event.

4 References