Re:Ask HN: Side projects that are making money, but you'd no...
by DeathArrow on Thursday June 16, 2022 @10:10AM
(#31766249)
Can you hook the mouse in a browser extension?
Re:Ask HN: Side projects that are making money, but you'd no...
by selcuka on Thursday June 16, 2022 @10:22AM
(#31766378)
You can detect the location but no, you can't change the position of the pointer using Javascript.
Re:Ask HN: Side projects that are making money, but you'd no...
by tylergetsay on Thursday June 16, 2022 @11:01AM
(#31766845)
you could draw a fake one
Re:Ask HN: Side projects that are making money, but you'd no...
by gregsadetsky on Thursday June 16, 2022 @11:08AM
(#31766936)
Exactly. You hide the native cursor with css and show an image on top of the page whose position you move around.
Re:Ask HN: Side projects that are making money, but you'd no...
by jmt_ on Thursday June 16, 2022 @11:30AM
(#31767232)
This would work visually but I think you'd run into a lot of edge cases where JS/CSS/the browser itself is expecting to hook into or access mouse APIs
Re:Ask HN: Side projects that are making money, but you'd no...
by nso on Thursday June 16, 2022 @11:56AM
(#31767511)
Yeah, imagine fake mouse is clicking a Save-button, but real mouse is up in the corner clicking the browsers Close-button.
Re:Ask HN: Side projects that are making money, but you'd no...
by gregsadetsky on Thursday June 16, 2022 @04:07PM
(#31770345)
I agree, these questions are part of the work that would be required to take it from a prototype to something useable.
You could maybe add one big transparent layer on top of the page which would catch all "real" clicks and generate synthetic mouse events under the layer at the stabilized position.
Browsers aren't an "ideal" environment (versus an OS where you might be able to hook into the mouse position/display at a lower level), but at the same time, they are ubiquitious, cross-platform, etc.
Might be worth a shot to expand this more. It's on my long list of side projects -- I'd love to collab with someone on it!
I once experimented with a tremor-compensating extension and some css that hid the “natural” cursor and overlaid a cursor image instead whose position I controlled (using a basic rolling window average to make it steady). This basic test seemed to hold up.
That could potentially open up a whole new market for you…? Just curious if you’ve considered this. Don’t hesitate to reach out by email too if this sounds interesting!
[0] https://chrome.google.com/webstore/detail/dictation-for-gmai...