Linux: Support showing badge count
This was a macOS-only API before, but it's cross-platform now via `app.setBadgeCount()`
This commit is contained in:
@@ -30,12 +30,11 @@ function downloadFinished (path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display string in dock badging area. (OS X)
|
* Display a counter badge for the app. (OS X, Linux)
|
||||||
*/
|
*/
|
||||||
function setBadge (text) {
|
function setBadge (count) {
|
||||||
if (!app.dock) return
|
log(`setBadge: ${count}`)
|
||||||
log(`setBadge: ${text}`)
|
app.setBadgeCount(Number(count))
|
||||||
app.dock.setBadge(String(text))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMenuTemplate () {
|
function getMenuTemplate () {
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ function updateElectron () {
|
|||||||
}
|
}
|
||||||
if (state.dock.badge !== state.prev.badge) {
|
if (state.dock.badge !== state.prev.badge) {
|
||||||
state.prev.badge = state.dock.badge
|
state.prev.badge = state.dock.badge
|
||||||
ipcRenderer.send('setBadge', state.dock.badge || '')
|
ipcRenderer.send('setBadge', state.dock.badge || 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user