[Xmonad] dynamic workspaces, session restore

Andy Gimblett A.M.Gimblett at swansea.ac.uk
Tue Oct 16 09:50:15 EDT 2007


On Tue, Oct 16, 2007 at 04:22:17PM +0300, Valery V. Vorotyntsev wrote:
> 
> 1) Fixed number of workspaces is too inflexible and somewhat ugly, IMO.
> 
>    What about creating workspaces by demand, instead? The same way
>    `ion' does to workspaces or screen to its "windows".

IMHO you can get very close already, and probably to the point where
you have all the behavious you want.  (Unless there's something you
want I can't think of.)

What I mean is: for a given compilation of xmonad, yes, there is
indeed an upper bound on the number of workspaces available.  However,
at compile time you can set that upper bound to be anything you want
(so it is in some sense unbounded), and at runtime you can easily only
care about the ones with contents.  I'm not sure what else "creating
workspaces by demand" would give you on top of that.

For arbitrarily-sized workspace pools at compile-time, modify
Config.hs:

  -- 99 workspaces
  workspaces = map show [1 .. 99 :: Int]

  -- 999 workspaces
  workspaces = map show [1 .. 999 :: Int]

  etc.

(I admit I haven't tried this, but it's clear it's possible.  Of
course, it makes moving to a particular workspace more interesting
(keybindings, etc.), but you'll have that problem anyway with
arbitrarily created workspaces.)

When I say "you can easily only care about the ones with contents" I
mean: using the dynamicLog and RotView contrib modules, I see and move
about in a list of the workspaces with things in them, which grows if
I send something to a new workspace, and shrinks if I empty a
workspace - so I have the appearance of a constantly growing and
shrinking set of workspaces.  Their names happen to be in the range
0-9 but that range could be made bigger.  In practice I never need
more than 9, but the possibility is there.  It really is a lot like
having them created/disposed of on demand, and works quite seamlessly
for me at least.  It's definitely the closest thing to virtual desktop
perfection I've yet experienced.

(I believe there's also a way to assign names to workspaces, though I
haven't felt the need to try it out.  That might be one possible
advantageous side-effect of on-demand workspaces, but OTOH, thinking
of my wmii days, having to think of names for workspaces would
probably slow me down.  ;-) )

Just some random possibly-useful thoughts...

Cheers!

-Andy

-- 
Andy Gimblett
Computer Science Department
University of Wales Swansea
http://www.cs.swan.ac.uk/~csandy/


More information about the Xmonad mailing list