Describe the problem
I have a use case where I'd like to be able to detect if the mouse intersects with a tauri window.
The reason is that I use set_ignore_cursor_events(true) to create an overlay displaying something useful to a user.
However, I'd like to be able to allow the user to move their mouse over the window and control the opacity so they can see what behind the window.
Here is an MVP repo that shows you can use javascript to do this but only if the window is in focus.
https://github.com/Hacksore/mouse-intersection-when-ignore-mouse-events
Describe the solution you'd like
A way in rust to listen globally for the mouse intersecting events of windows.
intersecting (called once)
no longer intersecting (called once)
These events would let you run some "callback" rust code (unsure if that's rusty) but for my use case I'd want to toggle some body class on the app.
tl;dr set_ignore_cursor_events(true), you mouse over a tauri window you can run rust code on enter/exit.
Alternatives considered
No response
Additional context
As mentioned initially you can do this in JS but it requires the window to be focused.
Demo:
2024-03-22_09-58-31.mp4
Describe the problem
I have a use case where I'd like to be able to detect if the mouse intersects with a tauri window.
The reason is that I use
set_ignore_cursor_events(true)to create an overlay displaying something useful to a user.However, I'd like to be able to allow the user to move their mouse over the window and control the opacity so they can see what behind the window.
Here is an MVP repo that shows you can use javascript to do this but only if the window is in focus.
https://github.com/Hacksore/mouse-intersection-when-ignore-mouse-events
Describe the solution you'd like
A way in rust to listen globally for the mouse intersecting events of windows.
These events would let you run some "callback" rust code (unsure if that's rusty) but for my use case I'd want to toggle some body class on the app.
tl;dr
set_ignore_cursor_events(true), you mouse over a tauri window you can run rust code on enter/exit.Alternatives considered
No response
Additional context
As mentioned initially you can do this in JS but it requires the window to be focused.
Demo:
2024-03-22_09-58-31.mp4