Mouse focus without entering window

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Ico
Reply | Threaded
Open this post in threaded view
|

Mouse focus without entering window

Ico
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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|

Re: Mouse focus without entering window

Andrew Sackville-West-2
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


On Tue, Jan 26, 2016 at 12:49 AM Ico <[hidden email]> wrote:
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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Ico
Reply | Threaded
Open this post in threaded view
|

Re: Mouse focus without entering window

Ico
Hi Samuli and Andrew,

* On 2016-01-26 20:24:18 +0100, Andrew Sackville-West wrote:
>
> 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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|

Re: Mouse focus without entering window

Евгений Курневский
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.

2016-01-26 22:40 GMT+03:00 Ico <[hidden email]>:
Hi Samuli and Andrew,

* On 2016-01-26 20:24:18 +0100, Andrew Sackville-West wrote:
>
> 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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad



--
С уважением, Курневский Евгений.

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|

Re: Mouse focus without entering window

Daniel Wagner-4
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


On Tue, Jan 26, 2016 at 9:46 PM, Евгений Курневский <[hidden email]> wrote:
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.

2016-01-26 22:40 GMT+03:00 Ico <[hidden email]>:
Hi Samuli and Andrew,

* On 2016-01-26 20:24:18 +0100, Andrew Sackville-West wrote:
>
> 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
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad



--
С уважением, Курневский Евгений.

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad



_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|

Re: Mouse focus without entering window

Brandon Allbery
On Sun, Jan 31, 2016 at 3:26 PM, Daniel Wagner <[hidden email]> wrote:
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
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|

Re: Mouse focus without entering window

Daniel Wagner-4
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 

On Sun, Jan 31, 2016 at 2:06 PM, Brandon Allbery <[hidden email]> wrote:
On Sun, Jan 31, 2016 at 3:26 PM, Daniel Wagner <[hidden email]> wrote:
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
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad



_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad
Reply | Threaded
Open this post in threaded view
|

Re: Mouse focus without entering window

Brandon Allbery
On Mon, Feb 1, 2016 at 9:56 PM, Daniel Wagner <[hidden email]> wrote:
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
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

_______________________________________________
xmonad mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/xmonad