diff options
author | loupgaroublond <loupgaroublond@gmail.com> | 2009-01-02 20:09:54 +0100 |
---|---|---|
committer | loupgaroublond <loupgaroublond@gmail.com> | 2009-01-02 20:09:54 +0100 |
commit | 41f3c4a36d6ef5c376f411c32fcdf7fc6eaf550a (patch) | |
tree | ea65c664632be61c1965a9186400b395549321e8 /XMonad | |
parent | 40d0e5d7568566c0149dd704030914a2c6d55065 (diff) | |
download | XMonadContrib-41f3c4a36d6ef5c376f411c32fcdf7fc6eaf550a.tar.gz XMonadContrib-41f3c4a36d6ef5c376f411c32fcdf7fc6eaf550a.tar.xz XMonadContrib-41f3c4a36d6ef5c376f411c32fcdf7fc6eaf550a.zip |
adds haddock documentation for transformPromptSelection
also renames the function per mailing list recommendation
darcs-hash:20090102190954-3ec9f-cbba65194ed36b0dd615a05104f5d6e0a4564605.gz
Diffstat (limited to 'XMonad')
-rw-r--r-- | XMonad/Util/XSelection.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/XMonad/Util/XSelection.hs b/XMonad/Util/XSelection.hs index 714a9a9..1328ab7 100644 --- a/XMonad/Util/XSelection.hs +++ b/XMonad/Util/XSelection.hs @@ -20,8 +20,8 @@ module XMonad.Util.XSelection ( -- * Usage getSelection, promptSelection, safePromptSelection, - modifySelectionAndSafePromptSelection, - modifySelectionAndUnsafePromptSelection, + transformPromptSelection, + transformSafePromptSelection, putSelection) where import Control.Concurrent (forkIO) @@ -175,6 +175,9 @@ 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 +{- | A wrapper around promptSelection and its safe variant. They take two parameters, the first is a function that transforms strings, and the second is the application to run. The transformer essentially transforms the selection in X. +One example is to wrap code, such as a command line action copied out of the browser to be run as '"sudo" ++ cmd' or '"su - -c \"" ++ cmd ++ "\"". +-} +transformPromptSelection, transformSafePromptSelection :: (String -> String) -> String -> X () +transformPromptSelection f app = join $ io $ liftM (safeSpawn app) (fmap f getSelection) +transformSafePromptSelection f app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) (fmap f getSelection)
\ No newline at end of file |