mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
service/upower: do not crash when trying to set power profile w/o ppd
This commit is contained in:
2 files changed
+7
No files matched your search
@@ -235,6 +235,7 @@ public:
|
||||
void updateAllDirect();
|
||||
void updateAllViaGetAll();
|
||||
[[nodiscard]] QString toString() const;
|
||||
[[nodiscard]] bool isConnected() const { return this->interface; }
|
||||
|
||||
void pushPropertyUpdate(DBusPropertyCore* property);
|
||||
void requestPropertyUpdate(DBusPropertyCore* property);
|
||||
|
||||
@@ -101,6 +101,12 @@ void PowerProfiles::init() {
|
||||
}
|
||||
|
||||
void PowerProfiles::setProfile(PowerProfile::Enum profile) {
|
||||
if (!this->properties.isConnected()) {
|
||||
qCCritical(logPowerProfiles
|
||||
) << "Cannot set power profile: power-profiles-daemon not accessible or not running";
|
||||
return;
|
||||
}
|
||||
|
||||
if (profile == PowerProfile::Performance && !this->bHasPerformanceProfile) {
|
||||
qCCritical(logPowerProfiles
|
||||
) << "Cannot request performance profile as it is not present for this device.";
|
||||
|
||||
Reference in new issue
Block a user