🏷
App Icon Badging, Bouncing and Progress Bar

Count Badges

Works on all platforms
You can easily set the counter using the setBadgeCount method. Setting the count to 0 will hide the badge.
1
window.todesktop.app.setBadgeCount(2);
Copied!
Badge count set to 2 (Mac)

Text Badges

Works on Mac only
On mac, you have the option to set the set the dock badge to any text you like.
1
window.todesktop.app.dock.setBadge("πŸ‘‹πŸ™Š Hello");
Copied!
Text badge set to "πŸ‘‹πŸ™Š Hello"

Bouncing dock icon

Work on Mac only
Bouncing the dock icon has two modes: critical and informational. If no parameters are used then the default is informational.
  • informational β€” the dock icon will bounce once (for a duration of one second)
  • critical β€” the dock icon will bounce until either the application becomes active or the request is canceled
1
// Bounce the dock icon once
2
window.todesktop.app.dock.bounce('informational');
3
​
4
// Bounce the dock icon for 5 seconds
5
const cancelBounceId = window.todesktop.app.dock.bounce('critical');
6
setTimeout(() => {
7
window.todesktop.app.dock.cancelBounce(cancelBounceId);
8
}, 5000);
Copied!

Show progress bar

Works on all platforms (Windows, Mac and Linux). On Linux, only the Unity desktop environment is supported.
1
// Set progress bar to 75%
2
window.todesktop.window.setProgressBar(0.75)
3
​
4
// Set progress bar to intermediate mode. Any value
5
// greater than `1` will trigger intermediate mode
6
window.todesktop.window.setProgressBar(2)
7
​
8
// Remove progress bar. Any value less than `0`
9
// will remove the progress bar
10
window.todesktop.window.setProgressBar(-1)
11
​
12
// Set progress bar to 75% in error mode (Windows only)
13
window.todesktop.window.setProgressBar(0.75, {
14
// Progress bar modes are only available on Windows.
15
// Available modes are: 'indeterminate', 'error', and 'paused'.
16
mode: 'error'
17
})
Copied!
Progress bar set to 0.75 (Mac)

Putting it all together β€” An homage to Daft Punk

We made a quick video that puts all the methods together. It's just a bit of fun and not very practical but we hope you enjoy it as much as we enjoyed making it (headphones recommended):
​
Last modified 8mo ago