0

Say I have an XMonad layout that I named "foo" via XMonad.Layout.Renamed.

I've got a keybinding that I would like bound to a different X () depending on the current layout of the focused workspace. For example, something along the lines of:

case () of
() | currentLayoutName == "foo" -> fooAction
   | otherwise                  -> barAction

..but how can I implement currentLayoutName?

Oh Fiveight
  • 299
  • 1
  • 9

1 Answers1

1

Just traverse down the StackSet to the current workspace to the layout description.

-- Imports
…
import qualified XMonad.StackSet as W
…

-- Key bindings
…
, ((modm, xK_F1), do
    wset <- gets windowset
    let ldesc = description . W.layout . W.workspace . W.current $ wset
    case ldesc of
        "foo" -> fooAction
        _     -> barAction
  )
…
pmf
  • 24,478
  • 2
  • 22
  • 31
  • Exactly what I was looking for. I did not understand how `StackSet` was structured well enough, but this cleared it right up for me. – Oh Fiveight Apr 28 '23 at 20:05