[xmonad] runOrRaiseNext lost functionality in xmonad 0.9?

Adam Vogt vogt.adam at gmail.com
Sun Jul 11 22:30:28 EDT 2010

* On Sunday, July 11 2010, Joseph Garvin wrote:

>I used to have the following line in my xmonad.hs to bind Win+F to
>either open a new firefox or switch to an existing one in a way that
>would work across multiple Ubuntu versions:
>((modMask,  xK_f), runOrRaiseNext "firefox-3.5 || firefox3 || firefox"
>(className =? "Firefox" <||> className =? "Shiretoko"))
>The ||'s would be interpreted by the shell, first trying firefox-3.5,
>then if it didn't work firefox3, etc. This worked great. But upgrading
>to xmonad 0.9.1-2 (installed Lucid Lynx) this functionality broke. Now
>nothing happens when I press Win+F, and I receive no errors.

The change is intentional:

Mon Jun 22 15:32:55 EDT 2009  gwern0 at gmail.com
  * XMonad.Actions.WindowGo: switch to safeSpawn, since everyone just passes a prog name (no shell scripting)

>If I just put "firefox" then it works, but "firefox || firefox" does
>not, leading me to believe the command is no longer executed through
>the shell. Is this intentional? If it is, is there a way that xmonad
>provides for me to query what's in $PATH so I can bind the right
>version of firefox?

You can call out to the shell to check with 'which' with the following
expression you can put where you had runOrRaiseNext:

 (_,paths,_) <- io $ readProcessWithExitCode
 -- run the first one that exists
 case lines paths of
    firefox : _ -> runOrRaiseNext firefox ...
    _ -> return () -- or something else?


More information about the xmonad mailing list