Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: option to move cursor to the center of window when focus changes #2577

Closed
I60R opened this issue Sep 5, 2018 · 10 comments
Closed

FR: option to move cursor to the center of window when focus changes #2577

I60R opened this issue Sep 5, 2018 · 10 comments

Comments

@I60R
Copy link

I60R commented Sep 5, 2018

I've had such behavior in xmonad and was very happy with it:

  1. There's no need to remember where cursor position is
  2. It's very handy on floating window
  3. In most of cases it reduces path to target that should be clicked

Unfortunately, Sway don't allows something like that.

As far as I see, i3 allows it, but only when output changes: this option is called mouse_warping.

There's also a blog post that describes how to script i3 to do it. But that requires xdotool, which can't move cursor under Wayland.


Anyway, it seems to be a missing focus value for mouse_warping option.

Would you consider to implement it?

@ddevault
Copy link
Contributor

ddevault commented Sep 5, 2018

afaik mouse_warping only warps the mouse when you change outputs, which is implemented in sway.

@I60R
Copy link
Author

I60R commented Sep 5, 2018

Right, currently it looks like the following:

mouse_warping output|none

But I propose to extend it:

mouse_warping focus|output|none

@ddevault
Copy link
Contributor

ddevault commented Sep 5, 2018

Has this been pitched to i3?

@I60R
Copy link
Author

I60R commented Sep 5, 2018

Nope.
Should I propose this to i3 first?

@ddevault
Copy link
Contributor

ddevault commented Sep 5, 2018

Sure, seems like it'd be useful for both projects.

@I60R
Copy link
Author

I60R commented Sep 5, 2018

Ok, I will do that. Thank you for feedback :)

@I60R
Copy link
Author

I60R commented Sep 6, 2018

Most likely it wouldn't be supported in i3, see this issue for relevant information.
TLDR: it's hard to maintain under X11.

But situation might be better under Wayland. What do you think about that?

@ddevault
Copy link
Contributor

ddevault commented Sep 6, 2018

Sure, sounds good. Let's do it.

@leonm1
Copy link

leonm1 commented Sep 10, 2018

I'd be interested in doing this feature as my first contribution. I found the code responsible for warping the cursor on a change to a new workspace here, and I believe the only change needed would be to remove && new_output != last_output from line 714 and make it conditional on the user's settings.

  1. Would this be a good first issue?
  2. Is this a good solution to the request?

@RyanDwyer
Copy link
Member

Would this be a good first issue?

Yep.

Is this a good solution to the request?

Yes, but you'll also need to change the mouse_warping command to accept a container argument (ie. mouse_warping none|container|output). This means config->mouse_warping can't be a boolean any more. Then yeah, the code you highlighted will need to be changed to respect the user's settings.

Emantor added a commit to Emantor/sway that referenced this issue Oct 10, 2018
This option always moves the cursor into the middle of the container if the warp
variable is true in seat_focus_set_focus_warp.

Fixes swaywm#2577
Emantor added a commit to Emantor/sway that referenced this issue Oct 10, 2018
This option always moves the cursor into the middle of the container if the warp
variable is true in seat_set_focus_warp.

Fixes swaywm#2577
Emantor added a commit to Emantor/sway that referenced this issue Oct 10, 2018
This option always moves the cursor into the middle of the container if the warp
variable is true in seat_set_focus_warp.

Fixes swaywm#2577
Emantor added a commit to Emantor/sway that referenced this issue Oct 10, 2018
This option always moves the cursor into the middle of the container if the warp
variable is true in seat_set_focus_warp.

Fixes swaywm#2577
Emantor added a commit to Emantor/sway that referenced this issue Oct 10, 2018
This option always moves the cursor into the middle of the container if the warp
variable is true in seat_set_focus_warp.

Fixes swaywm#2577
Emantor added a commit to Emantor/sway that referenced this issue Oct 10, 2018
This option always moves the cursor into the middle of the container if the warp
variable is true in seat_set_focus_warp.

Fixes swaywm#2577
Emantor added a commit to Emantor/sway that referenced this issue Oct 10, 2018
This option always moves the cursor into the middle of the container if the warp
variable is true in seat_set_focus_warp.

Fixes swaywm#2577
Emantor added a commit to Emantor/sway that referenced this issue Oct 10, 2018
This option always moves the cursor into the middle of the container if the warp
variable is true in seat_set_focus_warp.

Fixes swaywm#2577
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants