xmonad-contrib-0.18.1: Community-maintained extensions for xmonad
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 () #

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.

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

XPrompt Search # 
Instance details

Defined in XMonad.Actions.Search

XPrompt TagPrompt # 
Instance details

Defined in XMonad.Actions.TagWindows

XPrompt XPType # 
Instance details

Defined in XMonad.Prompt

XPrompt AppPrompt # 
Instance details

Defined in XMonad.Prompt.AppLauncher

XPrompt AppendFile # 
Instance details

Defined in XMonad.Prompt.AppendFile

XPrompt EnterPrompt # 
Instance details

Defined in XMonad.Prompt.ConfirmPrompt

XPrompt DirExec # 
Instance details

Defined in XMonad.Prompt.DirExec

XPrompt Dir # 
Instance details

Defined in XMonad.Prompt.Directory

XPrompt InputPrompt # 
Instance details

Defined in XMonad.Prompt.Input

XPrompt Man # 
Instance details

Defined in XMonad.Prompt.Man

XPrompt OrgMode # 
Instance details

Defined in XMonad.Prompt.OrgMode

XPrompt RunOrRaisePrompt # 
Instance details

Defined in XMonad.Prompt.RunOrRaise

XPrompt Shell # 
Instance details

Defined in XMonad.Prompt.Shell

XPrompt Ssh # 
Instance details

Defined in XMonad.Prompt.Ssh

XPrompt ThemePrompt # 
Instance details

Defined in XMonad.Prompt.Theme

XPrompt WindowPrompt # 
Instance details

Defined in XMonad.Prompt.Window

XPrompt Wor # 
Instance details

Defined in XMonad.Prompt.Workspace

XPrompt XMonad # 
Instance details

Defined in XMonad.Prompt.XMonad

XPrompt Zsh # 
Instance details

Defined in XMonad.Prompt.Zsh

mkComplFunFromList :: XPConfig -> [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 def "exit" $ io (exitWith ExitSuccess))
...

data EnterPrompt #

Customized XPrompt prompt that will ask to confirm the given string