mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-07 15:31:54 -07:00
update callers of safeSpawn
This commit is contained in:
@@ -231,7 +231,7 @@ use (SearchEngine _ engine) = engine
|
|||||||
-- | Given a browser, a search engine's transformation function, and a search term, perform the
|
-- | Given a browser, a search engine's transformation function, and a search term, perform the
|
||||||
-- requested search in the browser.
|
-- requested search in the browser.
|
||||||
search :: Browser -> Site -> Query -> X ()
|
search :: Browser -> Site -> Query -> X ()
|
||||||
search browser site query = safeSpawn browser $ site query
|
search browser site query = safeSpawn browser [site query]
|
||||||
|
|
||||||
{- | Given a base URL, create the 'SearchEngine' that escapes the query and
|
{- | Given a base URL, create the 'SearchEngine' that escapes the query and
|
||||||
appends it to the base. You can easily define a new engine locally using
|
appends it to the base. You can easily define a new engine locally using
|
||||||
|
@@ -77,7 +77,7 @@ shellPrompt c = do
|
|||||||
prompt, unsafePrompt, safePrompt :: FilePath -> XPConfig -> X ()
|
prompt, unsafePrompt, safePrompt :: FilePath -> XPConfig -> X ()
|
||||||
prompt = unsafePrompt
|
prompt = unsafePrompt
|
||||||
safePrompt c config = mkXPrompt Shell config (getShellCompl [c]) run
|
safePrompt c config = mkXPrompt Shell config (getShellCompl [c]) run
|
||||||
where run = safeSpawn c . encodeOutput
|
where run = safeSpawn c . return . encodeOutput
|
||||||
unsafePrompt c config = mkXPrompt Shell config (getShellCompl [c]) run
|
unsafePrompt c config = mkXPrompt Shell config (getShellCompl [c]) run
|
||||||
where run a = unsafeSpawn $ c ++ " " ++ encodeOutput a
|
where run a = unsafeSpawn $ c ++ " " ++ encodeOutput a
|
||||||
|
|
||||||
|
@@ -129,12 +129,12 @@ shell using 'safeSpawn' from "XMonad.Util.Run"; see its documentation for more
|
|||||||
details on the advantages and disadvantages of using safeSpawn. -}
|
details on the advantages and disadvantages of using safeSpawn. -}
|
||||||
promptSelection, safePromptSelection, unsafePromptSelection :: String -> X ()
|
promptSelection, safePromptSelection, unsafePromptSelection :: String -> X ()
|
||||||
promptSelection = unsafePromptSelection
|
promptSelection = unsafePromptSelection
|
||||||
safePromptSelection app = join $ io $ liftM (safeSpawn app) getSelection
|
safePromptSelection app = join $ io $ liftM (safeSpawn app . return) getSelection
|
||||||
unsafePromptSelection app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) getSelection
|
unsafePromptSelection app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) getSelection
|
||||||
|
|
||||||
{- | 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.
|
{- | 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 ++ "\"".
|
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, transformSafePromptSelection :: (String -> String) -> String -> X ()
|
||||||
transformPromptSelection f app = join $ io $ liftM (safeSpawn app) (fmap f getSelection)
|
transformPromptSelection f app = join $ io $ liftM (safeSpawn app . return) (fmap f getSelection)
|
||||||
transformSafePromptSelection f app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) (fmap f getSelection)
|
transformSafePromptSelection f app = join $ io $ liftM unsafeSpawn $ fmap (\x -> app ++ " " ++ x) (fmap f getSelection)
|
||||||
|
Reference in New Issue
Block a user