Stability | unstable |
---|---|
Maintainer | <c.lopez@kmels.net> |
Safe Haskell | Safe-Infered |
XMonad.Actions.Launcher
Contents
Description
A set of prompts for XMonad
- defaultLauncherModes :: LauncherConfig -> [XPMode]
- type ExtensionActions = Map String (String -> X ())
- data LauncherConfig = LauncherConfig {}
- data LocateFileMode
- data LocateFileRegexMode
- launcherPrompt :: XPConfig -> [XPMode] -> X ()
Description and use
This module lets you combine and switch between different types of prompts (XMonad.Prompt). It includes a set of default modes:
- Hoogle mode: Search for functions using hoogle, choosing a function leads you to documentation in Haddock.
- Locate mode: Search for files using locate, choosing a file opens it with a program you specify depending on the file's extension.
- Locate regexp: Same as locate mode but autocomplete works with regular expressions.
- Calc: Uses the program calc to do calculations.
To use the default modes, modify your .xmonad:
import XMonad.Prompt(defaultXPConfig) import XMonad.Actions.Launcher
((modm .|. controlMask, xK_l), launcherPrompt defaultXPConfig $ defaultLauncherModes launcherConfig)
A LauncherConfig contains settings for the default modes, modify them accordingly.
launcherConfig = LauncherConfig { pathToHoogle = "/home/YOU/.cabal/bin/hoogle" , browser = "firefox" , actionsByExtension = extensionActions }
extensionActions :: M.Map String (String -> X()) extensionActions = M.fromList $ [ (".hs", p -> spawn $ "emacs " ++ p) , (".pdf", p -> spawn $ "acroread " ++ p) , (".mkv", p -> spawn $ "vlc " ++ p) , (".*", p -> spawn $ "emacs " ++ p) --match with any files , ("/", p -> spawn $ "nautilus " ++ p) --match with directories ]
To try it, restart xmonad. Press Ctrl + Your_Modkey + L and the first prompt should pop up.
You can change mode with xK_grave if you used defaultXP or change the value of changeModeKey in your XPConfig
defaultLauncherModes :: LauncherConfig -> [XPMode]
Create a list of modes based on : a list of extensions mapped to actions the path to hoogle
type ExtensionActions = Map String (String -> X ())
data LauncherConfig
Constructors
LauncherConfig | |
Fields |
data LocateFileMode
Instances
XPrompt LocateFileMode | Uses the program |
data LocateFileRegexMode
Instances
XPrompt LocateFileRegexMode | Uses the program `locate --regex` to list files |
launcherPrompt :: XPConfig -> [XPMode] -> X ()
Creates a prompt with the given modes
ToDo
- Switch to mode by name of the prompt, 1.
:
at an empty(?) buffer, 2. autocomplete name in buffer should happen, 3. switch to mode with enter (cancel switch with C-g) - Support for actions of type String -> X a
- Hoogle mode: add a setting in the action to either go to documentation or to the source code (needs hoogle change?)
- Hoogle mode: add setting to query hoogle at haskell.org instead (with &mode=json)