Safe Haskell | None |
---|
Specify your key-bindings with a description and zero or more tags, then add a key-binding to search through them.
- newtype Description = Description (Maybe String)
- data DescriptiveKey = DescriptiveKey {
- mask :: ButtonMask
- sym :: KeySym
- action :: X ()
- description :: Description
- tags :: Tags
- defaultDescriptiveKey :: ButtonMask -> KeySym -> X () -> DescriptiveKey
- data DescriptiveKeys
- descriptiveKeys :: (XConfig Layout -> [DescriptiveKey]) -> DescriptiveKeys
- wKeys :: (XConfig Layout -> [(KeyMask, KeySym, X (), String, [String])]) -> DescriptiveKeys
- setDescriptiveKeys :: DescriptiveKeys -> XConfig l -> XConfig l
- newtype Tag = Tag String
- type Tags = Set Tag
- allTags :: XConfig Layout -> DescriptiveKeys -> Tags
- newtype SearchTags = SearchTags {
- searchTags :: String -> Tags
- defaultSearchTags :: SearchTags
- filterTags :: Tags -> DescriptiveKeys -> DescriptiveKeys
- data DescriptiveKeysPP = DescriptiveKeysPP ([DescriptiveKey] -> String)
- defaultDescriptiveKeysPP :: DescriptiveKeysPP
- newtype SearchTextPrompt = SearchTextPrompt String
- defaultSearchTextPrompt :: SearchTextPrompt
- newtype DescribeKeys = DescribeKeys {
- describeKeys :: String -> X ()
- defaultDescribeKeys :: DescriptiveKeys -> XConfig Layout -> DescribeKeys
- data HelpPromptConfig = HelpPromptConfig {}
- helpPrompt :: (XConfig Layout -> HelpPromptConfig) -> XConfig l -> XConfig l
- helpPromptAndSet :: DescriptiveKeys -> XPConfig -> (ButtonMask, KeySym) -> SearchTextPrompt -> (XConfig Layout -> DescribeKeys) -> XConfig l -> XConfig l
- defaultHelpPromptAndSet :: DescriptiveKeys -> XPConfig -> XConfig l -> XConfig l
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.
data DescriptiveKey Source
The data structure that denotes an annotated key-binding.
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
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.
SearchTags | |
|
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
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.
DescribeKeys | |
|
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.
HelpPromptConfig | |
|
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
defaultHelpPromptAndSet :: DescriptiveKeys -> XPConfig -> XConfig l -> XConfig lSource