fix: macOS correctly restore window when hidden with command+H

This commit is contained in:
sithlord48
2024-12-17 20:45:22 -05:00
committed by Chris Rizzitello
parent bf4f513d7e
commit e4ecbdae8a
3 changed files with 9 additions and 0 deletions

View File

@ -1055,6 +1055,9 @@ void MainWindow::enableClient(bool enable)
void MainWindow::showAndActivate()
{
#ifdef Q_OS_MAC
forceAppActive();
#endif
show();
raise();
activateWindow();

View File

@ -30,4 +30,5 @@ void requestOSXNotificationPermission();
bool isOSXDevelopmentBuild();
bool showOSXNotification(const QString &title, const QString &body);
bool isOSXInterfaceStyleDark();
void forceAppActive();
IconsTheme getOSXIconsTheme();

View File

@ -107,6 +107,11 @@ bool isOSXInterfaceStyleDark()
return (style && [style isKindOfClass:[NSString class]] && NSOrderedSame == [style caseInsensitiveCompare:@"dark"]);
}
void forceAppActive()
{
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
}
IconsTheme getOSXIconsTheme()
{
if (@available(macOS 11, *))