Skip to content

Commit

Permalink
fixed battery icon not appearing in non plasma env, use light icon se…
Browse files Browse the repository at this point in the history
…t as system value for gnome
  • Loading branch information
Odizinne committed Sep 16, 2024
1 parent 8c0fbf2 commit c37bddb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
16 changes: 8 additions & 8 deletions src/HeadsetControlQt/headsetcontrolqt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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 {
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions src/Utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ int main(int argc, char *argv[])
a.setQuitOnLastWindowClosed(false);
HeadsetControlQt w;
return a.exec();

}

0 comments on commit c37bddb

Please sign in to comment.