mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
gestures: Set kwin touch area to be gesture guide area height
Use a heuristic (the height of the gesture guide panel) to set the gesture trigger area.
This commit is contained in:
parent
97052dee2b
commit
22b095e340
6 changed files with 70 additions and 7 deletions
|
|
@ -40,6 +40,13 @@ QtObject {
|
||||||
return root.panelSettings.navigationPanelHeight;
|
return root.panelSettings.navigationPanelHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readonly property real screenEdgeTouchTarget: (ShellSettings.Settings.gesturePanelEnabled && !ShellSettings.Settings.navigationPanelEnabled) ? defaultGesturePanelThickness : 8
|
||||||
|
onScreenEdgeTouchTargetChanged: {
|
||||||
|
if (ShellSettings.KWinSettings.screenEdgeTouchTarget != screenEdgeTouchTarget) {
|
||||||
|
ShellSettings.KWinSettings.screenEdgeTouchTarget = screenEdgeTouchTarget;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function navigationPanelOnSide(screenWidth: real, screenHeight: real): bool {
|
function navigationPanelOnSide(screenWidth: real, screenHeight: real): bool {
|
||||||
// TODO: we have this disabled for now, we might consider just removing this feature entirely due to it causing several issues:
|
// TODO: we have this disabled for now, we might consider just removing this feature entirely due to it causing several issues:
|
||||||
// (the feature being the navigation panel being moved to the right when the screen height is small)
|
// (the feature being the navigation panel being moved to the right when the screen height is small)
|
||||||
|
|
|
||||||
|
|
@ -7,17 +7,22 @@
|
||||||
#include "kwinsettings.h"
|
#include "kwinsettings.h"
|
||||||
|
|
||||||
const QString CONFIG_FILE = QStringLiteral("kwinrc");
|
const QString CONFIG_FILE = QStringLiteral("kwinrc");
|
||||||
|
const QString OVERLAY_CONFIG_FILE = QStringLiteral("plasma-mobile/kwinrc");
|
||||||
const QString WAYLAND_CONFIG_GROUP = QStringLiteral("Wayland");
|
const QString WAYLAND_CONFIG_GROUP = QStringLiteral("Wayland");
|
||||||
|
const QString SCREEN_EDGES_CONFIG_GROUP = QStringLiteral("ScreenEdges");
|
||||||
|
|
||||||
KWinSettings::KWinSettings(QObject *parent)
|
KWinSettings::KWinSettings(QObject *parent)
|
||||||
: QObject{parent}
|
: QObject{parent}
|
||||||
, m_config{KSharedConfig::openConfig(CONFIG_FILE)}
|
, m_config{KSharedConfig::openConfig(CONFIG_FILE)}
|
||||||
|
, m_overlayConfig{KSharedConfig::openConfig(OVERLAY_CONFIG_FILE)}
|
||||||
{
|
{
|
||||||
m_configWatcher = KConfigWatcher::create(m_config);
|
m_configWatcher = KConfigWatcher::create(m_config);
|
||||||
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) -> void {
|
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) -> void {
|
||||||
Q_UNUSED(names)
|
Q_UNUSED(names)
|
||||||
if (group.name() == WAYLAND_CONFIG_GROUP) {
|
if (group.name() == WAYLAND_CONFIG_GROUP) {
|
||||||
Q_EMIT doubleTapWakeupChanged();
|
Q_EMIT doubleTapWakeupChanged();
|
||||||
|
} else if (group.name() == SCREEN_EDGES_CONFIG_GROUP) {
|
||||||
|
Q_EMIT screenEdgeTouchTargetChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -30,7 +35,25 @@ bool KWinSettings::doubleTapWakeup() const
|
||||||
|
|
||||||
void KWinSettings::setDoubleTapWakeup(bool enabled)
|
void KWinSettings::setDoubleTapWakeup(bool enabled)
|
||||||
{
|
{
|
||||||
auto group = KConfigGroup{m_config, WAYLAND_CONFIG_GROUP};
|
if (enabled != doubleTapWakeup()) {
|
||||||
group.writeEntry("DoubleTapWakeup", enabled, KConfigGroup::Notify);
|
auto group = KConfigGroup{m_config, WAYLAND_CONFIG_GROUP};
|
||||||
m_config->sync();
|
group.writeEntry("DoubleTapWakeup", enabled, KConfigGroup::Notify);
|
||||||
|
m_config->sync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int KWinSettings::screenEdgeTouchTarget() const
|
||||||
|
{
|
||||||
|
auto group = KConfigGroup{m_overlayConfig, SCREEN_EDGES_CONFIG_GROUP};
|
||||||
|
return group.readEntry("TouchTarget", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void KWinSettings::setScreenEdgeTouchTarget(int target)
|
||||||
|
{
|
||||||
|
// Use m_overlayConfig instead of m_config so we don't affect other shells
|
||||||
|
if (target != screenEdgeTouchTarget()) {
|
||||||
|
auto group = KConfigGroup{m_overlayConfig, SCREEN_EDGES_CONFIG_GROUP};
|
||||||
|
group.writeEntry("TouchTarget", target, KConfigGroup::Notify);
|
||||||
|
m_overlayConfig->sync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class KWinSettings : public QObject
|
||||||
QML_SINGLETON
|
QML_SINGLETON
|
||||||
|
|
||||||
Q_PROPERTY(bool doubleTapWakeup READ doubleTapWakeup WRITE setDoubleTapWakeup NOTIFY doubleTapWakeupChanged)
|
Q_PROPERTY(bool doubleTapWakeup READ doubleTapWakeup WRITE setDoubleTapWakeup NOTIFY doubleTapWakeupChanged)
|
||||||
|
Q_PROPERTY(int screenEdgeTouchTarget READ screenEdgeTouchTarget WRITE setScreenEdgeTouchTarget NOTIFY screenEdgeTouchTargetChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
KWinSettings(QObject *parent = nullptr);
|
KWinSettings(QObject *parent = nullptr);
|
||||||
|
|
@ -35,10 +36,24 @@ public:
|
||||||
*/
|
*/
|
||||||
void setDoubleTapWakeup(bool enabled);
|
void setDoubleTapWakeup(bool enabled);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the screen edge touch target value.
|
||||||
|
*/
|
||||||
|
int screenEdgeTouchTarget() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the screen edge touch target value.
|
||||||
|
*
|
||||||
|
* @param target
|
||||||
|
*/
|
||||||
|
void setScreenEdgeTouchTarget(int target);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void doubleTapWakeupChanged();
|
void doubleTapWakeupChanged();
|
||||||
|
void screenEdgeTouchTargetChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KConfigWatcher::Ptr m_configWatcher;
|
KConfigWatcher::Ptr m_configWatcher;
|
||||||
KSharedConfig::Ptr m_config;
|
KSharedConfig::Ptr m_config;
|
||||||
|
KSharedConfig::Ptr m_overlayConfig;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ plasma_add_applet(org.kde.plasma.mobile.taskpanel
|
||||||
QML_SOURCES
|
QML_SOURCES
|
||||||
qml/main.qml
|
qml/main.qml
|
||||||
qml/NavigationPanelComponent.qml
|
qml/NavigationPanelComponent.qml
|
||||||
|
qml/GesturePanelComponent.qml
|
||||||
CPP_SOURCES
|
CPP_SOURCES
|
||||||
taskpanel.cpp
|
taskpanel.cpp
|
||||||
)
|
)
|
||||||
|
|
|
||||||
20
containments/taskpanel/qml/GesturePanelComponent.qml
Normal file
20
containments/taskpanel/qml/GesturePanelComponent.qml
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
// SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
|
||||||
|
// SPDX-FileCopyrightText: 2021-2023 Devin Lin <devin@kde.org>
|
||||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
|
|
||||||
|
import org.kde.plasma.plasmoid
|
||||||
|
|
||||||
|
import org.kde.plasma.private.mobileshell as MobileShell
|
||||||
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
||||||
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
||||||
|
|
||||||
|
MobileShell.GesturePanel {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
onHandlePressedAndHeld: MobileShellState.ShellDBusClient.openHomeScreen()
|
||||||
|
onHandleClicked: Plasmoid.triggerTaskSwitcher()
|
||||||
|
}
|
||||||
|
|
@ -197,15 +197,12 @@ ContainmentItem {
|
||||||
Component {
|
Component {
|
||||||
id: gesturePanelComponent
|
id: gesturePanelComponent
|
||||||
|
|
||||||
MobileShell.GesturePanel {
|
GesturePanelComponent {
|
||||||
opaqueBar: root.opaqueBar
|
opaqueBar: root.opaqueBar
|
||||||
|
|
||||||
Kirigami.Theme.inherit: false
|
Kirigami.Theme.inherit: false
|
||||||
Kirigami.Theme.colorSet: (!opaqueBar && !startupFeedbackColorAnimation.isShowing) ? Kirigami.Theme.Complementary : Kirigami.Theme.Window
|
Kirigami.Theme.colorSet: (!opaqueBar && !startupFeedbackColorAnimation.isShowing) ? Kirigami.Theme.Complementary : Kirigami.Theme.Window
|
||||||
|
|
||||||
onHandlePressedAndHeld: MobileShellState.ShellDBusClient.openHomeScreen()
|
|
||||||
onHandleClicked: Plasmoid.triggerTaskSwitcher()
|
|
||||||
|
|
||||||
transform: [
|
transform: [
|
||||||
Translate {
|
Translate {
|
||||||
y: inLandscape ? 0 : navigationPanel.offset
|
y: inLandscape ? 0 : navigationPanel.offset
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue