Merge pull request #7036 from symless/SYNERGY-1006-Big-sur-icon-theme

SYNERGY-1006 - Added template mode for icons on Big Sur and higher
This commit is contained in:
Igor Sikachyna 2021-06-10 09:05:59 -07:00 committed by GitHub
commit 54a8a355cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 13 deletions

View file

@ -8,6 +8,7 @@ Bug fixes:
- #7001 Add option to prevent computer from going to sleep - #7001 Add option to prevent computer from going to sleep
- #7029 | #7033 Wrong encoding for text copied between linux and windows - #7029 | #7033 Wrong encoding for text copied between linux and windows
- #7015 Fix Windows service not starting up after sleep - #7015 Fix Windows service not starting up after sleep
- #7036 Fix tray icon not changing theme on Big Sur
Enhancements: Enhancements:
- #6998 Remove functionality related to the screen saver synchronisation - #6998 Remove functionality related to the screen saver synchronisation

View file

@ -343,10 +343,19 @@ void MainWindow::setIcon(qSynergyState state) const
QIcon icon; QIcon icon;
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
if (isOSXUseDarkIcons()) switch(getOSXIconsTheme()) {
icon.addFile(synergyDarkIconFiles[state]); case IconsTheme::ICONS_DARK:
else icon.addFile(synergyDarkIconFiles[state]);
icon.addFile(synergyLightIconFiles[state]); break;
case IconsTheme::ICONS_LIGHT:
icon.addFile(synergyLightIconFiles[state]);
break;
case IconsTheme::ICONS_TEMPLATE:
default:
icon.addFile(synergyDarkIconFiles[state]);
icon.setIsMask(true);
break;
}
#else #else
icon.addFile(synergyDefaultIconFiles[state]); icon.addFile(synergyDefaultIconFiles[state]);
#endif #endif

View file

@ -19,7 +19,13 @@
#define OSXHELPERS__H #define OSXHELPERS__H
enum class IconsTheme {
ICONS_DARK,
ICONS_LIGHT,
ICONS_TEMPLATE
};
bool isOSXInterfaceStyleDark(); bool isOSXInterfaceStyleDark();
bool isOSXUseDarkIcons(); IconsTheme getOSXIconsTheme();
#endif #endif

View file

@ -30,13 +30,12 @@ isOSXInterfaceStyleDark()
return (style && [style isKindOfClass:[NSString class]] && NSOrderedSame == [style caseInsensitiveCompare:@"dark"]); return (style && [style isKindOfClass:[NSString class]] && NSOrderedSame == [style caseInsensitiveCompare:@"dark"]);
} }
bool IconsTheme
isOSXUseDarkIcons() getOSXIconsTheme()
{ {
if (@available(macOS 11, *)) { if (@available(macOS 11, *))
return true; return IconsTheme::ICONS_TEMPLATE;
} else if(isOSXInterfaceStyleDark())
else { return IconsTheme::ICONS_DARK;
return isOSXInterfaceStyleDark(); return IconsTheme::ICONS_LIGHT;
}
} }