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

Status: New Owner: ---- New issue 343 by h2oz7v: XMonad.Prompt.RunOrRaise doesnt always detect an already running program http://code.google.com/p/xmonad/issues/detail?id=343 What steps will reproduce the problem? 1. Launch a Firefox instance using RunOrRaise 2. Switch workspaces 3. Launch Firefox again in RunOrRaise What is the expected output? What do you see instead? I expect the already running instance of Firefox to be moved ("raised") to the different workspace. Instead, a new Firefox window is opened. What version of the product are you using? On what operating system? Linux, xmonad v0.9 -- 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: http://code.google.com/hosting/settings

Comment #1 on issue 343 by gwern0: XMonad.Prompt.RunOrRaise doesnt always detect an already running program http://code.google.com/p/xmonad/issues/detail?id=343 Odd. Could you supply the xprop output for the 2 Firefox windows, check within firefox to see whether they're running 2 different profiles, and make sure that it isn't that the first Firefox simply hasn't opened up yet when you switched and did RoR a second time? -- 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: http://code.google.com/hosting/settings

Comment #2 on issue 343 by h2oz7v: XMonad.Prompt.RunOrRaise doesnt always detect an already running program http://code.google.com/p/xmonad/issues/detail?id=343 1. xprop output Firefox window one: https://gist.github.com/8e5b99edba20817873e6 Firefox window two: https://gist.github.com/f1fbd285158ecf471268 (ooo ascii icons!) 2. Firefox profiles Wasn't sure where to look for this. I only have one profile in my home directory: /home/user/.mozilla/firefox/7y6oa6fw.default If I look in about:cache for both windows, they both mention: 7y6oa6fw.default 3. "It was working all along" Nope, it definitely opens up a new window (they open side by side if launched within the same workspace), though only one process is running: $ pgrep -lf firefox 3477 firefox -- 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: http://code.google.com/hosting/settings

Comment #3 on issue 343 by byorgey: XMonad.Prompt.RunOrRaise doesnt always detect an already running program http://code.google.com/p/xmonad/issues/detail?id=343 Thanks. Can you also attach your xmonad.hs so we can see how you are using RunOrRaise? What property are you using to try to match the Firefox windows? -- 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: http://code.google.com/hosting/settings

Updates: 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 http://code.google.com/p/xmonad/issues/detail?id=343 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 like
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 else. '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 False, which will make 'runOrRaise' shrug and just execute whatever program is named '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 strings 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: http://code.google.com/hosting/settings

Comment #5 on issue 343 by SpencerJanssen: XMonad.Prompt.RunOrRaise doesnt always detect an already running program http://code.google.com/p/xmonad/issues/detail?id=343 raiseBrowser won't help here, it makes the same mistake of assuming that the application's command-line name is the same as WM_CLASS. An alternative is to replace the hard-coded isApp with an argument to runOrRaisePrompt, allowing the user to extend the set of workarounds. I say "workaround" because what RunOrRaise attempts to do is not possible in general, as there is no standard way to match command lines with X windows. -- 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: http://code.google.com/hosting/settings
participants (1)
-
codesite-noreply@google.com