mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-06-11 00:47:22 +00:00
Add dynamic tiling toggle quick setting
Expose dynamicTilingEnabled (default true) on MobileShellSettings, stored under the General group of plasmamobilerc and re-emitted by the existing config watcher. shift-tiling extends its activation guard with this flag and clears the BSP layout when it goes false, so users can fall back to KWin native quick-tile at will. Add a quick-settings tile that surfaces the toggle. available is gated on convergenceModeEnabled and !gamingModeEnabled, so the tile is hidden on the phone form factor and during gaming sessions.
This commit is contained in:
parent
d9b2e987dc
commit
3fa5f90ed1
5 changed files with 68 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ MobileShellSettings::MobileShellSettings(QObject *parent)
|
|||
Q_EMIT autoHidePanelsEnabledChanged();
|
||||
Q_EMIT gamingModeEnabledChanged();
|
||||
Q_EMIT gamingDismissHintEnabledChanged();
|
||||
Q_EMIT dynamicTilingEnabledChanged();
|
||||
Q_EMIT allowLogoutChanged();
|
||||
}
|
||||
if (group.name() == LOCKSCREEN_CONFIG_GROUP) {
|
||||
|
|
@ -276,6 +277,19 @@ void MobileShellSettings::setGamingDismissHintEnabled(bool enabled)
|
|||
m_config->sync();
|
||||
}
|
||||
|
||||
bool MobileShellSettings::dynamicTilingEnabled() const
|
||||
{
|
||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||
return group.readEntry("dynamicTilingEnabled", true);
|
||||
}
|
||||
|
||||
void MobileShellSettings::setDynamicTilingEnabled(bool enabled)
|
||||
{
|
||||
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||
group.writeEntry("dynamicTilingEnabled", enabled, KConfigGroup::Notify);
|
||||
m_config->sync();
|
||||
}
|
||||
|
||||
void MobileShellSettings::updateNavigationBarsInPlasma()
|
||||
{
|
||||
// Do not update panels when not in Plasma Mobile
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ class MobileShellSettings : public QObject
|
|||
Q_PROPERTY(bool gamingModeEnabled READ gamingModeEnabled WRITE setGamingModeEnabled NOTIFY gamingModeEnabledChanged)
|
||||
Q_PROPERTY(bool gamingDismissHintEnabled READ gamingDismissHintEnabled WRITE setGamingDismissHintEnabled NOTIFY gamingDismissHintEnabledChanged)
|
||||
|
||||
// Dynamic (BSP) window tiling — only meaningful in convergence mode.
|
||||
// When false, KWin's native quick-tile behaviour is used unmodified.
|
||||
Q_PROPERTY(bool dynamicTilingEnabled READ dynamicTilingEnabled WRITE setDynamicTilingEnabled NOTIFY dynamicTilingEnabledChanged)
|
||||
|
||||
// logout dialog
|
||||
Q_PROPERTY(bool allowLogout READ allowLogout READ allowLogout NOTIFY allowLogoutChanged)
|
||||
|
||||
|
|
@ -274,6 +278,14 @@ public:
|
|||
bool gamingDismissHintEnabled() const;
|
||||
void setGamingDismissHintEnabled(bool enabled);
|
||||
|
||||
/**
|
||||
* Whether the SHIFT BSP dynamic tiling script is active.
|
||||
* Defaults to true; only takes effect in convergence mode (and when
|
||||
* gaming mode is off).
|
||||
*/
|
||||
bool dynamicTilingEnabled() const;
|
||||
void setDynamicTilingEnabled(bool enabled);
|
||||
|
||||
/**
|
||||
* Whether logout button is shown in the logout/shutdown dialog.
|
||||
*/
|
||||
|
|
@ -322,6 +334,7 @@ Q_SIGNALS:
|
|||
void autoHidePanelsEnabledChanged();
|
||||
void gamingModeEnabledChanged();
|
||||
void gamingDismissHintEnabledChanged();
|
||||
void dynamicTilingEnabledChanged();
|
||||
void allowLogoutChanged();
|
||||
void lockscreenLeftButtonActionChanged();
|
||||
void lockscreenRightButtonActionChanged();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ 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(dynamictiling org.kde.plasma.quicksetting.dynamictiling 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)
|
||||
|
|
|
|||
23
quicksettings/dynamictiling/contents/ui/main.qml
Normal file
23
quicksettings/dynamictiling/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// SPDX-FileCopyrightText: 2026 Marco Allegretti
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
|
||||
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||
|
||||
QS.QuickSetting {
|
||||
text: i18n("Dynamic Tiling")
|
||||
icon: "view-grid-symbolic"
|
||||
|
||||
// Only meaningful in convergence (desktop) mode. Hidden everywhere else.
|
||||
available: ShellSettings.Settings.convergenceModeEnabled
|
||||
&& !ShellSettings.Settings.gamingModeEnabled
|
||||
|
||||
enabled: ShellSettings.Settings.dynamicTilingEnabled
|
||||
status: enabled ? i18n("On") : i18n("Off")
|
||||
|
||||
function toggle() {
|
||||
ShellSettings.Settings.dynamicTilingEnabled = !ShellSettings.Settings.dynamicTilingEnabled;
|
||||
}
|
||||
}
|
||||
17
quicksettings/dynamictiling/metadata.json
Normal file
17
quicksettings/dynamictiling/metadata.json
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"KPackageStructure": "KPackage/GenericQML",
|
||||
"KPlugin": {
|
||||
"Authors": [
|
||||
{
|
||||
"Email": "marco@lateuf.it",
|
||||
"Name": "Marco Allegretti"
|
||||
}
|
||||
],
|
||||
"Description": "Quick setting to toggle SHIFT dynamic (BSP) window tiling in convergence mode",
|
||||
"Icon": "view-grid-symbolic",
|
||||
"Id": "org.kde.plasma.quicksetting.dynamictiling",
|
||||
"License": "LGPL",
|
||||
"Name": "Dynamic Tiling",
|
||||
"Website": "https://kde.org"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue