[xmonad] Issue 495 in xmonad: XMonad.Util.Run.safeRunInTerm does not work correctly

codesite-noreply at google.com codesite-noreply at google.com
Sun Feb 19 17:50:16 CET 2012


Status: New
Owner: ----

New issue 495 by woofy1... at gmail.com: XMonad.Util.Run.safeRunInTerm does  
not work correctly
http://code.google.com/p/xmonad/issues/detail?id=495

What steps will reproduce the problem?
1. Add a keybinding such as  ((myModMask, xK_a ),  
safeRunInTerm "" "alsamixer" )
2. Recompile and press M-a

What is the expected output? What do you see instead?
Expected: an xterm window with alsamixer running in it.
Actual: nothing, xterm silently dies ('xterm: bad command line option "-e"')

What version of the product are you using? On what operating system?
xmonad 0.10-2 and xmonad-contrib 0.10-1 on Arch Linux.

Please provide any additional information below.
The definition of safeRunInTerm is broken:

safeRunInTerm :: String -> String -> X ()
safeRunInTerm options command = asks (terminal . config) >>= \t ->  
safeSpawn t [options, " -e " ++ command]

In the example, 'safeRunInTerm "" "alsamixer"' will run 'safeSpawn xterm  
["", " -e alsamixer"], which is not the format that xterm, urxvt nor  
lxterminal expect (I have not tested with other terminals).

A possible fix would be a definition such as
safeRunInTermP :: [String] -> [String] -> X ()
safeRunInTermP options command =
     asks (terminal . config) >>= \t -> safeSpawn t (options ++ ["-e"] ++  
command)

which gives the desired behaviour for 'safeRunInTerm [] ["alsamixer"]', and  
correctly allows the specification of multiple arguments to both the  
terminal and the program to be run, eg 'safeRunInTerm ["-fg","#ffff00"]  
["alsamixer","-V","capture"]' works correctly.

The Strings passed to safeRunInTerm could be broken up with 'words' for a  
back compatible wrapper.




More information about the xmonad mailing list