From 525d6d99f0740345e55a551f0768b43e32931b51 Mon Sep 17 00:00:00 2001 From: Daniel Schoepe Date: Thu, 9 Jul 2009 12:07:03 +0200 Subject: Add ability to copy the entered string in X.Prompt Ignore-this: 4e8b98f281001d7540617d0ff6a3d4f3 darcs-hash:20090709100703-7f603-ca459dc9695aab8fc70396761bdd6bf51ca962ab.gz --- XMonad/Prompt.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'XMonad/Prompt.hs') diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs index eb25fba..123c8a6 100644 --- a/XMonad/Prompt.hs +++ b/XMonad/Prompt.hs @@ -56,7 +56,7 @@ import Prelude hiding (catch) import XMonad hiding (config, io) import qualified XMonad.StackSet as W import XMonad.Util.Font -import XMonad.Util.XSelection (getSelection) +import XMonad.Util.XSelection (getSelection, putSelection) import Control.Arrow ((&&&)) import Control.Concurrent (threadDelay) @@ -371,6 +371,7 @@ keyPressHandle mask (ks,_) | ks == xK_a -> startOfLine >> go | ks == xK_e -> endOfLine >> go | ks == xK_y -> pasteString >> go + | ks == xK_c -> copyString >> go | ks == xK_Right -> moveWord Next >> go | ks == xK_Left -> moveWord Prev >> go | ks == xK_Delete -> killWord Next >> go @@ -459,6 +460,10 @@ insertString str = pasteString :: XP () pasteString = join $ io $ liftM insertString $ getSelection +-- | Copy the currently entered string into the X selection. +copyString :: XP () +copyString = gets command >>= io . putSelection + -- | Remove a character at the cursor position deleteString :: Direction -> XP () deleteString d = -- cgit v1.2.3