diff --git a/.github/workflows/push-master.yml b/.github/workflows/push-master.yml index 8c6a2af8a..39b96cee8 100644 --- a/.github/workflows/push-master.yml +++ b/.github/workflows/push-master.yml @@ -142,7 +142,7 @@ jobs: matrix: include: - JOB_RUNNER: macos-14 - JOB_NAME: macOS 14 (arm64/M1/M2) + JOB_NAME: macOS 14 (arm64 = M1/M2/M3/M4) QT_VERSION: 6 NICE_NAME: arm64_M1_M2 - JOB_RUNNER: macos-13 diff --git a/CMakeLists.txt b/CMakeLists.txt index 907b445d5..c4304e058 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,13 +200,10 @@ if ( "${PLATFORM}" MATCHES "osx" ) if (CMAKE_OSX_DEPLOYMENT_TARGET) set(CMAKE_OSX_HYPERHDR_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET}) else() - set(VERSION_REPLACEMENT ${CMAKE_OSX_SYSROOT}) - string(REPLACE "/SDKs/MacOSX" "." VERSION_REPLACEMENT ${VERSION_REPLACEMENT}) - string(REPLACE "." ";" VERSION_REPLACEMENT_LIST ${VERSION_REPLACEMENT}) - list(LENGTH VERSION_REPLACEMENT_LIST VERSION_REPLACEMENT_LIST_LENGTH) - if (${VERSION_REPLACEMENT_LIST_LENGTH} GREATER_EQUAL 1) - list (GET VERSION_REPLACEMENT_LIST 1 CMAKE_OSX_HYPERHDR_DEPLOYMENT_TARGET) - endif() + string(REGEX MATCH "MacOSX([0-9]+)" _ ${CMAKE_OSX_SYSROOT}) + if (${CMAKE_MATCH_COUNT} EQUAL "1") + set(CMAKE_OSX_HYPERHDR_DEPLOYMENT_TARGET ${CMAKE_MATCH_1}) + endif() endif(CMAKE_OSX_DEPLOYMENT_TARGET) if (CMAKE_OSX_HYPERHDR_DEPLOYMENT_TARGET) diff --git a/build.sh b/build.sh index 5119354f3..16b53abf9 100755 --- a/build.sh +++ b/build.sh @@ -115,7 +115,7 @@ if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then if [[ $(uname -m) == 'arm64' ]]; then BUILD_OPTION="" else - BUILD_OPTION="-DUSE_PRECOMPILED_HEADERS=OFF" + BUILD_OPTION="-DUSE_PRECOMPILED_HEADERS=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15" export CCACHE_COMPILERCHECK=content fi else @@ -129,7 +129,7 @@ if [[ "$CI_NAME" == 'osx' || "$CI_NAME" == 'darwin' ]]; then ls -a build/.ccache cd build ccache -z -d ./.ccache || true - cmake -DPLATFORM=${PLATFORM} ${BUILD_OPTION} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ../ || exit 2 + cmake -DPLATFORM=${PLATFORM} ${BUILD_OPTION} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=/usr/local ../ || exit 2 make -j $(sysctl -n hw.ncpu) || exit 3 sudo cpack || exit 3 ccache -sv -d ./.ccache || true diff --git a/include/systray/Systray.h b/include/systray/Systray.h index 90eb6a77e..5450e9fbd 100644 --- a/include/systray/Systray.h +++ b/include/systray/Systray.h @@ -66,6 +66,10 @@ struct SystrayMenu void SystrayClose(); #endif +#ifdef __APPLE__ + bool SystrayDarkmode(); +#endif + #ifdef _WIN32 HWND SystrayGetWindow(); #endif diff --git a/resources/icons/autorun.svg b/resources/icons/autorun.svg index e952ed123..61a0a038b 100644 --- a/resources/icons/autorun.svg +++ b/resources/icons/autorun.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/resources/icons/clear.svg b/resources/icons/clear.svg index f5888f06a..848f73d64 100644 --- a/resources/icons/clear.svg +++ b/resources/icons/clear.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/resources/icons/color.svg b/resources/icons/color.svg index e50558e36..47cfeaeb7 100644 --- a/resources/icons/color.svg +++ b/resources/icons/color.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/resources/icons/effects.svg b/resources/icons/effects.svg index 1f0f333d3..8a178eb1d 100644 --- a/resources/icons/effects.svg +++ b/resources/icons/effects.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/resources/icons/instance.svg b/resources/icons/instance.svg index 9db69cbdd..8ac1685b2 100644 --- a/resources/icons/instance.svg +++ b/resources/icons/instance.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/resources/icons/settings.svg b/resources/icons/settings.svg index 47863af6e..ce476f5b0 100644 --- a/resources/icons/settings.svg +++ b/resources/icons/settings.svg @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/sources/hyperhdr/SystrayHandler.cpp b/sources/hyperhdr/SystrayHandler.cpp index c43739867..6cb72f1d0 100644 --- a/sources/hyperhdr/SystrayHandler.cpp +++ b/sources/hyperhdr/SystrayHandler.cpp @@ -211,7 +211,14 @@ static void loadSvg(std::unique_ptr& menu, QString filename, QStrin menu->tooltip = fullPath.toStdString(); #else std::vector ar; - utils_image::svg2png(preloadSvg(filename).toStdString(), iconDim, iconDim, ar); + QString svgFile = preloadSvg(filename); + #ifdef __APPLE__ + if (filename.indexOf(":/") == 0 && SystrayDarkmode()) + { + svgFile.replace("fill=\"black\"", "fill=\"white\""); + } + #endif + utils_image::svg2png(svgFile.toStdString(), iconDim, iconDim, ar); menu->icon.resize(ar.size()); memcpy(menu->icon.data(), ar.data(), ar.size()); diff --git a/sources/systray/CMakeLists.txt b/sources/systray/CMakeLists.txt index f9db28fef..03856af2c 100644 --- a/sources/systray/CMakeLists.txt +++ b/sources/systray/CMakeLists.txt @@ -31,3 +31,9 @@ if(ENABLE_SYSTRAY AND UNIX) target_link_libraries(systray-widget PRIVATE ${AppIndicator_LIBRARIES} ) endif() endif() + +if(APPLE) + if (${MACOS_MAJOR_VERSION} GREATER_EQUAL "14") + target_compile_definitions(systray-widget PUBLIC MACOS_VERSION_14_UP) + endif() +endif() diff --git a/sources/systray/SystrayMacOS.mm b/sources/systray/SystrayMacOS.mm index 05140a249..d51ad81b2 100644 --- a/sources/systray/SystrayMacOS.mm +++ b/sources/systray/SystrayMacOS.mm @@ -125,6 +125,15 @@ int SystrayLoop() return 0; } +bool SystrayDarkmode() +{ + #ifndef MACOS_VERSION_14_UP + return NSAppearance.currentAppearance.name == NSAppearanceNameDarkAqua; + #else + return [[NSUserDefaults standardUserDefaults] stringForKey:@"AppleInterfaceStyle"] != nil; + #endif +} + void SystrayUpdate(SystrayMenu* tray) { double iconHeight = [[NSStatusBar systemStatusBar] thickness];