mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-31 20:21:51 -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,
|
||||
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)
|
Reference in New Issue
Block a user