DescriptiveKeys-0.0.4: A library for specifying xmonad key bindings with functionality.

Safe HaskellNone

XMonad.Config.DescriptiveKeys

Contents

Description

Specify your key-bindings with a description and zero or more tags, then add a key-binding to search through them.

Synopsis

Usage

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

    import XMonad.Config.DescriptiveKeys

Create an instance of DescriptiveKeys by annotating key-bindings with a description and list of tags.

     myDescriptiveKeys = wKeys $ \c -> [(modMask c, xk_z, spawn "xclock"), "opens xclock", ["open", "xclock"]

Modify your XConfig with a configuration combinator. Following is the simplest.

     myXConfig = defaultHelpPromptAndSet myDescriptiveKeys myXPConfig xConfig

This will set the keys property of the XConfig and a key-binding of mod-F1 to search.

newtype Description Source

Wraps an optional string to denote a description for a key-binding.

Constructors

Description (Maybe String) 

data DescriptiveKey Source

The data structure that denotes an annotated key-binding.

Constructors

DescriptiveKey 

defaultDescriptiveKey :: ButtonMask -> KeySym -> X () -> DescriptiveKeySource

A default key-binding that has no description or tags.

DescriptiveKeys data structure

data DescriptiveKeys Source

A list of descriptive key-bindings that have access to the XConfig.

descriptiveKeys :: (XConfig Layout -> [DescriptiveKey]) -> DescriptiveKeysSource

Construct a list of descriptive key-bindings.

wKeys :: (XConfig Layout -> [(KeyMask, KeySym, X (), String, [String])]) -> DescriptiveKeysSource

Construct a list of descriptive key-bindings by specifying the description as a string and the tags as a list of strings.

setDescriptiveKeys :: DescriptiveKeys -> XConfig l -> XConfig lSource

Sets the keys property of the given XConfig with the given descriptive key-bindings.

Tags

newtype Tag Source

Wraps a string to create a tag.

Constructors

Tag String 

Instances

type Tags = Set TagSource

A set of tags.

allTags :: XConfig Layout -> DescriptiveKeys -> TagsSource

Returns all the tags for a given list of key-bindings.

newtype SearchTags Source

How to produce a set of tags from a string, which will likely come from user-input.

Constructors

SearchTags 

Fields

searchTags :: String -> Tags
 

defaultSearchTags :: SearchTagsSource

Splits a string by spaces to produce a set of tags.

filterTags :: Tags -> DescriptiveKeys -> DescriptiveKeysSource

Removes all descriptive key-bindings that are not in the given set of tags.

Pretty-printing the key description

data DescriptiveKeysPP Source

A pretty-printer for descriptive key-bindings.

defaultDescriptiveKeysPP :: DescriptiveKeysPPSource

A plain-text pretty-printer that takes particular care of mod/mask keys and spacing.

The prompt text when searching

newtype SearchTextPrompt Source

The prompt text when searching

Constructors

SearchTextPrompt String 

defaultSearchTextPrompt :: SearchTextPromptSource

The default search prompt, Search key-bindings

The action to take to describe the keys

newtype DescribeKeys Source

The action to take to describe key-bindings from a string user-input.

Constructors

DescribeKeys 

Fields

describeKeys :: String -> X ()
 

defaultDescribeKeys :: DescriptiveKeys -> XConfig Layout -> DescribeKeysSource

A default that opens xmessage and uses the default pretty-printer.

Configuration

data HelpPromptConfig Source

The attributes required to do the final configuration of the descriptive key-bindings.

Constructors

HelpPromptConfig 

Fields

descriptiveHelp :: DescriptiveKeys

The descriptive key-bindings.

xpConfigHelp :: XPConfig

The XPConfig that is used.

keyHelp :: (ButtonMask, KeySym)

The key-binding to prompt the user to search.

searchTextHelp :: SearchTextPrompt

The search text prompt.

describeHelp :: DescribeKeys

The action to take after string user-input.

helpPrompt :: (XConfig Layout -> HelpPromptConfig) -> XConfig l -> XConfig lSource

Sets the help prompt on the given XPConfig.

helpPromptAndSet :: DescriptiveKeys -> XPConfig -> (ButtonMask, KeySym) -> SearchTextPrompt -> (XConfig Layout -> DescribeKeys) -> XConfig l -> XConfig lSource

Sets the help prompt on the given XPConfig and sets the keys attribute.

defaultHelpPromptAndSet :: DescriptiveKeys -> XPConfig -> XConfig l -> XConfig lSource

Sets the help prompt on the given XPConfig and sets the keys attribute with a default key-binding of mod-F1, default search text prompt and using xmessage to provide the descriptive response.