xmonad-contrib-0.18.0: Community-maintained extensions for xmonad

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

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 ()
- data XPConfig
- mkXPrompt :: XPrompt p => p -> XPConfig -> ComplFunction -> (String -> X ()) -> X ()
- class XPrompt t where
  - showXPrompt :: t -> String
- 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 () #

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

data XPConfig #

#### Instances

Instances details

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

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

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` ()

class XPrompt t where #

A class for an abstract prompt. In order for your data type to be a valid prompt you _must_ make it an instance of this class.

The minimal complete definition is just `showXPrompt`, i.e. the name of the prompt. This string will be displayed in the command line window (before the cursor).

As an example of a complete `XPrompt` instance definition, we can look at the `Shell` prompt from XMonad.Prompt.Shell:

        data Shell = Shell

        instance XPrompt Shell where
             showXPrompt Shell = "Run: "

Methods

showXPrompt :: t -> String #

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

#### Instances

Instances details

XPrompt WSGPrompt # |
Instance details Defined in XMonad.Actions.DynamicWorkspaceGroups Methods showXPrompt :: WSGPrompt -> String # nextCompletion :: WSGPrompt -> String -> [String] -> String # commandToComplete :: WSGPrompt -> String -> String # completionToCommand :: WSGPrompt -> String -> String # completionFunction :: WSGPrompt -> ComplFunction # modeAction :: WSGPrompt -> String -> String -> X () #
XPrompt Search # |
Instance details Defined in XMonad.Actions.Search Methods showXPrompt :: Search -> String # nextCompletion :: Search -> String -> [String] -> String # commandToComplete :: Search -> String -> String # completionToCommand :: Search -> String -> String # completionFunction :: Search -> ComplFunction # modeAction :: Search -> String -> String -> X () #
XPrompt TagPrompt # |
Instance details Defined in XMonad.Actions.TagWindows Methods showXPrompt :: TagPrompt -> String # nextCompletion :: TagPrompt -> String -> [String] -> String # commandToComplete :: TagPrompt -> String -> String # completionToCommand :: TagPrompt -> String -> String # completionFunction :: TagPrompt -> ComplFunction # modeAction :: TagPrompt -> String -> String -> X () #
XPrompt XPType # |
Instance details Defined in XMonad.Prompt Methods showXPrompt :: XPType -> String # nextCompletion :: XPType -> String -> [String] -> String # commandToComplete :: XPType -> String -> String # completionToCommand :: XPType -> String -> String # completionFunction :: XPType -> ComplFunction # modeAction :: XPType -> String -> String -> X () #
XPrompt AppPrompt # |
Instance details Defined in XMonad.Prompt.AppLauncher Methods showXPrompt :: AppPrompt -> String # nextCompletion :: AppPrompt -> String -> [String] -> String # commandToComplete :: AppPrompt -> String -> String # completionToCommand :: AppPrompt -> String -> String # completionFunction :: AppPrompt -> ComplFunction # modeAction :: AppPrompt -> String -> String -> X () #
XPrompt AppendFile # |
Instance details Defined in XMonad.Prompt.AppendFile Methods showXPrompt :: AppendFile -> String # nextCompletion :: AppendFile -> String -> [String] -> String # commandToComplete :: AppendFile -> String -> String # completionToCommand :: AppendFile -> String -> String # completionFunction :: AppendFile -> ComplFunction # modeAction :: AppendFile -> String -> String -> X () #
XPrompt EnterPrompt # |
Instance details Defined in XMonad.Prompt.ConfirmPrompt Methods showXPrompt :: EnterPrompt -> String # nextCompletion :: EnterPrompt -> String -> [String] -> String # commandToComplete :: EnterPrompt -> String -> String # completionToCommand :: EnterPrompt -> String -> String # completionFunction :: EnterPrompt -> ComplFunction # modeAction :: EnterPrompt -> String -> String -> X () #
XPrompt DirExec # |
Instance details Defined in XMonad.Prompt.DirExec Methods showXPrompt :: DirExec -> String # nextCompletion :: DirExec -> String -> [String] -> String # commandToComplete :: DirExec -> String -> String # completionToCommand :: DirExec -> String -> String # completionFunction :: DirExec -> ComplFunction # modeAction :: DirExec -> String -> String -> X () #
XPrompt Dir # |
Instance details Defined in XMonad.Prompt.Directory Methods showXPrompt :: Dir -> String # nextCompletion :: Dir -> String -> [String] -> String # commandToComplete :: Dir -> String -> String # completionToCommand :: Dir -> String -> String # completionFunction :: Dir -> ComplFunction # modeAction :: Dir -> String -> String -> X () #
XPrompt InputPrompt # |
Instance details Defined in XMonad.Prompt.Input Methods showXPrompt :: InputPrompt -> String # nextCompletion :: InputPrompt -> String -> [String] -> String # commandToComplete :: InputPrompt -> String -> String # completionToCommand :: InputPrompt -> String -> String # completionFunction :: InputPrompt -> ComplFunction # modeAction :: InputPrompt -> String -> String -> X () #
XPrompt Man # |
Instance details Defined in XMonad.Prompt.Man Methods showXPrompt :: Man -> String # nextCompletion :: Man -> String -> [String] -> String # commandToComplete :: Man -> String -> String # completionToCommand :: Man -> String -> String # completionFunction :: Man -> ComplFunction # modeAction :: Man -> String -> String -> X () #
XPrompt OrgMode # |
Instance details Defined in XMonad.Prompt.OrgMode Methods showXPrompt :: OrgMode -> String # nextCompletion :: OrgMode -> String -> [String] -> String # commandToComplete :: OrgMode -> String -> String # completionToCommand :: OrgMode -> String -> String # completionFunction :: OrgMode -> ComplFunction # modeAction :: OrgMode -> String -> String -> X () #
XPrompt RunOrRaisePrompt # |

Instance details

Defined in XMonad.Prompt.RunOrRaise

Methods

showXPrompt :: RunOrRaisePrompt -> String #

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

commandToComplete :: RunOrRaisePrompt -> String -> String #

completionToCommand :: RunOrRaisePrompt -> String -> String #

completionFunction :: RunOrRaisePrompt -> ComplFunction #

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

XPrompt Shell # |
Instance details Defined in XMonad.Prompt.Shell Methods showXPrompt :: Shell -> String # nextCompletion :: Shell -> String -> [String] -> String # commandToComplete :: Shell -> String -> String # completionToCommand :: Shell -> String -> String # completionFunction :: Shell -> ComplFunction # modeAction :: Shell -> String -> String -> X () #
XPrompt Ssh # |
Instance details Defined in XMonad.Prompt.Ssh Methods showXPrompt :: Ssh -> String # nextCompletion :: Ssh -> String -> [String] -> String # commandToComplete :: Ssh -> String -> String # completionToCommand :: Ssh -> String -> String # completionFunction :: Ssh -> ComplFunction # modeAction :: Ssh -> String -> String -> X () #
XPrompt ThemePrompt # |
Instance details Defined in XMonad.Prompt.Theme Methods showXPrompt :: ThemePrompt -> String # nextCompletion :: ThemePrompt -> String -> [String] -> String # commandToComplete :: ThemePrompt -> String -> String # completionToCommand :: ThemePrompt -> String -> String # completionFunction :: ThemePrompt -> ComplFunction # modeAction :: ThemePrompt -> String -> String -> X () #
XPrompt WindowPrompt # |
Instance details Defined in XMonad.Prompt.Window Methods showXPrompt :: WindowPrompt -> String # nextCompletion :: WindowPrompt -> String -> [String] -> String # commandToComplete :: WindowPrompt -> String -> String # completionToCommand :: WindowPrompt -> String -> String # completionFunction :: WindowPrompt -> ComplFunction # modeAction :: WindowPrompt -> String -> String -> X () #
XPrompt Wor # |
Instance details Defined in XMonad.Prompt.Workspace Methods showXPrompt :: Wor -> String # nextCompletion :: Wor -> String -> [String] -> String # commandToComplete :: Wor -> String -> String # completionToCommand :: Wor -> String -> String # completionFunction :: Wor -> ComplFunction # modeAction :: Wor -> String -> String -> X () #
XPrompt XMonad # |
Instance details Defined in XMonad.Prompt.XMonad Methods showXPrompt :: XMonad -> String # nextCompletion :: XMonad -> String -> [String] -> String # commandToComplete :: XMonad -> String -> String # completionToCommand :: XMonad -> String -> String # completionFunction :: XMonad -> ComplFunction # modeAction :: XMonad -> String -> String -> X () #
XPrompt Zsh # |
Instance details Defined in XMonad.Prompt.Zsh Methods showXPrompt :: Zsh -> String # nextCompletion :: Zsh -> String -> [String] -> String # commandToComplete :: Zsh -> String -> String # completionToCommand :: Zsh -> String -> String # completionFunction :: Zsh -> ComplFunction # modeAction :: Zsh -> String -> String -> 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 #

data AppPrompt #

#### Instances

Instances details

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