Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

How to not auto focus of the "always-on-top" window. #582

Open
oklai opened this Issue · 4 comments

3 participants

@oklai

I create a application, the main window running in the background for watch code file changes . When some file be modified and code error, program will open a new window to notify the user, i set the open window "always-on-top" to true, because it need to be the top of other windows . I just want create a notifier like natively. The problem is, When i edit a file and produced an error, then program pop a notification window, it will auto focus the window, to continue to edit the file, i need focus the edit window again. This is not the desired effect, i just want to show the notification window. How can i do it?
I think the "always-on-top" subfield should just let the window display at the top, without auto focus.

中文描述:
我想模拟一个通知器,就像原生应用的桌面通知一样。我的方法是创建一个小窗口,并设置 "always-on-top"属性为true,这样它就能在最上面显示了。但是有一个问题,比如当我编辑一个文件时遇到了错误,程序会弹出一个错误提示,我本来只是想显示错误信息而已,但设置了"always-on-top"的提示窗口却总是会自动焦距,这时我如果想继续编辑文件,就需要重新焦距到上一次编辑的地方,这已经打断了我的工作。"always-on-top"应该只是让窗口在最顶上显示,而不应该自动焦距才对。有其他避免自动焦距的方法吗?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@zhchbin

Hi @oklai Please take a look at the Window.blur method. In the popup window call this method will move the focus away.

@oklai

I tried use Window.blur method, but it alse not work. When trigger blur event, the main window will be focus.

Here the demo code https://gist.github.com/oklai/5298706.

You can have a try. When program runing, you switch to other window, like web browser, after 3 seconds, it will open the test window, after another 3 seconds, test window show and blur, and the main window will be focus too.
I want keep focus on web browser.

@zhchbin

Sorry for my misunderstanding. It seems that currently nw didn't have this ability, or maybe have but I don't know.

@sonicsnes

Duplicate of #424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.