xmonad-contrib-0.17.1: Community-maintained extensions for xmonad

Copyright | (c) Wilson Sales 2019
License | BSD3-style (see LICENSE)
Maintainer | Wilson Sales <spoonm@spoonm.org>
Stability | unstable
Portability | unportable
Safe Haskell | Safe-Inferred
Language | Haskell2010

XMonad.Actions.PerWindowKeys

Contents

- Usage

Description

Define key-bindings on a per-window basis.

Synopsis

- bindAll :: [(Query Bool, X ())] -> X ()
- bindFirst :: [(Query Bool, X ())] -> X ()

# Usage

You can use this module with the following in your `~/.xmonad/xmonad.hs`:

     import XMonad.Actions.PerWindowKeys

      ,((0, xK_F2), bindFirst [(className =? "firefox", spawn "dmenu"), (isFloat, withFocused $ windows . W.sink)])

      ,((0, xK_F3), bindAll [(isDialog, kill), (pure True, doSomething)])

If you want an action that will always run, but also want to do something for other queries, you can use ``bindAll` [(query1, action1), ..., (pure True, alwaysDoThisAction)]`.

Similarly, if you want a default action to be run if all the others failed, you can use ``bindFirst` [(query1, action1), ..., (pure True, doThisIfTheOthersFail)]`.

For detailed instructions on editing your key bindings, see XMonad.Doc.Extending.

bindAll :: [(Query Bool, X ())] -> X () #

Run an action if a Query holds true. Doesn't stop at the first one that does, however, and could potentially run all actions.

bindFirst :: [(Query Bool, X ())] -> X () #

Run the action paired with the first Query that holds true.