mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-01 15:15:13 +00:00
Fix tray icon color on mac without preston's patches (#157)
This commit is contained in:
@@ -234,6 +234,7 @@ private:
|
|||||||
- (void) darkModeChanged:(NSNotification *)aNotification {
|
- (void) darkModeChanged:(NSNotification *)aNotification {
|
||||||
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
Core::Sandbox::Instance().customEnterFromEventLoop([&] {
|
||||||
Core::App().settings().setSystemDarkMode(Platform::IsDarkMode());
|
Core::App().settings().setSystemDarkMode(Platform::IsDarkMode());
|
||||||
|
Core::App().domain().notifyUnreadBadgeChanged();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -692,24 +693,19 @@ void MainWindow::updateIconCounters() {
|
|||||||
|
|
||||||
QIcon MainWindow::generateIconForTray(int counter, bool muted) const {
|
QIcon MainWindow::generateIconForTray(int counter, bool muted) const {
|
||||||
auto result = QIcon();
|
auto result = QIcon();
|
||||||
auto lightMode = TrayIconBack(false);
|
const auto dm = Platform::IsDarkMenuBar();
|
||||||
auto darkMode = TrayIconBack(true);
|
auto img = TrayIconBack(dm);
|
||||||
auto lightModeActive = TrayIconBack(false, true);
|
auto imgsel = TrayIconBack(dm, true);
|
||||||
auto darkModeActive = TrayIconBack(true, true);
|
img.detach();
|
||||||
lightModeActive.detach();
|
imgsel.detach();
|
||||||
darkModeActive.detach();
|
|
||||||
const auto size = 22 * cIntRetinaFactor();
|
const auto size = 22 * cIntRetinaFactor();
|
||||||
const auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
|
const auto &bg = (muted ? st::trayCounterBgMute : st::trayCounterBg);
|
||||||
if (!cDisableTrayCounter()) {
|
if (!cDisableTrayCounter()) {
|
||||||
_placeCounter(lightMode, size, counter, bg, st::trayCounterFg);
|
_placeCounter(img, size, counter, bg, (dm && muted) ? st::trayCounterFgMacInvert : st::trayCounterFg);
|
||||||
_placeCounter(darkMode, size, counter, bg, muted ? st::trayCounterFgMacInvert : st::trayCounterFg);
|
_placeCounter(imgsel, size, counter, st::trayCounterBgMacInvert, st::trayCounterFgMacInvert);
|
||||||
_placeCounter(lightModeActive, size, counter, st::trayCounterBgMacInvert, st::trayCounterFgMacInvert);
|
|
||||||
_placeCounter(darkModeActive, size, counter, st::trayCounterBgMacInvert, st::trayCounterFgMacInvert);
|
|
||||||
}
|
}
|
||||||
result.addPixmap(App::pixmapFromImageInPlace(std::move(lightMode)), QIcon::Normal, QIcon::Off);
|
result.addPixmap(App::pixmapFromImageInPlace(std::move(img)), QIcon::Normal);
|
||||||
result.addPixmap(App::pixmapFromImageInPlace(std::move(darkMode)), QIcon::Normal, QIcon::On);
|
result.addPixmap(App::pixmapFromImageInPlace(std::move(imgsel)), QIcon::Active);
|
||||||
result.addPixmap(App::pixmapFromImageInPlace(std::move(lightModeActive)), QIcon::Active, QIcon::Off);
|
|
||||||
result.addPixmap(App::pixmapFromImageInPlace(std::move(darkModeActive)), QIcon::Active, QIcon::On);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user