module XMonad.Prompt.AppLauncher (
launchApp
,module XMonad.Prompt
,Application, AppPrompt,
) where
import XMonad (X(),MonadIO)
import XMonad.Core (spawn)
import XMonad.Prompt (XPrompt(showXPrompt), mkXPrompt, XPConfig(searchPredicate))
import XMonad.Prompt.Shell (getShellCompl)
data AppPrompt = AppPrompt String
instance XPrompt AppPrompt where
showXPrompt :: AppPrompt -> String
showXPrompt (AppPrompt n :: String
n) = String
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ " "
type Application = String
type Parameters = String
launch :: MonadIO m => Application -> Parameters -> m ()
launch :: String -> String -> m ()
launch app :: String
app params :: String
params = String -> m ()
forall (m :: * -> *). MonadIO m => String -> m ()
spawn ( String
app String -> String -> String
forall a. [a] -> [a] -> [a]
++ " " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
params )
launchApp :: XPConfig -> Application -> X ()
launchApp :: XPConfig -> String -> X ()
launchApp config :: XPConfig
config app :: String
app = AppPrompt -> XPConfig -> ComplFunction -> (String -> X ()) -> X ()
forall p.
XPrompt p =>
p -> XPConfig -> ComplFunction -> (String -> X ()) -> X ()
mkXPrompt (String -> AppPrompt
AppPrompt String
app) XPConfig
config ([String] -> Predicate -> ComplFunction
getShellCompl [] (Predicate -> ComplFunction) -> Predicate -> ComplFunction
forall a b. (a -> b) -> a -> b
$ XPConfig -> Predicate
searchPredicate XPConfig
config) ((String -> X ()) -> X ()) -> (String -> X ()) -> X ()
forall a b. (a -> b) -> a -> b
$ String -> String -> X ()
forall (m :: * -> *). MonadIO m => String -> String -> m ()
launch String
app