mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
feat: Add BrowserWindow option to hide window in Mission Control (macOS) (#36092)
* feat: Add BrowserWindow option to ignore Mission Control (macOS) * There are many circumstances when app developers may want to hide their windows from mission control. E.g., full screen overlays, small helper windows, dialogs, etc. * This PR adds the functionality, docs, and tests. * chore:Rename variables * Update shell/browser/native_window_mac.h Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com> Co-authored-by: Samuel Maddock <samuel.maddock@gmail.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
@@ -881,6 +881,16 @@ gfx::Point BaseWindow::GetTrafficLightPosition() const {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
bool BaseWindow::IsHiddenInMissionControl() {
|
||||
return window_->IsHiddenInMissionControl();
|
||||
}
|
||||
|
||||
void BaseWindow::SetHiddenInMissionControl(bool hidden) {
|
||||
window_->SetHiddenInMissionControl(hidden);
|
||||
}
|
||||
#endif
|
||||
|
||||
void BaseWindow::SetTouchBar(
|
||||
std::vector<gin_helper::PersistentDictionary> items) {
|
||||
window_->SetTouchBar(std::move(items));
|
||||
@@ -1256,6 +1266,14 @@ void BaseWindow::BuildPrototype(v8::Isolate* isolate,
|
||||
.SetMethod("getTrafficLightPosition",
|
||||
&BaseWindow::GetTrafficLightPosition)
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
.SetMethod("isHiddenInMissionControl",
|
||||
&BaseWindow::IsHiddenInMissionControl)
|
||||
.SetMethod("setHiddenInMissionControl",
|
||||
&BaseWindow::SetHiddenInMissionControl)
|
||||
#endif
|
||||
|
||||
.SetMethod("_setTouchBarItems", &BaseWindow::SetTouchBar)
|
||||
.SetMethod("_refreshTouchBarItem", &BaseWindow::RefreshTouchBarItem)
|
||||
.SetMethod("_setEscapeTouchBarItem", &BaseWindow::SetEscapeTouchBarItem)
|
||||
|
||||
@@ -198,6 +198,11 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
|
||||
gfx::Point GetTrafficLightPosition() const;
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
bool IsHiddenInMissionControl();
|
||||
void SetHiddenInMissionControl(bool hidden);
|
||||
#endif
|
||||
|
||||
void SetTouchBar(std::vector<gin_helper::PersistentDictionary> items);
|
||||
void RefreshTouchBarItem(const std::string& item_id);
|
||||
void SetEscapeTouchBarItem(gin_helper::PersistentDictionary item);
|
||||
|
||||
Reference in New Issue
Block a user