mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: restore wasOpenedAtLogin functionality (#42411)
fix: restore opened at login functionality
This commit is contained in:
@@ -236,6 +236,10 @@ class Browser : private WindowListObserver {
|
||||
// Set docks' icon.
|
||||
void DockSetIcon(v8::Isolate* isolate, v8::Local<v8::Value> icon);
|
||||
|
||||
void SetLaunchedAtLogin(bool launched_at_login) {
|
||||
was_launched_at_login_ = launched_at_login;
|
||||
}
|
||||
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
|
||||
void ShowAboutPanel();
|
||||
@@ -370,6 +374,7 @@ class Browser : private WindowListObserver {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
std::unique_ptr<ui::ScopedPasswordInputEnabler> password_input_enabler_;
|
||||
base::Time last_dock_show_;
|
||||
bool was_launched_at_login_;
|
||||
#endif
|
||||
|
||||
base::Value::Dict about_panel_options_;
|
||||
|
||||
@@ -392,6 +392,7 @@ v8::Local<v8::Value> Browser::GetLoginItemSettings(
|
||||
platform_util::GetLoginItemEnabled(options.type, options.service_name);
|
||||
settings.open_at_login =
|
||||
status == "enabled" || status == "enabled-deprecated";
|
||||
settings.opened_at_login = was_launched_at_login_;
|
||||
if (@available(macOS 13, *))
|
||||
settings.status = status;
|
||||
#else
|
||||
@@ -405,6 +406,7 @@ v8::Local<v8::Value> Browser::GetLoginItemSettings(
|
||||
settings = settings_deprecated;
|
||||
} else {
|
||||
settings.open_at_login = status == "enabled";
|
||||
settings.opened_at_login = was_launched_at_login_;
|
||||
settings.status = status;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -84,6 +84,14 @@ static NSDictionary* UNNotificationResponseToNSDictionary(
|
||||
}
|
||||
}
|
||||
|
||||
NSAppleEventDescriptor* event =
|
||||
NSAppleEventManager.sharedAppleEventManager.currentAppleEvent;
|
||||
BOOL launched_as_login_item =
|
||||
(event.eventID == kAEOpenApplication &&
|
||||
[event paramDescriptorForKeyword:keyAEPropData].enumCodeValue ==
|
||||
keyAELaunchedAsLogInItem);
|
||||
electron::Browser::Get()->SetLaunchedAtLogin(launched_as_login_item);
|
||||
|
||||
electron::Browser::Get()->DidFinishLaunching(
|
||||
electron::NSDictionaryToValue(notification_info));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user