[xmonad] The future of PerWorkspace

Andrea Rossato mailing_list at istitutocolli.org
Thu Jan 31 08:02:08 EST 2008

On Wed, Jan 30, 2008 at 07:29:58PM -0500, Brent Yorgey wrote:
> Hi all!
> This may end up being a long e-mail.  Executive summary:
>   1. PerWorkspace is an inelegant hack with several icky problems:
>      - 'description' is not in the X monad so can't figure out the
>        current workspace
>      - the currently focused workspace might not even be the correct
>        one anyway, in the case of xinerama or message handling.


perhaps there's something deeper I just don't get, but as far as I
understand your problem comes from the fact that you do not know in
which workspace you're handling a message.

This is a quite trivial patch that just gives you a method for that:
Thu Jan 31 13:42:23 CET 2008  Andrea Rossato <andrea.rossato at unibz.it>
  * Add handleMessageInWorkspace, a method that knows where to be
    M ./XMonad/Core.hs +3
    M ./XMonad/Operations.hs -2 +2

which adds:
handleMessageInWorkspace :: Workspace i (layout a) a -> SomeMessage -> X (Maybe (layout a))

as you see it is implemented on top of handleMessage, which means no
one would notice its introduction, but layout combinators may find
this method quite powerful.

Actually I'm not going to ask this patch to be included in the core,
I'm even opposing it: since the combinator class has gone, I'd
strongly discourage people from writing combinators on top of the
layout class. The code is mostly boilerplate buggy stuff, which will
just make you crazy when an API change is needed.

I had the idea of writing that class just because my class clean up
has been a nightmare just because of those combinators (well, David's
one are actually an example of clearness, and I used them to conceive
and develop the class).

But, as I said, probably I'm just missing something deeper I cannot

Just my 2 cents,

-------------- next part --------------

New patches:

[Add handleMessageInWorkspace, a method that knows where to be
Andrea Rossato <andrea.rossato at unibz.it>**20080131124223] 
> {
hunk ./XMonad/Core.hs 224
     -- | 'emptyLayout' is called when there is no window.
     emptyLayout :: layout a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a))
     emptyLayout _ _ = return ([], Nothing)
+    handleMessageInWorkspace :: Workspace i (layout a) a -> SomeMessage -> X (Maybe (layout a))
+    handleMessageInWorkspace w  = handleMessage (layout w)
     -- | 'handleMessage' performs message handling for that layout.  If
     -- 'handleMessage' returns Nothing, then the layout did not respond to
hunk ./XMonad/Operations.hs 333
 sendMessage :: Message a => a -> X ()
 sendMessage a = do
     w <- W.workspace . W.current <$> gets windowset
-    ml' <- handleMessage (W.layout w) (SomeMessage a) `catchX` return Nothing
+    ml' <- handleMessageInWorkspace w (SomeMessage a) `catchX` return Nothing
     whenJust ml' $ \l' -> do
         windows $ \ws -> ws { W.current = (W.current ws)
                                 { W.workspace = (W.workspace $ W.current ws)
hunk ./XMonad/Operations.hs 343
 sendMessageToWorkspaces :: Message a => a -> [WorkspaceId] -> X ()
 sendMessageToWorkspaces a l = runOnWorkspaces $ \w ->
    if W.tag w `elem` l
-      then do ml' <- handleMessage (W.layout w) (SomeMessage a) `catchX` return Nothing
+      then do ml' <- handleMessageInWorkspace w (SomeMessage a) `catchX` return Nothing
               return $ w { W.layout = maybe (W.layout w) id ml' }
       else return w


[Get version from the Paths_xmonad module generated by Cabal
Daniel Neri <daniel.neri at sigicom.se>**20080129144037
 No need to bump version in more than one place.
[Kill stale xmonad 0.1 comments
Spencer Janssen <sjanssen at cse.unl.edu>**20080128211418] 
[Point to 0.6 release of contrib
Spencer Janssen <sjanssen at cse.unl.edu>**20080128101115] 
[notes on releases
Don Stewart <dons at galois.com>**20080128171012] 
[bump output of --version
Don Stewart <dons at galois.com>**20080128170840] 
[Generalize the type of catchIO, use it in Main.hs
Spencer Janssen <sjanssen at cse.unl.edu>**20080128054651] 
[clarify copyright
Don Stewart <dons at galois.com>**20080108185640] 
[TAG 0.6
Spencer Janssen <sjanssen at cse.unl.edu>**20080127220633] 
[More other-modules
Spencer Janssen <sjanssen at cse.unl.edu>**20080127220152] 
[Update example config
Spencer Janssen <sjanssen at cse.unl.edu>**20080127212331] 
[Bump version to 0.6
Spencer Janssen <sjanssen at cse.unl.edu>**20080127205000] 
[Updated ./man/xmonad.1.in to contain new command line parameters
Austin Seipp <mad.one at gmail.com>**20080122070153] 
[Depend on QuickCheck < 2 when building tests
Spencer Janssen <sjanssen at cse.unl.edu>**20080122070225] 
[Roll testing into the main executable, use Cabal to build the tests
Spencer Janssen <sjanssen at cse.unl.edu>**20080119091215] 
[Add emptyLayout to LayoutClass, a method to be called when a workspace is empty
Andrea Rossato <andrea.rossato at unibz.it>**20080124013207] 
[Simplify duplicate/cloned screen logic
Spencer Janssen <sjanssen at cse.unl.edu>**20080118032228] 
[Put the screen removing stuff in getCleanedScreenInfo
Joachim Breitner <mail at joachim-breitner.de>**20071231181556] 
[Ignore cloned screens
Joachim Breitner <mail at joachim-breitner.de>**20071231180628
 This patch ignores screens that are just clones of existing ones,
 or are completely contained in another. Currently only for rescreen, not yet for
 xmonad start.
[-Werror when flag(testing) only
Spencer Janssen <sjanssen at cse.unl.edu>**20080118014827] 
[Export doubleFork
nicolas.pouillard at gmail.com**20080114202612] 
[reword comment (previous version didn't make sense to me)
Lukas Mai <l.mai at web.de>**20071122165925] 
[The recompile function now returns a boolean status instead of ().
nicolas.pouillard at gmail.com**20080105225500] 
[Make focus-follows-mouse configurable
Spencer Janssen <sjanssen at cse.unl.edu>**20071229023301] 
[Strictify all XConfig fields, gives nice error messages when a field is forgotten on construction
Spencer Janssen <sjanssen at cse.unl.edu>**20071229021923] 
Spencer Janssen <sjanssen at cse.unl.edu>**20071229021628] 
Spencer Janssen <sjanssen at cse.unl.edu>**20071229021519] 
[Broadcast button events to all layouts, fix for issue #111
Spencer Janssen <sjanssen at cse.unl.edu>**20071227080356] 
[Config.hs: too many users seem to be ignoring/missing the polite warning not to modify this file; change it to something a bit less polite/more obvious.
Brent Yorgey <byorgey at gmail.com>**20071220201549] 
[Remove desktop manageHook rules in favor of ManageDocks
Spencer Janssen <sjanssen at cse.unl.edu>**20071222113735] 
Spencer Janssen <sjanssen at cse.unl.edu>**20071222041151] 
[Add support for several flags:
Spencer Janssen <sjanssen at cse.unl.edu>**20071222020520
  --version: print xmonad's version
  --recompile: recompile xmonad.hs if it is out of date
  --force-recompile: recompile xmonad.hs unconditionally
[Remove getProgName capability from restart, we don't use it anymore
Spencer Janssen <sjanssen at cse.unl.edu>**20071219215011] 
[Flush pending X calls before restarting
Spencer Janssen <sjanssen at cse.unl.edu>**20071219162029] 
[Allow for sharing of home directory across architectures.
tim.thelion at gmail.com**20071218065146] 
[Call 'broadcastMessage ReleaseResources' in restart
Spencer Janssen <sjanssen at cse.unl.edu>**20071219065710] 
[Manpage now describes config in ~/.xmonad/xmonad.hs
Adam Vogt <vogt.adam at gmail.com>**20071219023918] 
[Update manpage to describe greedyView
Adam Vogt <vogt.adam at gmail.com>**20071219023726] 
[Depend on X11-1.4.1, it has crucial bugfixes
Spencer Janssen <sjanssen at cse.unl.edu>**20071215022100] 
[1.4.1 X11 dep
Don Stewart <dons at galois.com>**20071214160558] 
[Set withdrawnState after calling hide
Spencer Janssen <sjanssen at cse.unl.edu>**20071212060250] 
[Remove stale comment
Spencer Janssen <sjanssen at cse.unl.edu>**20071211084236] 
[Make windows responsible for setting withdrawn state
Spencer Janssen <sjanssen at cse.unl.edu>**20071211080117] 
[Remove stale comment
Spencer Janssen <sjanssen at cse.unl.edu>**20071211075641] 
[Clean up stale mapped/waitingUnmap state in handle rather than unmanage.
Spencer Janssen <sjanssen at cse.unl.edu>**20071211074810
 This is an attempt to fix issue #96.  Thanks to jcreigh for the insights
 necessary to fix the bug.
[Delete windows from waitingUnmap that aren't waitng for any unmaps
Spencer Janssen <sjanssen at cse.unl.edu>**20071211074506] 
[man/xmonad.hs: add some documentation explaining that 'title' can be used in the manageHook just like 'resource' and 'className'.
Brent Yorgey <byorgey at gmail.com>**20071210173357] 
[normalize Module headers
Lukas Mai <l.mai at web.de>**20071210085327] 
[Add 'testing' mode, this should reduce 'darcs check' time significantly
Spencer Janssen <sjanssen at cse.unl.edu>**20071210004704] 
[Use XMonad meta-module in Main.hs
Spencer Janssen <sjanssen at cse.unl.edu>**20071210004456] 
[TAG 0.5
Spencer Janssen <sjanssen at cse.unl.edu>**20071209233044] 
Patch bundle hash:

More information about the xmonad mailing list