[xmonad] FR: Workspace cursors

Adam Vogt vogt.adam at gmail.com
Tue Apr 28 00:30:11 EDT 2009

* On Monday, April 27 2009, Russell Adams wrote:

>Here's another idea that had been tossed around on IRC, a list of
>workspace "cursors". This was born from a discussion regarding
>Enlightenment virtual desktops, and on further inspection it turns out
>that simulating a cursor was the real feature.
>When maintaining a large list of workspaces, navigating between them
>is an issue. Having a list of pointers or cursors that could be
>accessed quickly (single keypress bound) or linearly (next/prev
>cursor) would be useful to "jump" between tasks.
>The idea would be that given an array of cursors, the current cursor
>is constantly updated with the current workspace. Changing to another
>cursor jumps to its last known location and it becomes the new current
>You could get fancy and change the array boundchecking to use the
>length of the array, or make it a ring and just loop (nice idea).

I'm not sure if XMonad.Actions.TopicSpace came up in the discussion, but it 
does some of what you want because it keeps track of the previously viewed 
workspaces, and has keybindings to the n'th last viewed workspace.

So with a binding like:

> [ ((modm, k), switchNthLastFocused myTopicConfig i) | (i, k) <- zip [1..] [xK_1 .. xK_9]]

Lets you cycle the view among the last n+1 other workspaces by repeatedly
calling that action.

Ex. M-4 will cycle the last 5 workspaces (but only in one direction, though 
I suspect that the list of recently visited workspaces could be modified to 
make the other direction possible)

The Stack datatype from XMonad.StackSet is a functional way to implement a 
cursor on an array (and is never out of bounds). That module already 
exports functions for the wrapping case.

You can keep track of the state as above (ex. in an IORef, or in X11 as 
TopicSpace does).


More information about the xmonad mailing list