hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.99k stars 852 forks source link

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

Open Ashe opened 7 months ago

Ashe commented 7 months ago

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 :)

vaxerski commented 7 months ago

patch.txt

untested but should work. Dispatcher "unlockmouse"

Ashe commented 7 months ago

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:

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 commented 7 months ago

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

Ashe commented 7 months ago

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.