[xmonad] How to prefix workspace names with numbers?

Pablo Olmos de Aguilera C. pablo at glatelier.org
Tue Oct 9 06:04:15 CEST 2012

On 8 October 2012 19:17, Hans Chen <hanswchen at gmail.com> wrote:
> Hi,
> I'm a new xmonad user, and despite knowing next to no Haskell, I've made
> xmonad work pretty much the way I want it. Fantastic!
> Now there's only one major thing I miss. Let's get to the point before
> boring you with rationales; I want DynamicLog to prefix my workspace names
> with a number, e.g. "web", "chat", "work" becomes "1:web", "2:chat",
> "3:work". I found a previous discussion[1] in the mailing list and a zsh
> script[2], but I would like to do it directly in xmonad.hs, presumable where
> I define my PP. (I use dzen2 to display the workspace names, if it makes any
> difference).
> My PP is pretty standard, you can find it here: http://paste.kde.org/564734/
> So why do I want this? I use DynamicWorkspaces to create and delete
> workspaces on the fly, but still prefer to use Mod(+shift)+<number> to
> switch and move windows between workspaces. This is a bit hard, however,
> without a number next to the workspace name. I know that you can bind a key
> to selectWorkspace, but I find it faster to switch using the traditional
> method when you don't have many workspaces.
> I'm using xmonad 0.10 and xmonad-contrib 0.10, but I guess I wouldn't mind
> trying out darcs if it's needed.
> Help would be very much appreciated!
> With best regards,
> Hans
> ----
> [1] http://www.haskell.org/pipermail/xmonad/2010-January/009683.html
> [2] http://www.haskell.org/pipermail/xmonad/2010-February/009690.html

I'm not directly answering your question, but I'll try to help you
solve your problem.

First, I'd question myself why I would want to create workspaces on
the fiy :P, and then "keep them" enough time to make your issue
relevant. I always imagined dynamicworkspaces as a complement to
create "short-lived" workspaces. Also, if you are creating the same
(or similar) workspaces every time... maybe there isn't really a good
reason to create them on the fly.

In my case I keep 7 "fixed" WS:

1:terms, 2:web, 3:coding, 4:files, 5:media, 6:various, 7:im.

They are called that way, so it's easy to use the number to jump
between them and then I create/rename/remove "dynamic" ones in case
are needed.

Another module that helps (a lot) in jumping/moving between workspaces
are X.A.CycleRecentWS and X.A.CycleWS, I think you should take a look

Pablo Olmos de Aguilera Corradini - @PaBLoX
Linux User: #456971 - http://counter.li.org/

More information about the xmonad mailing list