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

Binding to unlock the mouse when it is hidden / confined by a window #4943

Open
Ashe opened this issue Mar 3, 2024 · 4 comments
Open

Binding to unlock the mouse when it is hidden / confined by a window #4943

Ashe opened this issue Mar 3, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@Ashe
Copy link

Ashe commented Mar 3, 2024

Description

So, some video games and other applications steal your mouse for the sake of letting you control the camera. In other applications one might alt-tab or something, however in hyprland if you mouse even touches the window it gets stolen again. Normally I want the hovered window to be active, but for windows that steal the mouse that is less so.

It would be neat to make it so that if I held the windows key (or any other binding), the mouse would always appear and not be stolen by a window and let me move the mouse without any window being active. That would allow me to move it to another window without consequence, and then releasing the key would then go back to the old behaviour. This could also allow me to move and resize the window without it necessarily being 'active'.

This would also be useful for windows where the mouse cannot be moved out of the window, and probably some other use cases.

I know that you can use the keyboard to move the mouse out of the window, but in some situations this is annoying. Say a game defaults to floating mode and full screen AND steals your mouse, you kind of just have to de-float it and hope it allows that. This new feature would allow me to move the window and resize it and organise my windows without worrying about the application trying to take control of my mouse.

Thank you for reading :)

@Ashe Ashe added the enhancement New feature or request label Mar 3, 2024
@vaxerski
Copy link
Member

vaxerski commented Mar 3, 2024

patch.txt

untested but should work. Dispatcher "unlockmouse"

@Ashe
Copy link
Author

Ashe commented Mar 5, 2024

Thank you for this, I tried configuring it two different ways which seemed to be accepted:

bindm = SUPER, , unlockmouse
bindr = SUPER, , unlockmouse

But I found a few issues:

  • Unsure if its a bug with this or not, but my house hides by itself periodically?
  • Mouse is still hidden by the program (tested with helldivers because everyone is playing that atm)
  • It does allow for things like resizing the window but the behaviour is buggy as the mouse is being teleported around a bit
  • Mouse doesn't seem constrained by program, but upon releasing the mouse it gets stolen again, maybe because we aren't recalculating what program the mouse should activate? Or maybe we never even properly deactivated the program to begin with (borders indicate the program was never deactivated?)

At least with nix its easy for me to compile and run the thing so i might look into this myself but the solution is most definitely not obvious to me

@vaxerski
Copy link
Member

vaxerski commented Mar 5, 2024

hm, I think a variable here would work better, to be honest. Have a binding to toggle it to ignore constraints altogether, thoguths?

@Ashe
Copy link
Author

Ashe commented Mar 5, 2024

Thank you for the nudge and I appreciate you're trying to get more people contributing. If I get time I'll have a look and see if I can make sense of your advice but I just don't know the architecture of hyprland really.

I think for my personal usecase I'd want it to be a hold button - I'd want to hold my super key so that when I'm doing my normal hyprland usage and dragging windows around my mouse is always available and unimpeded. That way, normal usage isn't affected, and in times where your mouse is being controlled, constrained or hidden, you can break out of that window and drag/resize windows or simply mouse over a different one without having to be conscious of whether the binding is toggled on or off.

If you're on windows, you can tap the windows key for a very similar effect. Yes, the start menu appears, but other than that your mouse is escaped, its visible and its unconstrained from your current menu and you can do what you like - most people would simply alt-tab but i prefer pressing windows key and moving my mouse to a different window to switch, otherwise im there cycling through 10 different windows constantly.

Am I making sense? Do you think this would be hard to implement? To me it sounds like there's a lot of things going on and it sounds like it'd be easy to break some things in hyprland to implement hence im nervous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants