当Chrome打包的应用收到通知时,显示橙色的Windows任务栏图标橙色 [英] show orange Windows taskbar icon orange when a Chrome Packaged app gets a notification

查看:205
本文介绍了当Chrome打包的应用收到通知时,显示橙色的Windows任务栏图标橙色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Chrome打包的应用程序,该应用程序可以发送通知(现在它们都已连接).但是,当用户不在应用程序中时-该应用程序位于背景中,并且其他窗口位于其顶部-通知会弹出一小会并消失.我想将任务栏图标更改为橙色,与环聊打包的应用程序一样,以便用户知道以后有通知要查看.

我在通知文档中查看了所有内容,但找不到任何此类功能,但环聊正在使用它,我相信我在其他应用程序中也看到了它.有谁知道如何在Chrome打包应用中触发此操作?

谢谢.

解决方案

似乎我已经弄清楚了,而且只花了整整一天的时间.此行为不是通知的一部分(这太容易了),而不是应用程序窗口.因此,您将执行以下操作:

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

这会在Windows中将任务栏图标闪烁橙色,并在OSX中使停靠图标弹回.

您也可以呼叫appWindow.clearAttention(),尽管当用户将窗口聚焦时,注意力会自动清除.

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.

解决方案

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.

这篇关于当Chrome打包的应用收到通知时,显示橙色的Windows任务栏图标橙色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆