mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Add ability to copy the entered string in X.Prompt
This commit is contained in:
parent
2a73df7a45
commit
b805a6fa42
@ -56,7 +56,7 @@ import Prelude hiding (catch)
|
|||||||
import XMonad hiding (config, io)
|
import XMonad hiding (config, io)
|
||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
import XMonad.Util.Font
|
import XMonad.Util.Font
|
||||||
import XMonad.Util.XSelection (getSelection)
|
import XMonad.Util.XSelection (getSelection, putSelection)
|
||||||
|
|
||||||
import Control.Arrow ((&&&))
|
import Control.Arrow ((&&&))
|
||||||
import Control.Concurrent (threadDelay)
|
import Control.Concurrent (threadDelay)
|
||||||
@ -371,6 +371,7 @@ keyPressHandle mask (ks,_)
|
|||||||
| ks == xK_a -> startOfLine >> go
|
| ks == xK_a -> startOfLine >> go
|
||||||
| ks == xK_e -> endOfLine >> go
|
| ks == xK_e -> endOfLine >> go
|
||||||
| ks == xK_y -> pasteString >> go
|
| ks == xK_y -> pasteString >> go
|
||||||
|
| ks == xK_c -> copyString >> go
|
||||||
| ks == xK_Right -> moveWord Next >> go
|
| ks == xK_Right -> moveWord Next >> go
|
||||||
| ks == xK_Left -> moveWord Prev >> go
|
| ks == xK_Left -> moveWord Prev >> go
|
||||||
| ks == xK_Delete -> killWord Next >> go
|
| ks == xK_Delete -> killWord Next >> go
|
||||||
@ -459,6 +460,10 @@ insertString str =
|
|||||||
pasteString :: XP ()
|
pasteString :: XP ()
|
||||||
pasteString = join $ io $ liftM insertString $ getSelection
|
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
|
-- | Remove a character at the cursor position
|
||||||
deleteString :: Direction -> XP ()
|
deleteString :: Direction -> XP ()
|
||||||
deleteString d =
|
deleteString d =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user