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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user