mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: add macOS-only api to determine if app is currently active (#49622)
* feat: add macOS-only api to determine if app is currently active You can `focus()` the app and get events for `did-become-active`, but there's currently not a way to directly check if your app is the active (foreground) application. * test: add unit test for app.isActive api * fix: ensure we hide app after showing in test If the app is still active, it may affect other tests like dock.bounce that behave differently depending on whether the app is active * docs: simplify isActive api description
This commit is contained in:
@@ -573,6 +573,10 @@ focus but may instead show a notification or flash the app icon (Wayland).
|
||||
|
||||
You should seek to use the `steal` option as sparingly as possible.
|
||||
|
||||
### `app.isActive()` _macOS_
|
||||
|
||||
Returns `boolean` - `true` if the application is active (i.e. focused).
|
||||
|
||||
### `app.hide()` _macOS_
|
||||
|
||||
Hides all application windows without minimizing them.
|
||||
|
||||
Reference in New Issue
Block a user