Discussion:
[xmonad] Mouse focus without entering window
Andrew Sackville-West
2016-01-26 19:24:18 UTC
Permalink
One solution, while not ideal, is to morph the pointer to follow window
focus. Then grabbing the mouse and moving it to the desired window would
force focus to follow you back there. This isn't strictly what you're
asking for but does provide a pretty intuitive recovery of mouse oriented
focus.

Look at XMonad.Actions.UpdatePointer

A
Hi Xmonad,
I'd like xmonad to give focus to the window under my mouse cursor,
independent of entering or leaving the window.
Consider the following use case: one workspace with two windows. The
mouse and focus are both in the left window. I use the keyboard to give
focus to the right window (alt-tab or similar). To give focus back to
the left window by mouse, I first need to move the mouse outside and
then back into the window. Instead i'd like focus to pop back to window
one as soon as I move the mouse. (Yes, I know I could/should give focus
back with alt tab again, but that is not the point
I have more similar use cases, some using multiple work spaces, where
I'd like to see he same focus behaviour.
According to #xmonad on irc some would consider this behaviour buggy,
which I can understand. Is there still a way to make Xmonad act like
described?
Thank you,
Ico
--
:wq
^X^Cy^K^X^C^C^C^C
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Евгений Курневский
2016-01-27 05:46:12 UTC
Permalink
Be careful - with XMonad.Actions.UpdatePointer mouse cursor gets stuck in
the monitor corners sometimes. I made pull request to fix this
https://github.com/xmonad/xmonad-contrib/pull/17 , but it is not merget at
the moment.
Hi Samuli and Andrew,
Post by Andrew Sackville-West
Look at XMonad.Actions.UpdatePointer
Thanks for pointing me to UpdatePointer. It's indeed not exactly what I
ment, but I guess it is close enough and solves my problem for now.
Ico
--
:wq
^X^Cy^K^X^C^C^C^C
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
--
С уважеМОеЌ, КурМевскОй ЕвгеМОй.
Daniel Wagner
2016-01-31 20:26:39 UTC
Permalink
You should be able to do this with the `handleEventHook` [1], for which the
`MotionEvent` [2] is the appropriate event to handle. You should be able to
use `focus` [3] on the `Window` contained in the event to focus the window
the mouse is currently over. Caveat emptor, this advice is entirely
untested -- no idea what odd corners there are, or even whether it will
work (e.g. I vaguely recall that xmonad used to ignore motion events in
some circumstances; I don't see that in the code now but I wouldn't be
surprised if it were still the case somehow).

~d

[1]
http://hackage.haskell.org/package/xmonad-0.12/docs/XMonad-Core.html#v:handleEventHook
[2]
http://hackage.haskell.org/package/X11-1.6.1.2/docs/Graphics-X11-Xlib-Extras.html#v:MotionEvent
[3]
http://hackage.haskell.org/package/xmonad-0.12/docs/XMonad-Operations.html#v:focus
Post by Евгений Курневский
Be careful - with XMonad.Actions.UpdatePointer mouse cursor gets stuck in
the monitor corners sometimes. I made pull request to fix this
https://github.com/xmonad/xmonad-contrib/pull/17 , but it is not merget
at the moment.
Hi Samuli and Andrew,
Post by Andrew Sackville-West
Look at XMonad.Actions.UpdatePointer
Thanks for pointing me to UpdatePointer. It's indeed not exactly what I
ment, but I guess it is close enough and solves my problem for now.
Ico
--
:wq
^X^Cy^K^X^C^C^C^C
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
--
С уважеМОеЌ, КурМевскОй ЕвгеМОй.
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Brandon Allbery
2016-01-31 22:06:14 UTC
Permalink
Post by Daniel Wagner
You should be able to do this with the `handleEventHook` [1], for which
the `MotionEvent` [2] is the appropriate event to handle. You should be
able to use `focus` [3] on the `Window` contained in the event to focus the
window the mouse is currently over
Isn't this basically takeTopFocus (i.e. ICCCM WM_TAKE_FOCUS)?
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Daniel Wagner
2016-02-02 02:56:07 UTC
Permalink
Well, I haven't tested it, but the code of `takeTopFocus` looks pretty
different to me:

withWindowSet $ maybe (setFocusX =<< asks theRoot) takeFocusX . W.peek

To me, that reads as "if nothing is focused, focus the root window",
whereas the desired behavior is "no matter what's focused right now, focus
the window under the mouse". So both the condition and the action to take
seem different to me...?

~d
Post by Brandon Allbery
Post by Daniel Wagner
You should be able to do this with the `handleEventHook` [1], for which
the `MotionEvent` [2] is the appropriate event to handle. You should be
able to use `focus` [3] on the `Window` contained in the event to focus the
window the mouse is currently over
Isn't this basically takeTopFocus (i.e. ICCCM WM_TAKE_FOCUS)?
--
brandon s allbery kf8nh sine nomine associates
unix, openafs, kerberos, infrastructure, xmonad
http://sinenomine.net
_______________________________________________
xmonad mailing list
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Brandon Allbery
2016-02-03 01:12:36 UTC
Permalink
Post by Daniel Wagner
Well, I haven't tested it, but the code of `takeTopFocus` looks pretty
different to me
I meant more "same basic concept", although indeed takeTopFocus does not do
identically what was requested. The point was more that, since takeTopFocus
works, similar focus changers should also work --- because that was the
question.
--
brandon s allbery kf8nh sine nomine associates
***@gmail.com ***@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
Continue reading on narkive:
Loading...