mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-06 15:01:53 -07:00
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.
This commit is contained in:
@@ -20,6 +20,8 @@ module XMonad.Util.XSelection ( -- * Usage
|
|||||||
getSelection,
|
getSelection,
|
||||||
promptSelection,
|
promptSelection,
|
||||||
safePromptSelection,
|
safePromptSelection,
|
||||||
|
modifySelectionAndSafePromptSelection,
|
||||||
|
modifySelectionAndUnsafePromptSelection,
|
||||||
putSelection) where
|
putSelection) where
|
||||||
|
|
||||||
import Control.Concurrent (forkIO)
|
import Control.Concurrent (forkIO)
|
||||||
@@ -172,3 +174,7 @@ promptSelection, safePromptSelection, unsafePromptSelection :: String -> X ()
|
|||||||
promptSelection = unsafePromptSelection
|
promptSelection = unsafePromptSelection
|
||||||
safePromptSelection app = join $ io $ liftM (safeSpawn app) getSelection
|
safePromptSelection app = join $ io $ liftM (safeSpawn app) getSelection
|
||||||
unsafePromptSelection app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) 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)
|
Reference in New Issue
Block a user