mac: fix dock notification badge (#88)
This commit is contained in:
parent
f7b7931847
commit
9003b94f85
1 changed files with 7 additions and 1 deletions
|
@ -23,11 +23,17 @@ let lastIndex: null | number = -1;
|
||||||
|
|
||||||
export function setBadgeCount(count: number) {
|
export function setBadgeCount(count: number) {
|
||||||
switch (process.platform) {
|
switch (process.platform) {
|
||||||
case "darwin":
|
|
||||||
case "linux":
|
case "linux":
|
||||||
if (count === -1) count = 0;
|
if (count === -1) count = 0;
|
||||||
app.setBadgeCount(count);
|
app.setBadgeCount(count);
|
||||||
break;
|
break;
|
||||||
|
case "darwin":
|
||||||
|
if (count === 0) {
|
||||||
|
app.dock.setBadge("");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
app.dock.setBadge(count === -1 ? "•" : count.toString());
|
||||||
|
break;
|
||||||
case "win32":
|
case "win32":
|
||||||
const [index, description] = getBadgeIndexAndDescription(count);
|
const [index, description] = getBadgeIndexAndDescription(count);
|
||||||
if (lastIndex === index) break;
|
if (lastIndex === index) break;
|
||||||
|
|
Loading…
Reference in a new issue