useMousePosition
Subscribes to global mouse position events streamed from the Fluxlay desktop app.
Import
Signature
Return Value
Returns mouse position normalized to the wallpaper window. Both axes range from -1 to 1:
Returns { x: 0, y: 0 } until the first event is received.
Convert to pixels
Multiply by the viewport size, remembering Y is inverted relative to CSS:
Notes
- Y is flipped to a mathematical coordinate system (positive = up). This is the opposite of CSS, which has positive = down. Convert before using as
top/translateY. - The window label is read from the
window_labelquery parameter, defaulting to"main". - The subscription is window-scoped: each wallpaper window receives its own normalized coordinates relative to itself.
- Outside the Fluxlay desktop app, the hook returns
{ x: 0, y: 0 }.