如何使Chrome扩展程序的窗口在任务栏中闪烁?

问题描述:

我注意到有些应用程序可以使用chrome扩展程序使任务栏中的窗口闪烁?类似于Chrome在下载内容时显示绿色进度条的方式,其他窗口也会闪烁橙色以引起您的注意.反正有一个Chrome扩展程序可以做到这一点吗?

I've noticed there are some applications that can make the window in the taskbar blink using a chrome extension? Similar to how chrome will show a green progress bar when downloading something, other windows will blink orange to get your attention. Is there anyway to get a chrome extension to do this?

是的,可以使用

Yes, it's possible with the windows API:

drawAttention

如果为true,则使窗口以一种将用户的注意力吸引到该窗口的方式显示,而无需更改聚焦窗口.效果一直持续到用户将焦点移到窗口上为止.如果窗口已经具有焦点,则此选项无效.设置为false可取消先前的抽奖注意请求.

If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to false to cancel a previous draw attention request.

// You can pass -2 as windowId for the current window,
//  or query tabs/windows to get the one you want
chrome.windows.update(windowId, {drawAttention: true});