mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-15 04:05:53 -07:00
Run.hs, SshPrompt.hs, ShellPrompt.hs: mv runInXTerm back into Run.hs per suggestions
This commit is contained in:
7
Run.hs
7
Run.hs
@@ -22,10 +22,12 @@ module XMonadContrib.Run (
|
||||
runProcessWithInputAndWait,
|
||||
safeSpawn,
|
||||
unsafeSpawn,
|
||||
runInXTerm,
|
||||
seconds
|
||||
) where
|
||||
|
||||
import Control.Monad.State (Monad((>>), return), when)
|
||||
import System.Environment (getEnv)
|
||||
import System.Posix.Process (createSession, forkProcess, executeFile,
|
||||
getProcessStatus)
|
||||
import Control.Concurrent (threadDelay)
|
||||
@@ -102,3 +104,8 @@ safeSpawn :: FilePath -> String -> X ()
|
||||
safeSpawn prog arg = io (try (forkProcess $ executeFile prog True [arg] Nothing) >> return ())
|
||||
unsafeSpawn :: String -> X ()
|
||||
unsafeSpawn = spawn
|
||||
|
||||
runInXTerm :: String -> X ()
|
||||
runInXTerm com = do
|
||||
c <- io $ catch (getEnv "XTERMCMD") (const $ return "xterm")
|
||||
spawn ("exec " ++ c ++ " -e " ++ com)
|
||||
|
@@ -20,7 +20,6 @@ module XMonadContrib.ShellPrompt (
|
||||
, split
|
||||
, prompt
|
||||
, safePrompt
|
||||
, runInXTerm
|
||||
) where
|
||||
|
||||
import System.Environment (getEnv)
|
||||
@@ -76,12 +75,6 @@ safePrompt c config = mkXPrompt Shell config (getShellCompl [c]) run
|
||||
unsafePrompt c config = mkXPrompt Shell config (getShellCompl [c]) run
|
||||
where run a = unsafeSpawn $ c ++ " " ++ a
|
||||
|
||||
-- This may be better done as a specialization of 'prompt'
|
||||
runInXTerm :: String -> X ()
|
||||
runInXTerm com = do
|
||||
c <- io $ catch (getEnv "XTERMCMD") (const $ return "xterm")
|
||||
spawn ("exec " ++ c ++ " -e " ++ com)
|
||||
|
||||
getShellCompl :: [String] -> String -> IO [String]
|
||||
getShellCompl cmds s | s == "" || last s == ' ' = return []
|
||||
| otherwise = do
|
||||
|
@@ -19,7 +19,6 @@ module XMonadContrib.SshPrompt (
|
||||
) where
|
||||
|
||||
import System.Environment (getEnv)
|
||||
import XMonadContrib.ShellPrompt (runInXTerm)
|
||||
import Control.Monad(Monad (return), Functor(..), liftM2, mapM)
|
||||
import Data.List ((++), concat, filter, map, words, lines, takeWhile, take,
|
||||
sort)
|
||||
@@ -27,6 +26,7 @@ import Data.Maybe (Maybe(..), catMaybes)
|
||||
import Data.Set (toList, fromList)
|
||||
import System.Directory (doesFileExist)
|
||||
import XMonad (X, io)
|
||||
import XMonadContrib.Run (runInXTerm)
|
||||
import XMonadContrib.XPrompt (XPrompt(..), XPConfig, mkXPrompt,
|
||||
mkComplFunFromList)
|
||||
-- $usage
|
||||
|
Reference in New Issue
Block a user