8000 Creating a process in a keybinding fails · Issue #229 · xmonad/xmonad · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Creating a process in a keybinding fails #229
Open
@noughtmare

Description

@noughtmare

Problem Description

Creating a process in a keybinding fails. I know this can be fixed by using
xfork, but I would like to know why it does not work like this.

See this reddit thread.

Configuration File

{-# LANGUAGE TypeApplications #-}
module Main (main) where

import XMonad
import System.Process (readProcess)
import Control.Monad (void)
import Data.Map (singleton)
import Control.Exception (try, SomeException)

main :: IO ()
main = xmonad def
  { keys = \cfg ->
      singleton
        (modMask cfg, xK_a)
        (io $ do
          x <- try @SomeException (readProcess "dmenu" [] "")
          case x of
            Left e -> spawn ("xmessage \"Error: " ++ show e ++ "\"")
            Right _ -> spawn "xmessage Good!")
      <> keys def cfg
  }

This first starts dmenu normally then after you press enter (or escape) it opens an xmessage window with the text:

Error: waitForProcess: does not exist (No child processes)

Checklist

xmonad-testing does not seem to be up-to-date anymore? I've tested this with xmonad 0.15 from Hackage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0