mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 14:43:09 +00:00
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.
This commit is contained in:
parent
e9dbfa5ea1
commit
d901815c9d
10 changed files with 155 additions and 0 deletions
|
|
@ -45,6 +45,8 @@ QList<QString> QuickSettingsConfig::enabledQuickSettings() const
|
|||
QStringLiteral("org.kde.plasma.quicksetting.screenshot"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.powermenu"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.donotdisturb"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.gaming"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.gaminghint"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.caffeine"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.keyboardtoggle"),
|
||||
QStringLiteral("org.kde.plasma.quicksetting.hotspot")});
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ MobileShellSettings::MobileShellSettings(QObject *parent)
|
|||
Q_EMIT actionDrawerTopRightModeChanged();
|
||||
Q_EMIT convergenceModeEnabledChanged();
|
||||
Q_EMIT autoHidePanelsEnabledChanged();
|
||||
Q_EMIT gamingModeEnabledChanged();
|
||||
Q_EMIT gamingDismissHintEnabledChanged();
|
||||
Q_EMIT allowLogoutChanged();
|
||||
}
|
||||
if (group.name() == LOCKSCREEN_CONFIG_GROUP) {
|
||||
|
|
@ -248,6 +250,32 @@ void MobileShellSettings::setAutoHidePanelsEnabled(bool enabled)
|
|||
m_config->sync();
|
||||
}
|
||||
|
||||
bool MobileShellSettings::gamingModeEnabled() const
|
||||
{
|
||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||
return group.readEntry("gamingModeEnabled", false);
|
||||
}
|
||||
|
||||
void MobileShellSettings::setGamingModeEnabled(bool enabled)
|
||||
{
|
||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||
group.writeEntry("gamingModeEnabled", enabled, KConfigGroup::Notify);
|
||||
m_config->sync();
|
||||
}
|
||||
|
||||
bool MobileShellSettings::gamingDismissHintEnabled() const
|
||||
{
|
||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||
return group.readEntry("gamingDismissHintEnabled", true);
|
||||
}
|
||||
|
||||
void MobileShellSettings::setGamingDismissHintEnabled(bool enabled)
|
||||
{
|
||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||
group.writeEntry("gamingDismissHintEnabled", enabled, KConfigGroup::Notify);
|
||||
m_config->sync();
|
||||
}
|
||||
|
||||
void MobileShellSettings::updateNavigationBarsInPlasma()
|
||||
{
|
||||
// Do not update panels when not in Plasma Mobile
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ class MobileShellSettings : public QObject
|
|||
// Auto Hide Panels
|
||||
Q_PROPERTY(bool autoHidePanelsEnabled READ autoHidePanelsEnabled WRITE setAutoHidePanelsEnabled NOTIFY autoHidePanelsEnabledChanged)
|
||||
|
||||
// Gaming mode
|
||||
Q_PROPERTY(bool gamingModeEnabled READ gamingModeEnabled WRITE setGamingModeEnabled NOTIFY gamingModeEnabledChanged)
|
||||
Q_PROPERTY(bool gamingDismissHintEnabled READ gamingDismissHintEnabled WRITE setGamingDismissHintEnabled NOTIFY gamingDismissHintEnabledChanged)
|
||||
|
||||
// logout dialog
|
||||
Q_PROPERTY(bool allowLogout READ allowLogout READ allowLogout NOTIFY allowLogoutChanged)
|
||||
|
||||
|
|
@ -264,6 +268,12 @@ public:
|
|||
*/
|
||||
void setAutoHidePanelsEnabled(bool enabled);
|
||||
|
||||
bool gamingModeEnabled() const;
|
||||
void setGamingModeEnabled(bool enabled);
|
||||
|
||||
bool gamingDismissHintEnabled() const;
|
||||
void setGamingDismissHintEnabled(bool enabled);
|
||||
|
||||
/**
|
||||
* Whether logout button is shown in the logout/shutdown dialog.
|
||||
*/
|
||||
|
|
@ -310,6 +320,8 @@ Q_SIGNALS:
|
|||
void quickSettingsColumnsChanged();
|
||||
void convergenceModeEnabledChanged();
|
||||
void autoHidePanelsEnabledChanged();
|
||||
void gamingModeEnabledChanged();
|
||||
void gamingDismissHintEnabledChanged();
|
||||
void allowLogoutChanged();
|
||||
void lockscreenLeftButtonActionChanged();
|
||||
void lockscreenRightButtonActionChanged();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ plasma_install_package(bluetooth org.kde.plasma.quicksetting.bluetooth quicksett
|
|||
plasma_install_package(caffeine org.kde.plasma.quicksetting.caffeine quicksettings)
|
||||
plasma_install_package(docked org.kde.plasma.quicksetting.docked quicksettings)
|
||||
plasma_install_package(donotdisturb org.kde.plasma.quicksetting.donotdisturb quicksettings)
|
||||
plasma_install_package(gaming org.kde.plasma.quicksetting.gaming quicksettings)
|
||||
plasma_install_package(gaminghint org.kde.plasma.quicksetting.gaminghint quicksettings)
|
||||
plasma_install_package(autohidepanels org.kde.plasma.quicksetting.autohidepanels quicksettings)
|
||||
plasma_install_package(keyboardtoggle org.kde.plasma.quicksetting.keyboardtoggle quicksettings)
|
||||
plasma_install_package(kscreenosd org.kde.plasma.quicksetting.kscreenosd quicksettings)
|
||||
|
|
|
|||
6
quicksettings/gaming/Messages.sh
Normal file
6
quicksettings/gaming/Messages.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
# SPDX-FileCopyrightText: 2026 Marco Allegretti
|
||||
# SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_org.kde.plasma.quicksetting.gaming.pot
|
||||
46
quicksettings/gaming/contents/ui/main.qml
Normal file
46
quicksettings/gaming/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
18
quicksettings/gaming/metadata.json
Normal file
18
quicksettings/gaming/metadata.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"KPackageStructure": "KPackage/GenericQML",
|
||||
"KPlugin": {
|
||||
"Authors": [
|
||||
{
|
||||
"Email": "mightymarco4@gmail.com",
|
||||
"Name": "Marco Allegretti"
|
||||
}
|
||||
],
|
||||
"Description": "Quick setting to toggle gaming mode for Plasma Mobile",
|
||||
"Icon": "input-gaming",
|
||||
"Id": "org.kde.plasma.quicksetting.gaming",
|
||||
"License": "EUPL-1.2",
|
||||
"Name": "Gaming Mode",
|
||||
"Version": "0.1",
|
||||
"Website": ""
|
||||
}
|
||||
}
|
||||
5
quicksettings/gaminghint/Messages.sh
Normal file
5
quicksettings/gaminghint/Messages.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
# SPDX-FileCopyrightText: 2026 Marco Allegretti
|
||||
# SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
$XGETTEXT *.json contents/ui/*.qml -o $podir/plasma_mobile_qt.pot
|
||||
18
quicksettings/gaminghint/contents/ui/main.qml
Normal file
18
quicksettings/gaminghint/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// SPDX-FileCopyrightText: 2026 Marco Allegretti
|
||||
// SPDX-License-Identifier: EUPL-1.2
|
||||
|
||||
import QtQuick 2.15
|
||||
|
||||
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
QS.QuickSetting {
|
||||
text: i18n("Game Center Hint")
|
||||
icon: "dialog-information"
|
||||
status: ""
|
||||
enabled: ShellSettings.Settings.gamingDismissHintEnabled
|
||||
|
||||
function toggle() {
|
||||
ShellSettings.Settings.gamingDismissHintEnabled = !ShellSettings.Settings.gamingDismissHintEnabled;
|
||||
}
|
||||
}
|
||||
18
quicksettings/gaminghint/metadata.json
Normal file
18
quicksettings/gaminghint/metadata.json
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"KPackageStructure": "KPackage/GenericQML",
|
||||
"KPlugin": {
|
||||
"Authors": [
|
||||
{
|
||||
"Email": "mightymarco4@gmail.com",
|
||||
"Name": "Marco Allegretti"
|
||||
}
|
||||
],
|
||||
"Description": "Quick setting to toggle the Game Center dismiss hint banner",
|
||||
"Icon": "dialog-information",
|
||||
"Id": "org.kde.plasma.quicksetting.gaminghint",
|
||||
"License": "EUPL-1.2",
|
||||
"Name": "Game Center Hint",
|
||||
"Version": "0.1",
|
||||
"Website": ""
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue