shift-shell/components/gamingshellplugin/powerprofilecontrol.h
Marco Allegretti 62243b7f64 Add gaming session control backends
Add PowerProfileControl and GameModeControl singletons and wire
them into gaming mode lifecycle handling. When gaming mode turns
on, keep DND on, switch to the performance profile when available,
and request GameMode. Restore previous state when gaming mode
turns off.

Add an overlayEnabled property in GameLauncherProvider so the
launcher can toggle MangoHud environment variables from QML.
2026-04-21 09:08:03 +02:00

44 lines
1.1 KiB
C++

// SPDX-FileCopyrightText: 2026 Marco Allegretti
// SPDX-License-Identifier: EUPL-1.2
#pragma once
#include <QDBusInterface>
#include <QObject>
#include <QStringList>
#include <qqmlregistration.h>
class PowerProfileControl : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(QString activeProfile READ activeProfile WRITE setActiveProfile NOTIFY activeProfileChanged)
Q_PROPERTY(QStringList profiles READ profiles NOTIFY profilesChanged)
Q_PROPERTY(bool available READ available NOTIFY availableChanged)
public:
explicit PowerProfileControl(QObject *parent = nullptr);
QString activeProfile() const;
void setActiveProfile(const QString &profile);
QStringList profiles() const;
bool available() const;
Q_SIGNALS:
void activeProfileChanged();
void profilesChanged();
void availableChanged();
private Q_SLOTS:
void onPropertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
private:
void fetchState();
QDBusInterface *m_iface = nullptr;
QString m_activeProfile;
QStringList m_profiles;
bool m_available = false;
};