power-profiles-daemon: preserve backward compatibility for driver

Keep the {driver} placeholder working and support older
power-profiles-daemon versions that only expose a single Driver DBus
property, while still reading the new CpuDriver/PlatformDriver fields.

- Read the legacy Driver property and fall back to it when CpuDriver or
  PlatformDriver are missing (older daemon).
- Derive {driver} from CpuDriver when the daemon no longer exposes
  Driver (recent daemon), so existing configs using {driver} keep
  working.
- Align the default tooltip-format in the constructor with the
  documented default.
This commit is contained in:
Alex
2026-07-03 22:11:51 +02:00
parent b9c82f5dd3
commit fe0e1c139b
3 changed files with 40 additions and 7 deletions
+9 -1
View File
@@ -9,10 +9,18 @@ namespace waybar::modules {
struct Profile {
std::string name;
// Legacy driver field, kept for backward compatibility with the
// `{driver}` format placeholder and with older power-profiles-daemon
// versions that only expose a single `Driver` DBus property.
std::string driver;
std::string cpuDriver;
std::string platformDriver;
Profile(std::string n, std::string cd, std::string pd) : name(std::move(n)), cpuDriver(std::move(cd)), platformDriver(std::move(pd)) {}
Profile(std::string n, std::string d, std::string cd, std::string pd)
: name(std::move(n)),
driver(std::move(d)),
cpuDriver(std::move(cd)),
platformDriver(std::move(pd)) {}
};
class PowerProfilesDaemon : public ALabel {