Skip to content

Instantly share code, notes, and snippets.

@slackcals
Created January 24, 2019 18:36
Show Gist options
  • Save slackcals/0054247ce41edd0aef500dbb8cd3d83d to your computer and use it in GitHub Desktop.
Save slackcals/0054247ce41edd0aef500dbb8cd3d83d to your computer and use it in GitHub Desktop.
How to use "when"
-- from: https://mail.haskell.org/pipermail/xmonad/2009-May/007979.html
logHook = ...other stuff... >> checkKBLayout
...
checkKBLayout :: X ()
checkKBLayout = do
curTag <- gets (W.currentTag . windowset)
when (curTag == "foo") $ spawn "set keyboard layout"
--
--result:
--
xmonad.hs:68:5: error:
* Variable not in scope: when :: Bool -> m0 () -> X ()
* Perhaps you meant `whenX' (imported from XMonad)
|
68 | when ( curTag == "3:browser") $ spawn "xinput --disable 11"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment