Control your app in the macOS dock
Process: Main
The following example shows how to bounce your icon on the dock.
const { app } = require('electron')
app.dock.bounce()
type
String (optional) - Can becritical
orinformational
. The default isinformational
Returns Integer
- an ID representing the request.
When critical
is passed, the dock icon will bounce until either the
application becomes active or the request is canceled.
When informational
is passed, the dock icon will bounce for one second.
However, the request remains active until either the application becomes active
or the request is canceled.
Nota Bene: This method can only be used while the app is not focused; when the app is focused it will return -1.
id
Integer
Cancel the bounce of id
.
filePath
String
Bounces the Downloads stack if the filePath is inside the Downloads folder.
text
String
Sets the string to be displayed in the dock’s badging area.
Returns String
- The badge string of the dock.
Hides the dock icon.
Returns Promise<void>
- Resolves when the dock icon is shown.
Returns Boolean
- Whether the dock icon is visible.
menu
Menu
Sets the application's [dock menu][dock-menu].
Returns Menu | null
- The application's [dock menu][dock-menu].
image
(NativeImage | String)
Sets the image
associated with this dock icon.