xmonad-contrib-0.14: Third party extensions for xmonad

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

XMonad.Prompt.ConfirmPrompt

Contents

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.

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: "

Minimal complete definition

showXPrompt

Methods

showXPrompt :: t -> String Source #

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

Instances
XPrompt XPType Source # 
Instance details

Defined in XMonad.Prompt

XPrompt XMonad Source # 
Instance details

Defined in XMonad.Prompt.XMonad

XPrompt Wor Source # 
Instance details

Defined in XMonad.Prompt.Workspace

XPrompt Ssh Source # 
Instance details

Defined in XMonad.Prompt.Ssh

XPrompt Shell Source # 
Instance details

Defined in XMonad.Prompt.Shell

XPrompt WindowPrompt Source # 
Instance details

Defined in XMonad.Prompt.Window

XPrompt RunOrRaisePrompt Source # 
Instance details

Defined in XMonad.Prompt.RunOrRaise

XPrompt Man Source # 
Instance details

Defined in XMonad.Prompt.Man

XPrompt InputPrompt Source # 
Instance details

Defined in XMonad.Prompt.Input

XPrompt Dir Source # 
Instance details

Defined in XMonad.Prompt.Directory

XPrompt DirExec Source # 
Instance details

Defined in XMonad.Prompt.DirExec

XPrompt EnterPrompt Source # 
Instance details

Defined in XMonad.Prompt.ConfirmPrompt

XPrompt AppendFile Source # 
Instance details

Defined in XMonad.Prompt.AppendFile

XPrompt AppPrompt Source # 
Instance details

Defined in XMonad.Prompt.AppLauncher

XPrompt TagPrompt Source # 
Instance details

Defined in XMonad.Actions.TagWindows

XPrompt WSGPrompt Source # 
Instance details

Defined in XMonad.Actions.DynamicWorkspaceGroups

XPrompt Search Source # 
Instance details

Defined in XMonad.Actions.Search

XPrompt ThemePrompt Source # 
Instance details

Defined in XMonad.Prompt.Theme

data XPConfig Source #

Instances
Default XPConfig Source # 
Instance details

Defined in XMonad.Prompt

Methods

def :: XPConfig #

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

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

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