[xmonad] how to handle "request focus" events properly

Ferenc Wagner wferi at niif.hu
Tue Dec 17 18:30:54 UTC 2013


Brandon Allbery <allbery.b at gmail.com> writes:

> On Sat, Nov 30, 2013 at 11:09 PM, Javran Cheng <javran.c at gmail.com> 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.


More information about the xmonad mailing list