shift-shell/components/gamingshellplugin/gamemodecontrol.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

46 lines
1.1 KiB
C++

// SPDX-FileCopyrightText: 2026 Marco Allegretti
// SPDX-License-Identifier: EUPL-1.2
#pragma once
#include <QDBusInterface>
#include <QObject>
#include <qqmlregistration.h>
/**
* D-Bus client for Feral GameMode (com.feralinteractive.GameMode).
*
* Calling requestStart() tells the daemon to apply performance
* optimizations (CPU governor, I/O priority, GPU perf mode, etc.)
* for the calling process. requestEnd() reverses them.
*
* GameMode is optional — if the daemon is not installed the calls
* are silently ignored.
*/
class GameModeControl : public QObject
{
Q_OBJECT
QML_ELEMENT
QML_SINGLETON
Q_PROPERTY(bool available READ available NOTIFY availableChanged)
Q_PROPERTY(bool active READ active NOTIFY activeChanged)
public:
explicit GameModeControl(QObject *parent = nullptr);
bool available() const;
bool active() const;
Q_INVOKABLE void requestStart();
Q_INVOKABLE void requestEnd();
Q_SIGNALS:
void availableChanged();
void activeChanged();
private:
QDBusInterface *m_iface = nullptr;
bool m_available = false;
bool m_active = false;
};