show orange Windows taskbar icon orange when a Chrome Packaged app gets a notification

我们两清 提交于 2019-12-12 03:58:42

问题


I am working on a Chrome Packaged App that sends notifications (which are now all hooked up). However, when the user is not in the app -- the app is in the background with other windows on top of it -- the notification pops up for a bit and disappears. I would like to change the taskbar icon to orange, the same that the Hangouts packaged app does, so that the user knows there is a notification to view at a later time.

I looked all though the notifications documentation and could not find any such feature, yet Hangouts is using it, and I believe I have seen it in other apps. Does anyone know how to trigger this in a Chrome Packaged App?

Thanks.


回答1:


It looks like I have figured it out, and it only took all day. This behavior is not part of notifications (that would be too easy), but rather of the app window. So, you would do something like this:

var appWindow = chrome.app.window.current();
appWindow.drawAttention();

This flashes the taskbar icon orange in Windows, and makes the dock icon bounce in OSX.

You can also call appWindow.clearAttention(), although attention would be cleared automatically when the user focuses the window.



来源:https://stackoverflow.com/questions/32389286/show-orange-windows-taskbar-icon-orange-when-a-chrome-packaged-app-gets-a-notifi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!