xmonad-contrib-0.16: Third party extensions for xmonad

Copyright | (C) 2008 Luis Cabellos
License | BSD3
Maintainer | zhen.sydow@gmail.com
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Prompt.AppLauncher

Contents

- Usage
- Use case: launching gimp with file
- Types

Description

A module for launch applicationes that receive parameters in the command line. The launcher call a prompt to get the parameters.

Synopsis

- launchApp :: XPConfig -> Application -> X ()
- class XPrompt t where
  - showXPrompt :: t -> String
- data XPConfig
- mkXPrompt :: XPrompt p => p -> XPConfig -> ComplFunction -> (String -> X ()) -> X ()
- type Application = String
- data AppPrompt

# Usage

This module is intended to allow the launch of the same application but changing the parameters using the user response. For example, when you want to open a image in gimp program, you can open gimp and then use the File Menu to open the image or you can use this module to select the image in the command line.

We use Prompt to get the user command line. This also allow to autoexpand the names of the files when we are writing the command line.

launchApp :: XPConfig -> Application -> X () Source #

Get the user's response to a prompt an launch an application using the input as command parameters of the application.

class XPrompt t where Source #

The class prompt types must be an instance of. In order to create a prompt you need to create a data type, without parameters, and make it an instance of this class, by implementing a simple method, `showXPrompt`, which will be used to print the string to be displayed in the command line window.

This is an example of a XPrompt instance definition:

        instance XPrompt Shell where
             showXPrompt Shell = "Run: "

Methods

showXPrompt :: t -> String Source #

This method is used to print the string to be displayed in the command line window.

#### Instances

Instances details

XPrompt XPType Source # |
Instance details Defined in XMonad.Prompt Methods showXPrompt :: XPType -> String Source # nextCompletion :: XPType -> String -> [String] -> String Source # commandToComplete :: XPType -> String -> String Source # completionToCommand :: XPType -> String -> String Source # completionFunction :: XPType -> ComplFunction Source # modeAction :: XPType -> String -> String -> X () Source #
XPrompt XMonad Source # |
Instance details Defined in XMonad.Prompt.XMonad Methods showXPrompt :: XMonad -> String Source # nextCompletion :: XMonad -> String -> [String] -> String Source # commandToComplete :: XMonad -> String -> String Source # completionToCommand :: XMonad -> String -> String Source # completionFunction :: XMonad -> ComplFunction Source # modeAction :: XMonad -> String -> String -> X () Source #
XPrompt Wor Source # |
Instance details Defined in XMonad.Prompt.Workspace Methods showXPrompt :: Wor -> String Source # nextCompletion :: Wor -> String -> [String] -> String Source # commandToComplete :: Wor -> String -> String Source # completionToCommand :: Wor -> String -> String Source # completionFunction :: Wor -> ComplFunction Source # modeAction :: Wor -> String -> String -> X () Source #
XPrompt Ssh Source # |
Instance details Defined in XMonad.Prompt.Ssh Methods showXPrompt :: Ssh -> String Source # nextCompletion :: Ssh -> String -> [String] -> String Source # commandToComplete :: Ssh -> String -> String Source # completionToCommand :: Ssh -> String -> String Source # completionFunction :: Ssh -> ComplFunction Source # modeAction :: Ssh -> String -> String -> X () Source #
XPrompt Shell Source # |
Instance details Defined in XMonad.Prompt.Shell Methods showXPrompt :: Shell -> String Source # nextCompletion :: Shell -> String -> [String] -> String Source # commandToComplete :: Shell -> String -> String Source # completionToCommand :: Shell -> String -> String Source # completionFunction :: Shell -> ComplFunction Source # modeAction :: Shell -> String -> String -> X () Source #
XPrompt WindowPrompt Source # |

Instance details

Defined in XMonad.Prompt.Window

Methods

showXPrompt :: WindowPrompt -> String Source #

nextCompletion :: WindowPrompt -> String -> [String] -> String Source #

commandToComplete :: WindowPrompt -> String -> String Source #

completionToCommand :: WindowPrompt -> String -> String Source #

completionFunction :: WindowPrompt -> ComplFunction Source #

modeAction :: WindowPrompt -> String -> String -> X () Source #

XPrompt RunOrRaisePrompt Source # |

Instance details

Defined in XMonad.Prompt.RunOrRaise

Methods

showXPrompt :: RunOrRaisePrompt -> String Source #

nextCompletion :: RunOrRaisePrompt -> String -> [String] -> String Source #

commandToComplete :: RunOrRaisePrompt -> String -> String Source #

completionToCommand :: RunOrRaisePrompt -> String -> String Source #

completionFunction :: RunOrRaisePrompt -> ComplFunction Source #

modeAction :: RunOrRaisePrompt -> String -> String -> X () Source #

XPrompt Man Source # |
Instance details Defined in XMonad.Prompt.Man Methods showXPrompt :: Man -> String Source # nextCompletion :: Man -> String -> [String] -> String Source # commandToComplete :: Man -> String -> String Source # completionToCommand :: Man -> String -> String Source # completionFunction :: Man -> ComplFunction Source # modeAction :: Man -> String -> String -> X () Source #
XPrompt InputPrompt Source # |

Instance details

Defined in XMonad.Prompt.Input

Methods

showXPrompt :: InputPrompt -> String Source #

nextCompletion :: InputPrompt -> String -> [String] -> String Source #

commandToComplete :: InputPrompt -> String -> String Source #

completionToCommand :: InputPrompt -> String -> String Source #

completionFunction :: InputPrompt -> ComplFunction Source #

modeAction :: InputPrompt -> String -> String -> X () Source #

XPrompt Dir Source # |
Instance details Defined in XMonad.Prompt.Directory Methods showXPrompt :: Dir -> String Source # nextCompletion :: Dir -> String -> [String] -> String Source # commandToComplete :: Dir -> String -> String Source # completionToCommand :: Dir -> String -> String Source # completionFunction :: Dir -> ComplFunction Source # modeAction :: Dir -> String -> String -> X () Source #
XPrompt DirExec Source # |
Instance details Defined in XMonad.Prompt.DirExec Methods showXPrompt :: DirExec -> String Source # nextCompletion :: DirExec -> String -> [String] -> String Source # commandToComplete :: DirExec -> String -> String Source # completionToCommand :: DirExec -> String -> String Source # completionFunction :: DirExec -> ComplFunction Source # modeAction :: DirExec -> String -> String -> X () Source #
XPrompt EnterPrompt Source # |

Instance details

Defined in XMonad.Prompt.ConfirmPrompt

Methods

showXPrompt :: EnterPrompt -> String Source #

nextCompletion :: EnterPrompt -> String -> [String] -> String Source #

commandToComplete :: EnterPrompt -> String -> String Source #

completionToCommand :: EnterPrompt -> String -> String Source #

completionFunction :: EnterPrompt -> ComplFunction Source #

modeAction :: EnterPrompt -> String -> String -> X () Source #

XPrompt AppendFile Source # |

Instance details

Defined in XMonad.Prompt.AppendFile

Methods

showXPrompt :: AppendFile -> String Source #

nextCompletion :: AppendFile -> String -> [String] -> String Source #

commandToComplete :: AppendFile -> String -> String Source #

completionToCommand :: AppendFile -> String -> String Source #

completionFunction :: AppendFile -> ComplFunction Source #

modeAction :: AppendFile -> String -> String -> X () Source #

XPrompt AppPrompt Source # |

Instance details

Defined in XMonad.Prompt.AppLauncher

Methods

showXPrompt :: AppPrompt -> String Source #

nextCompletion :: AppPrompt -> String -> [String] -> String Source #

commandToComplete :: AppPrompt -> String -> String Source #

completionToCommand :: AppPrompt -> String -> String Source #

completionFunction :: AppPrompt -> ComplFunction Source #

modeAction :: AppPrompt -> String -> String -> X () Source #

XPrompt TagPrompt Source # |

Instance details

Defined in XMonad.Actions.TagWindows

Methods

showXPrompt :: TagPrompt -> String Source #

nextCompletion :: TagPrompt -> String -> [String] -> String Source #

commandToComplete :: TagPrompt -> String -> String Source #

completionToCommand :: TagPrompt -> String -> String Source #

completionFunction :: TagPrompt -> ComplFunction Source #

modeAction :: TagPrompt -> String -> String -> X () Source #

XPrompt WSGPrompt Source # |

Instance details

Defined in XMonad.Actions.DynamicWorkspaceGroups

Methods

showXPrompt :: WSGPrompt -> String Source #

nextCompletion :: WSGPrompt -> String -> [String] -> String Source #

commandToComplete :: WSGPrompt -> String -> String Source #

completionToCommand :: WSGPrompt -> String -> String Source #

completionFunction :: WSGPrompt -> ComplFunction Source #

modeAction :: WSGPrompt -> String -> String -> X () Source #

XPrompt Search Source # |
Instance details Defined in XMonad.Actions.Search Methods showXPrompt :: Search -> String Source # nextCompletion :: Search -> String -> [String] -> String Source # commandToComplete :: Search -> String -> String Source # completionToCommand :: Search -> String -> String Source # completionFunction :: Search -> ComplFunction Source # modeAction :: Search -> String -> String -> X () Source #
XPrompt ThemePrompt Source # |

Instance details

Defined in XMonad.Prompt.Theme

Methods

showXPrompt :: ThemePrompt -> String Source #

nextCompletion :: ThemePrompt -> String -> [String] -> String Source #

commandToComplete :: ThemePrompt -> String -> String Source #

completionToCommand :: ThemePrompt -> String -> String Source #

completionFunction :: ThemePrompt -> ComplFunction Source #

modeAction :: ThemePrompt -> String -> String -> X () Source #

data XPConfig Source #

#### Instances

Instances details

Default XPConfig Source # |
Instance details Defined in XMonad.Prompt Methods def :: XPConfig #

mkXPrompt :: XPrompt p => p -> XPConfig -> ComplFunction -> (String -> X ()) -> X () Source #

Creates a prompt given:

- a prompt type, instance of the `XPrompt` class.
- a prompt configuration (`def` can be used as a starting point)
- a completion function (`mkComplFunFromList` can be used to create a completions function given a list of possible completions)
- an action to be run: the action must take a string and return `X` ()

# Use case: launching gimp with file

First, you need to import necessary modules. Prompt is used to get the promp configuration and the AppLauncher module itself.

    import XMonad.Prompt
    import XMonad.Prompt.AppLauncher as AL

Then you can add the bindings to the applications.

    ...
    , ((modm, xK_g), AL.launchApp def "gimp" )
    , ((modm, xK_g), AL.launchApp def "evince" )
    ...

# Types

type Application = String Source #

data AppPrompt Source #

#### Instances

Instances details

XPrompt AppPrompt Source # |

Instance details

Defined in XMonad.Prompt.AppLauncher

Methods

showXPrompt :: AppPrompt -> String Source #

nextCompletion :: AppPrompt -> String -> [String] -> String Source #

commandToComplete :: AppPrompt -> String -> String Source #

completionToCommand :: AppPrompt -> String -> String Source #

completionFunction :: AppPrompt -> ComplFunction Source #

modeAction :: AppPrompt -> String -> String -> X () Source #