[xmonad] Launch without double-fork

wagnerdm at seas.upenn.edu wagnerdm at seas.upenn.edu
Tue Dec 1 15:28:58 EST 2009


Two questions:

- does this play well with configs that have arguments to the terminal  
command?  (e.g. urxvt -name foo)
- does this play well with zombification?

~d

Quoting Luis Cabellos <zhen.sydow at gmail.com>:

> Hi, I was checking why there is two procces every time than I launch a
> console. I found than spawn uses /bin/sh to lauch applications. I
> think than to expecific commands is no need to double-fork,
>
> I added the patch lo launch console without double-fork:
>
> diff -rN old-xmonad/XMonad/Config.hs new-xmonad/XMonad/Config.hs
> 183c183
> <     [ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal
> conf) -- %! Launch terminal
> ---
>>     [ ((modMask .|. shiftMask, xK_Return), spawnf $ XMonad.terminal  
>> conf) -- %! Launch terminal
> diff -rN old-xmonad/XMonad/Core.hs new-xmonad/XMonad/Core.hs
> 30c30
> <     getAtom, spawn, spawnPID, getXMonadDir, recompile, trace,  
> whenJust, whenX,
> ---
>>     getAtom, spawn, spawnPID, spawnf, spawnPIDf, getXMonadDir,  
>> recompile, trace, whenJust, whenX,
> 406a407,424
>> -- | spawnf. Launch an external application. It forks the application and
>> -- runs the 'String' using the PATH to locate
>> -- runs the 'String' you pass as a command to /bin/sh.
>> spawnf :: MonadIO m => String -> m ()
>> spawnf x = spawnPIDf x >> return ()
>>
>> -- | Like 'spawnf', but returns the 'ProcessID' of the launched application
>> spawnPIDf :: MonadIO m => String -> m ProcessID
>> spawnPIDf x = io . forkProcess . finally nullStdin $ do
>>                 uninstallSignalHandlers
>>                 createSession
>>                 executeFile x True [] Nothing
>>  where
>>     nullStdin = do
>>         fd <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags
>>         dupTo fd stdInput
>>         closeFd fd
>>
>
>
> What do you think?
>
> --
>
> LC, ("There is no Dana, only Zuul." - Cazafantasmas [1984])
> _______________________________________________
> xmonad mailing list
> xmonad at haskell.org
> http://www.haskell.org/mailman/listinfo/xmonad
>
>




More information about the xmonad mailing list