how to handle "request focus" events properly

Hi there, I'm wondering what is the proper way of handling some "request focus" events, I have some scenario here: scenario #1: - I have multiple firefox windows running. one of which has opened a " twitter.com". - I open another firefox window in another workspace, as I'm typing in " twitter.com", firefox gives me an option to "Switch to tab", but when I press enter on it, nothing happens. scenario #2: - I have a pidgin running, I want to click the icon from system tray(for example, trayer) and open the buddy list. - If the buddy list has been opened in somewhere else, nothing will happen as well. I'm not familar with Xlib but I think they might have some events to tell xmonad that a window is requesting the focus, that would be great if I can modify my conf to handle these messages. I'll appreciate it if you can give me some hints. Thanks

On Sat, Nov 30, 2013 at 11:09 PM, Javran Cheng
I'm wondering what is the proper way of handling some "request focus" events, I have some scenario here:
If you have EwmhDesktops configured (including by using XMonad.Config.Desktop as your base config, or one of its descendants such as XMonad.Config.Xfce or XMonad.Config.Gnome) then we handle the EWMH focus request message. Many people do not like it when their browser demands focus (Firefox and Chrome are both happy to demand focus when some other program has focus, instead of only when they are switching focus from one of their windows to another), so we do not force support for the EWMH focus change message by default as this would make it very difficult to turn off. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

Brandon Allbery
On Sat, Nov 30, 2013 at 11:09 PM, Javran Cheng
wrote: I'm wondering what is the proper way of handling some "request focus" events, I have some scenario here:
If you have EwmhDesktops configured (including by using XMonad.Config.Desktop as your base config, or one of its descendants such as XMonad.Config.Xfce or XMonad.Config.Gnome) then we handle the EWMH focus request message.
Many people do not like it when their browser demands focus (Firefox and Chrome are both happy to demand focus when some other program has focus, instead of only when they are switching focus from one of their windows to another), so we do not force support for the EWMH focus change message by default as this would make it very difficult to turn off.
I positively hate that Firefox, if visible on the other screen, steals focus from my MUA when I click on some URL which Firefox opens. How could I get rid of this? My config is basically: main = do xmproc <- spawnPipe "xmobar /home/wferi/.xmonad/xmobar.hs" xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig { terminal = "urxvt", manageHook = composeAll [logNewWindows, manageHook defaultConfig, manageDocks, title =? "Audio Settings" --> doFloat], layoutHook = smartBorders $ avoidStruts $ layoutHook defaultConfig, logHook = dynamicLogWithPP $ sjanssenPP { ppOutput = hPutStrLn xmproc, ppUrgent = xmobarColor "red" "" } } `additionalKeysP` [ ("M-S-l", spawn "sleep 1; xset dpms force off; xtrlock") ] logNewWindows :: ManageHook logNewWindows = do wt <- title wr <- appName wc <- className io . putStrLn . concat $ ["new window ",wr,"/",wc," \"",wt,"\""] idHook -- Thanks, Feri.

On Tue, Dec 17, 2013 at 1:30 PM, Ferenc Wagner
I positively hate that Firefox, if visible on the other screen, steals focus from my MUA when I click on some URL which Firefox opens. How could I get rid of this? My config is basically:
That doesn't seem to have the EWMH hooks, so Firefox is probably falling back to hard focusing its own windows. About the only way to prevent that is to arrange for it to have a dummy XSetInputFocus() in scope, or to use a hacked EWMH that advertises but ignores the EWMH focus change event. (This hacked EWMH is not in xmonad-contrib. Yet.) -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On 2013-17-12, Ferenc Wagner
I positively hate that Firefox, if visible on the other screen, steals focus from my MUA when I click on some URL which Firefox opens. How could I get rid of this?
Did you set Firefox' browser.tabs.loadDivertedInBackground setting to true in about:config? Apart from not selecting the new tab in the Firefox window it also prevents Firefox from grabbing the window manager focus.
participants (4)
-
Brandon Allbery
-
Ferenc Wagner
-
Javran Cheng
-
Sebastian Schwarz