From c37bddbe51e3a59a368520354f9652f00388a144 Mon Sep 17 00:00:00 2001 From: Odizinne Date: Mon, 16 Sep 2024 13:55:52 +0200 Subject: [PATCH] fixed battery icon not appearing in non plasma env, use light icon set as system value for gnome --- src/HeadsetControlQt/headsetcontrolqt.cpp | 16 ++++++++-------- src/Utils/utils.cpp | 8 ++++---- src/main.cpp | 1 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/HeadsetControlQt/headsetcontrolqt.cpp b/src/HeadsetControlQt/headsetcontrolqt.cpp index 7a5311f..00a5184 100644 --- a/src/HeadsetControlQt/headsetcontrolqt.cpp +++ b/src/HeadsetControlQt/headsetcontrolqt.cpp @@ -363,9 +363,9 @@ void HeadsetControlQt::updateUIWithHeadsetInfo(const QJsonObject &headsetInfo) trayIcon->setIcon(QIcon(iconPath)); } else if (kdeVersion.startsWith("6")) { trayIcon->setIcon(QIcon::fromTheme(iconPath)); - } else { - trayIcon->setIcon(QIcon(iconPath)); } + } else { + trayIcon->setIcon(QIcon(iconPath)); } #endif } else if (batteryStatus == "BATTERY_CHARGING") { @@ -385,9 +385,9 @@ void HeadsetControlQt::updateUIWithHeadsetInfo(const QJsonObject &headsetInfo) trayIcon->setIcon(QIcon(iconPath)); } else if (kdeVersion.startsWith("6")) { trayIcon->setIcon(QIcon::fromTheme(iconPath)); - } else { - trayIcon->setIcon(QIcon(iconPath)); } + } else { + trayIcon->setIcon(QIcon(iconPath)); } #endif } else { @@ -407,9 +407,9 @@ void HeadsetControlQt::updateUIWithHeadsetInfo(const QJsonObject &headsetInfo) trayIcon->setIcon(QIcon(iconPath)); } else if (kdeVersion.startsWith("6")) { trayIcon->setIcon(QIcon::fromTheme(iconPath)); - } else { - trayIcon->setIcon(QIcon(iconPath)); } + } else { + trayIcon->setIcon(QIcon(iconPath)); } #endif } @@ -439,9 +439,9 @@ void HeadsetControlQt::noDeviceFound() trayIcon->setIcon(QIcon(iconPath)); } else if (kdeVersion.startsWith("6")) { trayIcon->setIcon(QIcon::fromTheme(iconPath)); - } else { - trayIcon->setIcon(QIcon(iconPath)); } + } else { + trayIcon->setIcon(QIcon(iconPath)); } #endif } diff --git a/src/Utils/utils.cpp b/src/Utils/utils.cpp index b22fc9c..6394713 100644 --- a/src/Utils/utils.cpp +++ b/src/Utils/utils.cpp @@ -62,15 +62,15 @@ QString getBatteryIcon(int batteryLevel, bool charging, bool missing, int themeI QString desktop = env.value("XDG_CURRENT_DESKTOP"); if (desktop.contains("KDE", Qt::CaseInsensitive)) { QString kdeVersion = getKDEPlasmaVersion(); - if (kdeVersion.startsWith("5")) { - theme = "light"; - } else if (kdeVersion.startsWith("6")) { + if (kdeVersion.startsWith("6")) { theme = "symbolic"; } else { theme = "light"; } + } else if (desktop.contains("GNOME", Qt::CaseInsensitive)) { + theme = "light"; } else { - theme = "dark"; // Fallback for non-KDE environments + theme = "dark"; } #endif } else if (themeIndex == 1) { diff --git a/src/main.cpp b/src/main.cpp index 513c639..cb503f6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,5 +10,4 @@ int main(int argc, char *argv[]) a.setQuitOnLastWindowClosed(false); HeadsetControlQt w; return a.exec(); - }