diff options
author | loupgaroublond <loupgaroublond@gmail.com> | 2008-12-22 03:07:30 +0100 |
---|---|---|
committer | loupgaroublond <loupgaroublond@gmail.com> | 2008-12-22 03:07:30 +0100 |
commit | 40d0e5d7568566c0149dd704030914a2c6d55065 (patch) | |
tree | df0d39bfc0f894fad4a31209a0b74820c4a5e089 /XMonad/Util | |
parent | 38af69540eb578a2453be7cd336d8c4f296752c7 (diff) | |
download | XMonadContrib-40d0e5d7568566c0149dd704030914a2c6d55065.tar.gz XMonadContrib-40d0e5d7568566c0149dd704030914a2c6d55065.tar.xz XMonadContrib-40d0e5d7568566c0149dd704030914a2c6d55065.zip |
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
Diffstat (limited to 'XMonad/Util')
-rw-r--r-- | XMonad/Util/XSelection.hs | 6 |
1 files changed, 6 insertions, 0 deletions
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 |