From 40d0e5d7568566c0149dd704030914a2c6d55065 Mon Sep 17 00:00:00 2001 From: loupgaroublond Date: Mon, 22 Dec 2008 03:07:30 +0100 Subject: adds a weird function to XSelection This enables you to pass a function of (String -> String) to a selection function to modify the string before executing it. This way, you can input your own escape routines to make it shell command line safe, and/or do other fancier things. darcs-hash:20081222020730-3ec9f-cca983e9800b5b712239797d7b4199e0a8d3d97a.gz --- XMonad/Util/XSelection.hs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'XMonad/Util') diff --git a/XMonad/Util/XSelection.hs b/XMonad/Util/XSelection.hs index aa6624e..714a9a9 100644 --- a/XMonad/Util/XSelection.hs +++ b/XMonad/Util/XSelection.hs @@ -20,6 +20,8 @@ module XMonad.Util.XSelection ( -- * Usage getSelection, promptSelection, safePromptSelection, + modifySelectionAndSafePromptSelection, + modifySelectionAndUnsafePromptSelection, putSelection) where import Control.Concurrent (forkIO) @@ -172,3 +174,7 @@ promptSelection, safePromptSelection, unsafePromptSelection :: String -> X () promptSelection = unsafePromptSelection safePromptSelection app = join $ io $ liftM (safeSpawn app) getSelection unsafePromptSelection app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) getSelection + +modifySelectionAndSafePromptSelection, modifySelectionAndUnsafePromptSelection :: (String -> String) -> String -> X () +modifySelectionAndSafePromptSelection f app = join $ io $ liftM (safeSpawn app) (fmap f getSelection) +modifySelectionAndUnsafePromptSelection f app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) (fmap f getSelection) \ No newline at end of file -- cgit v1.2.3