xmonad-contrib
Copyright(C) 2015 Antoine Beaupré
LicenseBSD3
MaintainerAntoine Beaupré <anarcat@debian.org>
Stabilityunstable
Portabilityunportable
Safe HaskellNone
LanguageHaskell2010

XMonad.Prompt.ConfirmPrompt

Description

A module for setting up simple confirmation prompts for keybindings.

Synopsis

Documentation

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

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.

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

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

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

data XPConfig Source #

Instances

Instances details
Default XPConfig Source # 
Instance details

Defined in XMonad.Prompt

Methods

def :: XPConfig #

class XPrompt t where Source #

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 Source #

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

Instances

Instances details
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 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 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 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 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 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 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 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 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 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 OrgMode Source # 
Instance details

Defined in XMonad.Prompt.OrgMode

Methods

showXPrompt :: OrgMode -> String Source #

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

commandToComplete :: OrgMode -> String -> String Source #

completionToCommand :: OrgMode -> String -> String Source #

completionFunction :: OrgMode -> ComplFunction Source #

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

XPrompt RunOrRaisePrompt Source # 
Instance details

Defined in XMonad.Prompt.RunOrRaise

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

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 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 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 Zsh Source # 
Instance details

Defined in XMonad.Prompt.Zsh

Methods

showXPrompt :: Zsh -> String Source #

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

commandToComplete :: Zsh -> String -> String Source #

completionToCommand :: Zsh -> String -> String Source #

completionFunction :: Zsh -> ComplFunction Source #

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

Use case: confirming exit

This should be used something like this:

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

data EnterPrompt Source #

Customized XPrompt prompt that will ask to confirm the given string

Instances

Instances details
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 #