diff options
author | Michal Minář <mic.liamg@gmail.com> | 2017-02-11 17:35:15 +0100 |
---|---|---|
committer | Michal Minář <mic.liamg@gmail.com> | 2017-02-11 17:35:15 +0100 |
commit | 7926a22a45ea844dff817c636cd27a09a8210d04 (patch) | |
tree | 095f70004324f0c0a1325f68898946f0cf152fd6 | |
parent | 14752e16770724a6a2c8202396fa96c060861a4b (diff) | |
download | xminad-7926a22a45ea844dff817c636cd27a09a8210d04.tar.gz xminad-7926a22a45ea844dff817c636cd27a09a8210d04.tar.xz xminad-7926a22a45ea844dff817c636cd27a09a8210d04.zip |
Fixed pasting from clipboard
Signed-off-by: Michal Minář <mic.liamg@gmail.com>
-rw-r--r-- | src/XMonad/Local/Actions.hs | 17 | ||||
-rw-r--r-- | src/XMonad/Local/Keys.hs | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/XMonad/Local/Actions.hs b/src/XMonad/Local/Actions.hs index 71549a1..f5e0cc1 100644 --- a/src/XMonad/Local/Actions.hs +++ b/src/XMonad/Local/Actions.hs @@ -90,9 +90,18 @@ getClipboardText = catchX (runProcessAndLogError clipboardManager ["-c"] "") (io $ return Nothing) -pasteTextFromClipboard ∷ X () -pasteTextFromClipboard = do +saveTextToClipboard ∷ String → X () +saveTextToClipboard text = catchX + (void (runProcessAndLogError clipboardManager [] text)) + (io $ return ()) + +-- | Turn the current entry in clipboard into plain text and paste it to the +-- current window using Ctrl+v shortcut. +pastePlainTextFromClipboard ∷ X () +pastePlainTextFromClipboard = do t <- getClipboardText case t of - Just text -> catchX (Paste.pasteString text) (io $ return ()) - Nothing -> io (return ()) + Just text -> do + saveTextToClipboard text + Paste.pasteChar controlMask 'V' + Nothing -> io $ return () diff --git a/src/XMonad/Local/Keys.hs b/src/XMonad/Local/Keys.hs index 626e781..39ab8c1 100644 --- a/src/XMonad/Local/Keys.hs +++ b/src/XMonad/Local/Keys.hs @@ -202,7 +202,7 @@ genericKeys conf = [ -- misc , ("S-h", PSsh.sshPrompt xpConfig) - , ("v", Local.pasteTextFromClipboard) + , ("v", Local.pastePlainTextFromClipboard) --, ("<Print>", spawn "xfce4-screenshooter") , ("y", SUB.submap $ EZ.mkKeymap conf $ concat [ [(k, a), (modm ++ "-" ++ k, a)] |