[xmonad] Re: Issue 343 in xmonad: XMonad.Prompt.RunOrRaise doesnt always detect an already running program

codesite-noreply at google.com codesite-noreply at google.com
Mon Nov 23 13:07:36 EST 2009

	Status: Accepted
	Labels: Type-Defect Priority-Low Component-Contrib Usability

Comment #4 on issue 343 by gwern0: XMonad.Prompt.RunOrRaise doesnt always  
detect an already running program

OK, I think I sort of see the problem. You specified you are using the  
Prompt module,
right, not the raw WindowGo/runOrRaise code. The Prompt module has a line  

> isApp :: String -> Query Bool
> isApp "firefox"     = className =? "Firefox-bin"     <||> className  
> =? "Firefox"

Your Firefoxes, though, say

> WM_CLASS(STRING) = "Navigator", "Shiretoko"

Looking at the prompt, it runs

> open :: String -> X ()
> open path = io (isNormalFile path) >>= \b ->
>              if b
>              then spawn $ "xdg-open \"" ++ path ++ "\""
>              else uncurry runOrRaise . getTarget $ path

Now 'firefox' maps to no filepath or directory, so we fall through to the  
'getTarget' runs on the argument 'firefox', and it is defined as:

> getTarget x = (x,isApp x)

As we saw, 'isApp' is defined incorrectly, so it will fail and return Query  
which will make 'runOrRaise' shrug and just execute whatever program is  
'firefox'. Firefox however is smart enough to know it's already running,  
and will
just open a new window or tab, rather than a whole new browser.

So, that's what's wrong.

The solution probably involves something like 'raiseBrowser' and  
the 'raiseVar' code
in WindowGo & ShellPrompt, but I'll let Justin decide what is the best  
solution. (The
obvious quick hack is to make isApp accept Navigator and Shiretoko as  
matching apps. But the whole isApp idea is bad.)

You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:

More information about the xmonad mailing list