XMonad.Actions.MessageFeedback

xmonad-contrib-0.13: Third party extensions for xmonad

Copyright | (c) Quentin Moser <moserq@gmail.com>
License | BSD3
Maintainer | orphaned
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Actions.MessageFeedback

Contents

- Usage

Description

Alternative to `sendMessage` that provides knowledge of whether the message was handled, and utility functions based on this facility.

Synopsis

- send :: Message a => a -> X Bool
- tryMessage :: (Message a, Message b) => a -> b -> X Bool
- tryMessage_ :: (Message a, Message b) => a -> b -> X ()
- tryInOrder :: [SomeMessage] -> X Bool
- tryInOrder_ :: [SomeMessage] -> X ()
- sm :: Message a => a -> SomeMessage
- sendSM :: SomeMessage -> X Bool
- sendSM_ :: SomeMessage -> X ()

# Usage

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

    import XMonad.Actions.MessageFeedback

You can then use this module's functions wherever an action is expected.

Note that most functions in this module have a return type of `X Bool` whereas configuration options will expect a `X ()` action. For example, the key binding

    -- Shrink the master area of a tiled layout, or move the focused window
    -- to the left in a WindowArranger-based layout
    ((modKey, xK_Left), tryMessage Shrink (MoveLeft 50))

is mis-typed. For this reason, this module provides alternatives (ending with an underscore, e.g. tryMessage_) that discard their result and return an `X ()`. For example, to correct the previous example:

    ((modKey, xK_Left), tryMessage_ Shrink (MoveLeft 50))

send :: Message a => a -> X Bool #

Behaves like `sendMessage`, but returns True of the message was handled by the layout, False otherwise.

tryMessage :: (Message a, Message b) => a -> b -> X Bool #

Sends the first message, and if it was not handled, sends the second. Returns True if either message was handled, False otherwise.

tryMessage_ :: (Message a, Message b) => a -> b -> X () #

tryInOrder :: [SomeMessage] -> X Bool #

Tries sending every message of the list in order until one of them is handled. Returns True if one of the messages was handled, False otherwise.

tryInOrder_ :: [SomeMessage] -> X () #

sm :: Message a => a -> SomeMessage #

Convenience shorthand for `SomeMessage`.

sendSM :: SomeMessage -> X Bool #

sendSM_ :: SomeMessage -> X () #