Copyright | (C) 2008 Luis Cabellos |
---|---|
License | BSD3 |
Maintainer | zhen.sydow@gmail.com |
Stability | unstable |
Portability | unportable |
Safe Haskell | None |
Language | Haskell98 |
A module for launch applicationes that receive parameters in the command line. The launcher call a prompt to get the parameters.
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: "
showXPrompt :: t -> String Source #
This method is used to print the string to be displayed in the command line window.
Instances
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 #
Instances
XPrompt AppPrompt Source # | |
Defined in XMonad.Prompt.AppLauncher 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 # |