XMonad.Prompt.ConfirmPrompt

xmonad-contrib-0.15: Third party extensions for xmonad

Copyright | (C) 2015 Antoine Beaupré
License | BSD3
Maintainer | Antoine Beaupré <anarcat@debian.org>
Stability | unstable
Portability | unportable
Safe Haskell | None
Language | Haskell98

XMonad.Prompt.ConfirmPrompt

Contents

- Usage
- Use case: confirming exit

Description

A module for setting up simple confirmation prompts for keybindings.

Synopsis

- confirmPrompt :: XPConfig -> String -> X () -> X ()
- class XPrompt t where
  - showXPrompt :: t -> String
- data XPConfig
- mkXPrompt :: XPrompt p => p -> XPConfig -> ComplFunction -> (String -> X ()) -> X ()
- mkComplFunFromList :: [String] -> String -> IO [String]
- data EnterPrompt

# Documentation

confirmPrompt :: XPConfig -> String -> X () -> X () #

Prompt the user to confirm a given action. We offer no completion and simply ask to confirm (ENTER) or cancel (ESCAPE). The actual key handling is done by mkXPrompt.

# Usage

This module makes it easy to add a confirmation prompt for specific actions. Instead of just running the action, a simple confirmation prompt will be created using `Prompt` primitives. The action will then run normally if the user confirms.

class XPrompt t where #

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 #

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

Instances

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

data XPConfig #

Instances

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

mkComplFunFromList :: [String] -> String -> IO [String] #

This function takes a list of possible completions and returns a completions function to be used with `mkXPrompt`

# Use case: confirming exit

This should be used something like this:

    ...
    , ((modm , xK_l), confirmPrompt defaultXPConfig "exit" $ io (exitWith ExitSuccess))
    ...

data EnterPrompt #

Customized `XPrompt` prompt that will ask to confirm the given string

Instances

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