mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-22 07:23:47 -07:00
Run.hs: add an option to runinterms
It turns out that for urxvt, and most terminal, apparently, once you give a '-e' option, that's it. They will not interpret anything after that as anything but input for /bin/sh, so if you wanted to go 'runInTerm "'screen -r session' -title IRC"', you were SOL - the -title would not be seen by urxvt. This, needless to say, is bad, since then you can't do stuff like set the title which means various hooks and extensions are helpless. This patch adds an extra options argument which is inserted *before* the -e. If you want the old behaivour, you can just go 'runInTerm "" "executable"', but now if you need to do something extra, 'runInTerm "-title mutt" "mutt"' works fine. This patch also updates callers.
This commit is contained in:
@@ -58,7 +58,7 @@ instance XPrompt Man where
|
|||||||
manPrompt :: XPConfig -> X ()
|
manPrompt :: XPConfig -> X ()
|
||||||
manPrompt c = do
|
manPrompt c = do
|
||||||
mans <- io getMans
|
mans <- io getMans
|
||||||
mkXPrompt Man c (manCompl mans) $ runInTerm . (++) "man "
|
mkXPrompt Man c (manCompl mans) $ runInTerm "" . (++) "man "
|
||||||
|
|
||||||
getMans :: IO [String]
|
getMans :: IO [String]
|
||||||
getMans = do
|
getMans = do
|
||||||
|
@@ -56,7 +56,7 @@ sshPrompt c = do
|
|||||||
mkXPrompt Ssh c (mkComplFunFromList sc) ssh
|
mkXPrompt Ssh c (mkComplFunFromList sc) ssh
|
||||||
|
|
||||||
ssh :: String -> X ()
|
ssh :: String -> X ()
|
||||||
ssh s = runInTerm ("ssh " ++ s)
|
ssh s = runInTerm "" ("ssh " ++ s)
|
||||||
|
|
||||||
sshComplList :: IO [String]
|
sshComplList :: IO [String]
|
||||||
sshComplList = uniqSort `fmap` liftM2 (++) sshComplListLocal sshComplListGlobal
|
sshComplList = uniqSort `fmap` liftM2 (++) sshComplListLocal sshComplListGlobal
|
||||||
|
@@ -56,7 +56,7 @@ runProcessWithInput cmd args input = do
|
|||||||
hPutStr pin input
|
hPutStr pin input
|
||||||
hClose pin
|
hClose pin
|
||||||
output <- hGetContents pout
|
output <- hGetContents pout
|
||||||
when (output==output) $ return ()
|
when (output == output) $ return ()
|
||||||
hClose pout
|
hClose pout
|
||||||
hClose perr
|
hClose perr
|
||||||
waitForProcess ph
|
waitForProcess ph
|
||||||
@@ -112,11 +112,11 @@ unsafeSpawn = spawn
|
|||||||
|
|
||||||
-- | Run a given program in the preferred terminal emulator. This uses
|
-- | Run a given program in the preferred terminal emulator. This uses
|
||||||
-- 'safeSpawn'.
|
-- 'safeSpawn'.
|
||||||
safeRunInTerm :: String -> X ()
|
safeRunInTerm :: String -> String -> X ()
|
||||||
safeRunInTerm command = asks (terminal . config) >>= \t -> safeSpawn t ("-e " ++ command)
|
safeRunInTerm options command = asks (terminal . config) >>= \t -> safeSpawn t (options ++ " -e " ++ command)
|
||||||
|
|
||||||
unsafeRunInTerm, runInTerm :: String -> X ()
|
unsafeRunInTerm, runInTerm :: String -> String -> X ()
|
||||||
unsafeRunInTerm command = asks (terminal . config) >>= \t -> unsafeSpawn $ t ++ " -e " ++ command
|
unsafeRunInTerm options command = asks (terminal . config) >>= \t -> unsafeSpawn $ t ++ " " ++ options ++ " -e " ++ command
|
||||||
runInTerm = unsafeRunInTerm
|
runInTerm = unsafeRunInTerm
|
||||||
|
|
||||||
-- | Launch an external application and return a 'Handle' to its standard input.
|
-- | Launch an external application and return a 'Handle' to its standard input.
|
||||||
|
Reference in New Issue
Block a user