base::Bind(&Browser::DockGetBadgeText, browser));
dict.SetMethod("dockHide", base::Bind(&Browser::DockHide, browser));
dict.SetMethod("dockShow", base::Bind(&Browser::DockShow, browser));
+ dict.SetMethod("dockIsVisible", base::Bind(&Browser::DockIsVisible, browser));
dict.SetMethod("dockSetMenu", &DockSetMenu);
dict.SetMethod("dockSetIcon", base::Bind(&Browser::DockSetIcon, browser));
#endif
// Hide/Show dock.
void DockHide();
void DockShow();
+ bool DockIsVisible();
// Set docks' menu.
void DockSetMenu(AtomMenuModel* model);
TransformProcessType(&psn, kProcessTransformToUIElementApplication);
}
+bool Browser::DockIsVisible() {
+ // Because DockShow has a slight delay this may not be true immediately
+ // after that call.
+ return ([[NSRunningApplication currentApplication] activationPolicy] == NSApplicationActivationPolicyRegular);
+}
+
void Browser::DockShow() {
BOOL active = [[NSRunningApplication currentApplication] isActive];
ProcessSerialNumber psn = { 0, kCurrentProcess };
Shows the dock icon.
+### `app.dock.isVisible()` _macOS_
+
+Returns whether the dock icon is visible.
+The `app.dock.show()` call is asynchronous so this method might not
+return true immediately after that call.
+
### `app.dock.setMenu(menu)` _macOS_
* `menu` [Menu](menu.md)
getBadge: bindings.dockGetBadgeText,
hide: bindings.dockHide,
show: bindings.dockShow,
+ isVisible: bindings.dockIsVisible,
setMenu: bindings.dockSetMenu,
setIcon: bindings.dockSetIcon
}