aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Schoepe <daniel.schoepe@gmail.com>2009-10-31 00:50:33 +0100
committerDaniel Schoepe <daniel.schoepe@gmail.com>2009-10-31 00:50:33 +0100
commit58fcfaadf83cc655e119a292a4eb5dfe701d9574 (patch)
tree19a39efa03dcb24944cccd7eb625e0908346e4d9
parentbd31860cd1fad8745e74702e286aec59c3fd498a (diff)
downloadXMonadContrib-58fcfaadf83cc655e119a292a4eb5dfe701d9574.tar.gz
XMonadContrib-58fcfaadf83cc655e119a292a4eb5dfe701d9574.tar.xz
XMonadContrib-58fcfaadf83cc655e119a292a4eb5dfe701d9574.zip
Add functions to access the current input in X.Prompt
Ignore-this: 3f568c1266d85dcaa5722b19bbbd61dd darcs-hash:20091030235033-7f603-2da8ee80df7406b09d279592804adc37f3e14ab2.gz
-rw-r--r--XMonad/Prompt.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs
index 90e8685..94dc133 100644
--- a/XMonad/Prompt.hs
+++ b/XMonad/Prompt.hs
@@ -30,6 +30,7 @@ module XMonad.Prompt
, quit
, killBefore, killAfter, startOfLine, endOfLine
, pasteString, moveCursor
+ , setInput, getInput
, moveWord, killWord, deleteString
, moveHistory, setSuccess, setDone
, Direction1D(..)
@@ -247,6 +248,15 @@ command = W.focus . commandHistory
setCommand :: String -> XPState -> XPState
setCommand xs s = s { commandHistory = (commandHistory s) { W.focus = xs }}
+-- | Sets the input string to the given value.
+setInput :: String -> XP ()
+setInput = modify . setCommand
+
+-- | Returns the current input string. Intented for use in custom keymaps
+-- where the 'get' or similar can't be used to retrieve it.
+getInput :: XP String
+getInput = gets command
+
-- | 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@