xmonad-contrib-0.5: Third party extensions for xmonadSource codeContentsIndex
XMonad.Prompt
Portabilityunportable
Stabilityunstable
Maintainerandrea.rossato@unibz.it
Contents
Usage
X Utilities
Other Utilities
Description
A module for writing graphical prompts for XMonad
Synopsis
mkXPrompt :: XPrompt p => p -> XPConfig -> ComplFunction -> (String -> X ()) -> X ()
mkXPromptWithReturn :: XPrompt p => p -> XPConfig -> ComplFunction -> (String -> X a) -> X (Maybe a)
defaultXPConfig :: XPConfig
mkComplFunFromList :: [String] -> String -> IO [String]
data XPType = forall p . XPrompt p => XPT p
data XPPosition
= Top
| Bottom
data XPConfig = XPC {
font :: String
bgColor :: String
fgColor :: String
fgHLight :: String
bgHLight :: String
borderColor :: String
promptBorderWidth :: Dimension
position :: XPPosition
height :: Dimension
historySize :: Int
}
class XPrompt t where
showXPrompt :: t -> String
type ComplFunction = String -> IO [String]
mkUnmanagedWindow :: Display -> Screen -> Window -> Position -> Position -> Dimension -> Dimension -> IO Window
fillDrawable :: Display -> Drawable -> GC -> Pixel -> Pixel -> Dimension -> Dimension -> Dimension -> IO ()
getLastWord :: String -> String
skipLastWord :: String -> String
splitInSubListsAt :: Int -> [a] -> [[a]]
breakAtSpace :: String -> (String, String)
newIndex :: String -> [String] -> Int
newCommand :: String -> [String] -> String
uniqSort :: Ord a => [a] -> [a]
Usage

For usage examples see XMonad.Prompt.Shell, XMonad.Prompt.XMonad or XMonad.Prompt.Ssh

TODO:

  • scrolling the completions that don't fit in the window (?)
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 (defaultXPConfig 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 ()
mkXPromptWithReturn :: XPrompt p => p -> XPConfig -> ComplFunction -> (String -> X a) -> X (Maybe a)Source
Same as mkXPrompt, except that the action function can have type String -> X a, for any a, and the final action returned by mkXPromptWithReturn will have type X (Maybe a). Nothing is yielded if the user cancels the prompt (by e.g. hitting Esc or Ctrl-G). For an example of use, see the XMonad.Prompt.Input module.
defaultXPConfig :: XPConfigSource
mkComplFunFromList :: [String] -> String -> IO [String]Source
This function takes a list of possible completions and returns a completions function to be used with mkXPrompt
data XPType Source
Constructors
forall p . XPrompt p => XPT p
show/hide Instances
data XPPosition Source
Constructors
Top
Bottom
show/hide Instances
data XPConfig Source
Constructors
XPC
font :: StringFont
bgColor :: StringBackground color
fgColor :: StringFont color
fgHLight :: StringFont color of a highlighted completion entry
bgHLight :: StringBackground color of a highlighted completion entry
borderColor :: StringBorder color
promptBorderWidth :: DimensionBorder width
position :: XPPositionPosition: Top or Bottom
height :: DimensionWindow height
historySize :: IntThe number of history entries to be saved
show/hide Instances
class XPrompt t whereSource

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 -> StringSource
show/hide Instances
XPrompt XPType
XPrompt Wor
XPrompt TagPrompt
XPrompt Shell
XPrompt Ssh
XPrompt Wor
XPrompt Dir
XPrompt Man
XPrompt AppendFile
XPrompt InputPrompt
XPrompt Wor
XPrompt WindowPrompt
XPrompt XMonad
type ComplFunction = String -> IO [String]Source
X Utilities
mkUnmanagedWindow :: Display -> Screen -> Window -> Position -> Position -> Dimension -> Dimension -> IO WindowSource
Creates a window with the attribute override_redirect set to True. Windows Managers should not touch this kind of windows.
fillDrawable :: Display -> Drawable -> GC -> Pixel -> Pixel -> Dimension -> Dimension -> Dimension -> IO ()Source
Fills a Drawable with a rectangle and a border
Other Utilities
getLastWord :: String -> StringSource
Gets the last word of a string or the whole string if formed by only one word
skipLastWord :: String -> StringSource
Skips the last word of the string, if the string is composed by more then one word. Otherwise returns the string.
splitInSubListsAt :: Int -> [a] -> [[a]]Source
Given a maximum length, splits a list into sublists
breakAtSpace :: String -> (String, String)Source
newIndex :: String -> [String] -> IntSource
Given a completion and a list of possible completions, returns the index of the next completion in the list
newCommand :: String -> [String] -> StringSource
Given a completion and a list of possible completions, returns the the next completion in the list
uniqSort :: Ord a => [a] -> [a]Source
Sort a list and remove duplicates.
Produced by Haddock version 2.3.0