shift-shell/quicksettings/gaming/contents/ui/main.qml
Marco Allegretti d901815c9d Add gaming mode setting and quick settings tiles
Add a gamingModeEnabled bool and a gamingDismissHintEnabled bool to
the shell settings plugin, persisted in plasmamobilerc [General],
following the same pattern as convergenceModeEnabled.

Two new quick settings tiles:
- org.kde.plasma.quicksetting.gaming: toggles gaming mode on/off,
  shows explicit on/off label matching the convergence tile style.
- org.kde.plasma.quicksetting.gaminghint: shown while gaming mode
  is active; dismisses the Game Center hint.

Both tiles are added to the default group in quicksettings config.
2026-04-19 13:51:00 +02:00

46 lines
1.2 KiB
QML

// SPDX-FileCopyrightText: 2026 Marco Allegretti
// SPDX-License-Identifier: EUPL-1.2
import QtQuick 2.15
import org.kde.kirigami as Kirigami
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
QS.QuickSetting {
id: root
text: i18n("Gaming Mode")
icon: "input-gaming"
status: enabled ? i18n("Active") : i18n("Inactive")
enabled: ShellSettings.Settings.gamingModeEnabled
function requestDisable() {
confirmDisableDialog.active = true;
confirmDisableDialog.item.open();
}
function toggle() {
if (ShellSettings.Settings.gamingModeEnabled) {
requestDisable();
return;
}
ShellSettings.Settings.gamingModeEnabled = true;
}
Loader {
id: confirmDisableDialog
active: false
sourceComponent: Kirigami.PromptDialog {
title: i18n("Exit Gaming Mode")
subtitle: i18n("Switch back to the normal shell layout?")
standardButtons: Kirigami.Dialog.Yes | Kirigami.Dialog.Cancel
onAccepted: ShellSettings.Settings.gamingModeEnabled = false
onClosed: confirmDisableDialog.active = false
}
}
}