Discussion:
[xmonad] Focus chrome window after changing workspace
Juliusz Gonera
2015-06-18 05:59:38 UTC
Permalink
Hi all,

After i switch workspace in xmonad with e.g. Alt+3 my google-chrome window
in workspace 3 has no focus.

I'd like xmonad to automatically give focus to the top window in the
workspace i'm switching to.

I'm using xmonad 0.11 with chrome 45, ubuntu 15.04


Is anyone familiar with this problem?


--

Best,

jg
Brandon Allbery
2015-06-18 12:58:09 UTC
Permalink
Post by Juliusz Gonera
After i switch workspace in xmonad with e.g. Alt+3 my google-chrome window
in workspace 3 has no focus.
Focus problems from recent Chrome seem to be related to not having
EWMHDesktops enabled or configured properly. It's no longer optional; if
you are using Chrome/Chromium you MUST use EWMHDesktops or it won't work
right.
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Juliusz Gonera
2015-06-18 13:08:16 UTC
Permalink
Is there a working config snippet that just makes this problem go away?
Post by Brandon Allbery
Post by Juliusz Gonera
After i switch workspace in xmonad with e.g. Alt+3 my google-chrome
window in workspace 3 has no focus.
Focus problems from recent Chrome seem to be related to not having
EWMHDesktops enabled or configured properly. It's no longer optional; if
you are using Chrome/Chromium you MUST use EWMHDesktops or it won't work
right.
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
Brandon Allbery
2015-06-18 13:14:51 UTC
Permalink
Assuming you're not overriding logHook (or are doing it properly which
sadly many do not), you can just import XMonad.Hooks.EWMHDesktops and apply
the ewmh combinator to your config record.

If you're using the bad configuration that too many people point to as a
"default" (the big one that overrides literally everything with defaults
from a particular version) then there may not be any easy way to do it.
That config was never a good idea, for all its popularity; it's a leftover
from pre-0.5's hardcoded config.
Post by Juliusz Gonera
Is there a working config snippet that just makes this problem go away?
Post by Brandon Allbery
Post by Juliusz Gonera
After i switch workspace in xmonad with e.g. Alt+3 my google-chrome
window in workspace 3 has no focus.
Focus problems from recent Chrome seem to be related to not having
EWMHDesktops enabled or configured properly. It's no longer optional; if
you are using Chrome/Chromium you MUST use EWMHDesktops or it won't work
right.
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Juliusz Gonera
2015-06-18 13:24:25 UTC
Permalink
Works great! Many thanks for your help Brandon!
Post by Brandon Allbery
Assuming you're not overriding logHook (or are doing it properly which
sadly many do not), you can just import XMonad.Hooks.EWMHDesktops and apply
the ewmh combinator to your config record.
If you're using the bad configuration that too many people point to as a
"default" (the big one that overrides literally everything with defaults
from a particular version) then there may not be any easy way to do it.
That config was never a good idea, for all its popularity; it's a leftover
from pre-0.5's hardcoded config.
Post by Juliusz Gonera
Is there a working config snippet that just makes this problem go away?
On Thu, Jun 18, 2015 at 1:59 AM, Juliusz Gonera <
Post by Juliusz Gonera
After i switch workspace in xmonad with e.g. Alt+3 my google-chrome
window in workspace 3 has no focus.
Focus problems from recent Chrome seem to be related to not having
EWMHDesktops enabled or configured properly. It's no longer optional; if
you are using Chrome/Chromium you MUST use EWMHDesktops or it won't work
right.
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
Josiah Schwab
2015-06-19 16:17:28 UTC
Permalink
Hello Brandon,
Post by Brandon Allbery
Assuming you're not overriding logHook (or are doing it properly which
sadly many do not), you can just import XMonad.Hooks.EWMHDesktops and apply
the ewmh combinator to your config record.
If you're using the bad configuration that too many people point to as a
"default" (the big one that overrides literally everything with defaults
from a particular version) then there may not be any easy way to do it.
That config was never a good idea, for all its popularity; it's a leftover
from pre-0.5's hardcoded config.
Would you be able to point me (& others) towards some resources to
better understand how to write a "good" configuration?

I based my config from the example (man/xmonad.hs) that ships with
xmonad-0.11 on Arch Linux. Is an example of a bad config? With my
limited understanding, it seems like it matches your description.

Best,
Josiah
Brandon Allbery
2015-06-20 00:59:09 UTC
Permalink
Post by Josiah Schwab
I based my config from the example (man/xmonad.hs) that ships with
xmonad-0.11 on Arch Linux. Is an example of a bad config? With my
limited understanding, it seems like it matches your description.
It hasd a limpid comment at the top that contains its real danger; I keep
trying to get a much stronger warning added, but despite repeated requests
that one is still there and still does not have a proper warning.

It is an example of how to override every setting. It does so by overriding
every setting, with the defaults for one particular version of xmonad; this
means you do not inherit any defaults, and if the defaults change in a
later version then you will not see those changes (this bit a lot of people
when dmenu changed its usage and we updated the mod-p binding, but people
using that "example" didn't get the change because the old way was
hardcoded in their configs. That was what convinced me that that example
was Evil). If we were to change the implementation in certain ways, or if
you use an example from a later version with an earlier version (someone
popped up on IRC with that problem the other day), it wouldn't even compile.

The correct place to start is shown on the xmonad wiki:

https://wiki.haskell.org/Xmonad/Config_archive/Template_xmonad.hs_(darcs)

(which is actually valid for 0.10 and later).

If you want to truly start "from scratch",
https://wiki.haskell.org/Xmonad/Config_archive/John_Goerzen%27s_Configuration
is a little dated but still valid.

(I'm still working my way through trying to get the wiki up to date. Nobody
else seems interested in doing so, sigh.)
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Loading...