最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Electron capture mouse events when window is not focused - Stack Overflow

programmeradmin5浏览0评论

Is there a way to capture mouse events like hover and click even when Electron window is not focused? So that my buttons' hover/click effects still work?

Right now, I need to first switch to the Electron window either by clicking or alt-tabbing for the mouse events to be captured.

I'm fairly new to js and electron and I can't seem to find anything on this. But since it works with Atom editor, I'm assuming its possible?

Do I need additional module like mentioned in this post for capturing keyboard events: Atom Electron capture all keyboard events even when app is unfocused?

Thanks! Appreciate any help.

Is there a way to capture mouse events like hover and click even when Electron window is not focused? So that my buttons' hover/click effects still work?

Right now, I need to first switch to the Electron window either by clicking or alt-tabbing for the mouse events to be captured.

I'm fairly new to js and electron and I can't seem to find anything on this. But since it works with Atom editor, I'm assuming its possible?

Do I need additional module like mentioned in this post for capturing keyboard events: Atom Electron capture all keyboard events even when app is unfocused?

Thanks! Appreciate any help.

Share Improve this question edited Jul 26, 2019 at 18:11 Tim asked Jul 26, 2019 at 17:53 TimTim 3,4271 gold badge19 silver badges27 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

When creating a new Electron window using new BrowserWindow, it is possible to have mouse click events captured even when the window is not focused by adding:

acceptFirstMouse: true

to the BrowserWindow options.

As for capturing mouse hover events, I'm afraid this is not possible out of the box.

发布评论

评论列表(0)

  1. 暂无评论