While an implementation of `liftM2 (&&)` may seem like a straightforward
lift of `(&&)` into a monadic setting, it actually expands to
(<&&>) :: Monad m => m Bool -> m Bool -> m Bool
mb <&&> mb' = do
a <- mb
b <- mb'
return (a && b)
which runs both monadic effects first and then applies `(&&)`.
This is fixed by introducing a monadic version of `if-then-else` (which
is also exported due to its usefulness) that checks the second result
only if this is explicitly necessary.
Turns out there was another aspect of `broadcastMessage` behaviour that
I missed in my review of the refactor: X.L.Tabbed updates the windowset
during handleMessage (via `X.O.focus`) and expects that change to
persist (by returning `Nothing` and hoping no other layout or layout
modifier returns `Just`). That's quite a hack, but the LayoutClass
interface doesn't allow a cleaner way to do this (well, some extensible
state plus a custom event hook might work, but then the layout isn't
self-contained any more).
And since rereading workspace layouts during `modifyLayouts` would force
this back into O(n²), we might as well revert the whole refactor. :-/
Fixes: https://github.com/xmonad/xmonad/issues/329
We now use this in `broadcastMessage`, so to not change which workspaces
get the message first, we need to change the order here. This wouldn't
normally be safe to do either, but there are no other uses of
`runOnWorkspaces` neither here nor in xmonad-contrib, so it should
actually be fine.
This uses two new functions (not exported):
`workspacesA` traverses the workspaces in a StackSet.
`runOnWorkspaces` runs `workspacesA` with the X state.
The current definition of broadcastMessage seems to be O(n^2) in the number of workspaces because it uses sendMessageWithNoRefresh and sendMessageWithNoRefresh uses updateLayout and updateLayout uses runOnWorkspaces.
This changes broadCastMessage and sendMessageWithNoRefresh to each use a single
call to runOnWorkspaces.
`executeFile` encodes the arguments with the current locale's encoding,
and GHC as invoked during recompilation quite likely also outputs any
errors in the locale encoding, which we then read using `readFile` again
decoding in the locale encoding, so it really makes no sense to force a
specific encoding here. What was I thinking? :-)
Related: https://github.com/xmonad/xmonad/issues/322#issuecomment-900503386
Fixes: https://github.com/xmonad/xmonad/issues/324
Fixes: aa35ea1856 ("Make xmessage handle UTF-8 and export it")
When `stack build --silent` fails, the output is not helpful at all:
Errors detected while compiling xmonad config: /home/slot/.config/xmonad/xmonad.hs
ExitFailure 1
Please check the file for errors.
And even in other circumstances it's helpful to see the command that was
executed, as it makes it easy for the user to diagnose what's wrong.
That's where they belong. As XDG was more or less broken in previous
xmonad releases, we can assume few people use it so now's the best time
to move files around.
For users of `~/.xmonad`, this only causes intermediate outputs (.o,
.hi) to go elsewhere.
Fixes: https://github.com/xmonad/xmonad/issues/178
Some layout and layout modifiers that keep track of some window
properties don't do garbage collection and update their state when
windows are destroyed. By broadcasting this event, it should be easier
for layouts to clean up
Related: https://github.com/xmonad/xmonad-contrib/pull/474