diff options
-rw-r--r-- | XMonad/Prompt.hs | 10 |
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@ |