mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
quicksettings: Add docked/convergence quick setting
This commit is contained in:
parent
1070605538
commit
fc5b968534
8 changed files with 122 additions and 5 deletions
|
|
@ -34,6 +34,7 @@ MobileShellSettings::MobileShellSettings(QObject *parent)
|
||||||
Q_EMIT taskSwitcherPreviewsEnabledChanged();
|
Q_EMIT taskSwitcherPreviewsEnabledChanged();
|
||||||
Q_EMIT actionDrawerTopLeftModeChanged();
|
Q_EMIT actionDrawerTopLeftModeChanged();
|
||||||
Q_EMIT actionDrawerTopRightModeChanged();
|
Q_EMIT actionDrawerTopRightModeChanged();
|
||||||
|
Q_EMIT convergenceModeEnabledChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -141,3 +142,16 @@ void MobileShellSettings::setActionDrawerTopRightMode(ActionDrawerMode actionDra
|
||||||
group.writeEntry("actionDrawerTopRightMode", (int)actionDrawerMode, KConfigGroup::Notify);
|
group.writeEntry("actionDrawerTopRightMode", (int)actionDrawerMode, KConfigGroup::Notify);
|
||||||
m_config->sync();
|
m_config->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MobileShellSettings::convergenceModeEnabled() const
|
||||||
|
{
|
||||||
|
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||||
|
return group.readEntry("convergenceModeEnabled", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MobileShellSettings::setConvergenceModeEnabled(bool enabled)
|
||||||
|
{
|
||||||
|
auto group = KConfigGroup{m_config, GENERAL_CONFIG_GROUP};
|
||||||
|
group.writeEntry("convergenceModeEnabled", enabled, KConfigGroup::Notify);
|
||||||
|
m_config->sync();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,9 @@ class MobileShellSettings : public QObject
|
||||||
Q_PROPERTY(ActionDrawerMode actionDrawerTopLeftMode READ actionDrawerTopLeftMode WRITE setActionDrawerTopLeftMode NOTIFY actionDrawerTopLeftModeChanged)
|
Q_PROPERTY(ActionDrawerMode actionDrawerTopLeftMode READ actionDrawerTopLeftMode WRITE setActionDrawerTopLeftMode NOTIFY actionDrawerTopLeftModeChanged)
|
||||||
Q_PROPERTY(ActionDrawerMode actionDrawerTopRightMode READ actionDrawerTopRightMode WRITE setActionDrawerTopRightMode NOTIFY actionDrawerTopRightModeChanged)
|
Q_PROPERTY(ActionDrawerMode actionDrawerTopRightMode READ actionDrawerTopRightMode WRITE setActionDrawerTopRightMode NOTIFY actionDrawerTopRightModeChanged)
|
||||||
|
|
||||||
|
// convergence mode
|
||||||
|
Q_PROPERTY(bool convergenceModeEnabled READ convergenceModeEnabled WRITE setConvergenceModeEnabled NOTIFY convergenceModeEnabledChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static MobileShellSettings *self();
|
static MobileShellSettings *self();
|
||||||
|
|
||||||
|
|
@ -151,6 +154,18 @@ public:
|
||||||
*/
|
*/
|
||||||
void setActionDrawerTopRightMode(ActionDrawerMode actionDrawerMode);
|
void setActionDrawerTopRightMode(ActionDrawerMode actionDrawerMode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether convergence/docked mode is enabled.
|
||||||
|
*/
|
||||||
|
bool convergenceModeEnabled() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether convergence/docked mode is enabled.
|
||||||
|
*
|
||||||
|
* @param enabled
|
||||||
|
*/
|
||||||
|
void setConvergenceModeEnabled(bool enabled);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void vibrationsEnabledChanged();
|
void vibrationsEnabledChanged();
|
||||||
void vibrationIntensityChanged();
|
void vibrationIntensityChanged();
|
||||||
|
|
@ -161,6 +176,7 @@ Q_SIGNALS:
|
||||||
void taskSwitcherPreviewsEnabledChanged();
|
void taskSwitcherPreviewsEnabledChanged();
|
||||||
void actionDrawerTopLeftModeChanged();
|
void actionDrawerTopLeftModeChanged();
|
||||||
void actionDrawerTopRightModeChanged();
|
void actionDrawerTopRightModeChanged();
|
||||||
|
void convergenceModeEnabledChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KConfigWatcher::Ptr m_configWatcher;
|
KConfigWatcher::Ptr m_configWatcher;
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,32 @@
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import org.kde.kwin
|
import org.kde.kwin
|
||||||
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
function run(client) {
|
function run(client) {
|
||||||
// if (client.output === 0) {
|
if (!ShellSettings.Settings.convergenceModeEnabled) {
|
||||||
client.setMaximize(true, true);
|
client.setMaximize(true, true);
|
||||||
client.noBorder = true;
|
client.noBorder = true;
|
||||||
// } else {
|
} else {
|
||||||
// client.noBorder = false;
|
client.noBorder = false;
|
||||||
// }
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: ShellSettings.Settings
|
||||||
|
|
||||||
|
function onConvergenceModeEnabledChanged() {
|
||||||
|
const clients = Workspace.clients;
|
||||||
|
|
||||||
|
for (let i = 0; i < clients.length; i++) {
|
||||||
|
if (clients[i].normalWindow) {
|
||||||
|
root.run(clients[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ plasma_install_package(audio org.kde.plasma.quicksetting.audio quicksettings)
|
||||||
plasma_install_package(battery org.kde.plasma.quicksetting.battery quicksettings)
|
plasma_install_package(battery org.kde.plasma.quicksetting.battery quicksettings)
|
||||||
plasma_install_package(bluetooth org.kde.plasma.quicksetting.bluetooth quicksettings)
|
plasma_install_package(bluetooth org.kde.plasma.quicksetting.bluetooth quicksettings)
|
||||||
plasma_install_package(caffeine org.kde.plasma.quicksetting.caffeine quicksettings)
|
plasma_install_package(caffeine org.kde.plasma.quicksetting.caffeine quicksettings)
|
||||||
|
plasma_install_package(docked org.kde.plasma.quicksettings.docked quicksettings)
|
||||||
plasma_install_package(donotdisturb org.kde.plasma.quicksetting.donotdisturb quicksettings)
|
plasma_install_package(donotdisturb org.kde.plasma.quicksetting.donotdisturb quicksettings)
|
||||||
plasma_install_package(keyboardtoggle org.kde.plasma.quicksetting.keyboardtoggle quicksettings)
|
plasma_install_package(keyboardtoggle org.kde.plasma.quicksetting.keyboardtoggle quicksettings)
|
||||||
plasma_install_package(mobiledata org.kde.plasma.quicksetting.mobiledata quicksettings)
|
plasma_install_package(mobiledata org.kde.plasma.quicksetting.mobiledata quicksettings)
|
||||||
|
|
|
||||||
6
quicksettings/docked/Messages.sh
Normal file
6
quicksettings/docked/Messages.sh
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
|
# SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
$XGETTEXT `find . -name \*.js -o -name \*.qml -o -name \*.cpp` -o $podir/plasma_org.kde.plasma.quicksetting.docked.pot
|
||||||
19
quicksettings/docked/contents/ui/main.qml
Normal file
19
quicksettings/docked/contents/ui/main.qml
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
||||||
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||||
|
|
||||||
|
import QtQuick 2.15
|
||||||
|
|
||||||
|
import org.kde.plasma.quicksetting.flashlight
|
||||||
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||||
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
|
||||||
|
QS.QuickSetting {
|
||||||
|
text: i18n("Docked Mode")
|
||||||
|
icon: "preferences-desktop-display-randr"
|
||||||
|
enabled: ShellSettings.Settings.convergenceModeEnabled
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
ShellSettings.Settings.convergenceModeEnabled = !ShellSettings.Settings.convergenceModeEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
47
quicksettings/docked/metadata.json
Normal file
47
quicksettings/docked/metadata.json
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
|
||||||
|
{
|
||||||
|
"KPackageStructure": "KPackage/GenericQML",
|
||||||
|
"KPlugin": {
|
||||||
|
"Authors": [
|
||||||
|
{
|
||||||
|
"Email": "devin@kde.org",
|
||||||
|
"Name": "Devin Lin",
|
||||||
|
"Name[az]": "Devin Lin",
|
||||||
|
"Name[ca@valencia]": "Devin Lin",
|
||||||
|
"Name[ca]": "Devin Lin",
|
||||||
|
"Name[cs]": "Devin Lin",
|
||||||
|
"Name[de]": "Devin Lin",
|
||||||
|
"Name[en_GB]": "Devin Lin",
|
||||||
|
"Name[es]": "Devin Lin",
|
||||||
|
"Name[eu]": "Devin Lin",
|
||||||
|
"Name[fi]": "Devin Lin",
|
||||||
|
"Name[fr]": "Devin Lin",
|
||||||
|
"Name[ia]": "Devin Lin",
|
||||||
|
"Name[is]": "Devin Lin",
|
||||||
|
"Name[it]": "Devin Lin",
|
||||||
|
"Name[ka]": "Devin Lin",
|
||||||
|
"Name[ko]": "Devin Lin",
|
||||||
|
"Name[nl]": "Devin Lin",
|
||||||
|
"Name[nn]": "Devin Lin",
|
||||||
|
"Name[pa]": "ਡੇਵਿਨ ਲਿਨ",
|
||||||
|
"Name[pl]": "Devin Lin",
|
||||||
|
"Name[pt]": "Devin Lin",
|
||||||
|
"Name[pt_BR]": "Devin Lin",
|
||||||
|
"Name[ru]": "Devin Lin",
|
||||||
|
"Name[sl]": "Devin Lin",
|
||||||
|
"Name[sv]": "Devin Lin",
|
||||||
|
"Name[tr]": "Devin Lin",
|
||||||
|
"Name[uk]": "Devin Lin",
|
||||||
|
"Name[x-test]": "xxDevin Linxx",
|
||||||
|
"Name[zh_CN]": "Devin Lin"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Description": "Quick setting to toggle docked mode for Plasma Mobile",
|
||||||
|
"Icon": "preferences-desktop-display-randr",
|
||||||
|
"Id": "org.kde.plasma.quicksetting.docked",
|
||||||
|
"License": "GPL",
|
||||||
|
"Name": "Docked Mode",
|
||||||
|
"Version": "0.1",
|
||||||
|
"Website": "https://kde.org"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
import QtQuick 2.15
|
import QtQuick 2.15
|
||||||
|
|
||||||
import org.kde.plasma.quicksetting.flashlight 1.0
|
import org.kde.plasma.quicksetting.flashlight 1.0
|
||||||
import org.kde.plasma.private.mobileshell 1.0 as MobileShell
|
|
||||||
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
import org.kde.plasma.private.mobileshell.quicksettingsplugin as QS
|
||||||
|
|
||||||
QS.QuickSetting {
|
QS.QuickSetting {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue