2017-04-02 18:56:52 +00:00
|
|
|
/********************************************************************
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2008 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
Copyright (C) 2009 Lucas Murray <lmurray@undefinedfire.com>
|
2020-03-05 09:45:46 +00:00
|
|
|
Copyright (C) 2020 Cyril Rossi <cyril.rossi@enioka.com>
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
|
|
|
|
|
|
|
#include "touch.h"
|
|
|
|
#include <effect_builtins.h>
|
|
|
|
#include <kwin_effects_interface.h>
|
|
|
|
|
|
|
|
#include <KAboutData>
|
|
|
|
#include <KConfigGroup>
|
|
|
|
#include <KLocalizedString>
|
|
|
|
#include <KPluginFactory>
|
|
|
|
#include <KPackage/Package>
|
|
|
|
#include <KPackage/PackageLoader>
|
2018-06-05 10:52:57 +00:00
|
|
|
#include <QtDBus>
|
2020-03-05 09:45:46 +00:00
|
|
|
#include <QVBoxLayout>
|
|
|
|
|
|
|
|
#include "kwintouchscreenedgeconfigform.h"
|
|
|
|
#include "kwintouchscreensettings.h"
|
|
|
|
#include "kwintouchscreenscriptsettings.h"
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
K_PLUGIN_FACTORY(KWinScreenEdgesConfigFactory, registerPlugin<KWin::KWinScreenEdgesConfig>();)
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
KWinScreenEdgesConfig::KWinScreenEdgesConfig(QWidget *parent, const QVariantList &args)
|
2017-04-02 18:56:52 +00:00
|
|
|
: KCModule(parent, args)
|
2020-03-05 09:45:46 +00:00
|
|
|
, m_form(new KWinTouchScreenEdgeConfigForm(this))
|
2017-04-02 18:56:52 +00:00
|
|
|
, m_config(KSharedConfig::openConfig("kwinrc"))
|
2020-03-05 09:45:46 +00:00
|
|
|
, m_settings(new KWinTouchScreenSettings(this))
|
2017-04-02 18:56:52 +00:00
|
|
|
{
|
|
|
|
QVBoxLayout* layout = new QVBoxLayout(this);
|
2020-03-05 09:45:46 +00:00
|
|
|
layout->addWidget(m_form);
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
monitorInit();
|
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
connect(m_form, &KWinTouchScreenEdgeConfigForm::saveNeededChanged, this, &KWinScreenEdgesConfig::unmanagedWidgetChangeState);
|
|
|
|
connect(m_form, &KWinTouchScreenEdgeConfigForm::defaultChanged, this, &KWinScreenEdgesConfig::unmanagedWidgetDefaultState);
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
KWinScreenEdgesConfig::~KWinScreenEdgesConfig()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::load()
|
|
|
|
{
|
|
|
|
KCModule::load();
|
2020-03-05 09:45:46 +00:00
|
|
|
m_settings->load();
|
|
|
|
for (KWinTouchScreenScriptSettings *setting : qAsConst(m_scriptSettings)) {
|
|
|
|
setting->load();
|
|
|
|
}
|
2017-04-02 18:56:52 +00:00
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
monitorLoadSettings();
|
|
|
|
monitorLoadDefaultSettings();
|
|
|
|
m_form->reload();
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::save()
|
|
|
|
{
|
2020-03-05 09:45:46 +00:00
|
|
|
monitorSaveSettings();
|
|
|
|
m_settings->save();
|
|
|
|
for (KWinTouchScreenScriptSettings *setting : qAsConst(m_scriptSettings)) {
|
|
|
|
setting->save();
|
|
|
|
}
|
2017-04-02 18:56:52 +00:00
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
// Reload saved settings to ScreenEdge UI
|
|
|
|
monitorLoadSettings();
|
|
|
|
m_form->reload();
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
// Reload KWin.
|
|
|
|
QDBusMessage message = QDBusMessage::createSignal("/KWin", "org.kde.KWin", "reloadConfig");
|
|
|
|
QDBusConnection::sessionBus().send(message);
|
|
|
|
// and reconfigure the effects
|
|
|
|
OrgKdeKwinEffectsInterface interface(QStringLiteral("org.kde.KWin"),
|
|
|
|
QStringLiteral("/Effects"),
|
|
|
|
QDBusConnection::sessionBus());
|
|
|
|
interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::PresentWindows));
|
|
|
|
interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::DesktopGrid));
|
|
|
|
interface.reconfigureEffect(BuiltInEffects::nameForEffect(BuiltInEffect::Cube));
|
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
KCModule::save();
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::defaults()
|
|
|
|
{
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->setDefaults();
|
2017-04-02 18:56:52 +00:00
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
KCModule::defaults();
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::showEvent(QShowEvent* e)
|
|
|
|
{
|
|
|
|
KCModule::showEvent(e);
|
|
|
|
|
|
|
|
monitorShowEvent();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Copied from kcmkwin/kwincompositing/main.cpp
|
|
|
|
bool KWinScreenEdgesConfig::effectEnabled(const BuiltInEffect& effect, const KConfigGroup& cfg) const
|
|
|
|
{
|
|
|
|
return cfg.readEntry(BuiltInEffects::nameForEffect(effect) + "Enabled", BuiltInEffects::enabledByDefault(effect));
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Monitor
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::monitorInit()
|
|
|
|
{
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorHideEdge(ElectricTopLeft, true);
|
|
|
|
m_form->monitorHideEdge(ElectricTopRight, true);
|
|
|
|
m_form->monitorHideEdge(ElectricBottomRight, true);
|
|
|
|
m_form->monitorHideEdge(ElectricBottomLeft, true);
|
|
|
|
|
|
|
|
m_form->monitorAddItem(i18n("No Action"));
|
|
|
|
m_form->monitorAddItem(i18n("Show Desktop"));
|
|
|
|
m_form->monitorAddItem(i18n("Lock Screen"));
|
|
|
|
m_form->monitorAddItem(i18n("Show KRunner"));
|
|
|
|
m_form->monitorAddItem(i18n("Activity Manager"));
|
|
|
|
m_form->monitorAddItem(i18n("Application Launcher"));
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
// Add the effects
|
|
|
|
const QString presentWindowsName = BuiltInEffects::effectData(BuiltInEffect::PresentWindows).displayName;
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorAddItem(i18n("%1 - All Desktops", presentWindowsName));
|
|
|
|
m_form->monitorAddItem(i18n("%1 - Current Desktop", presentWindowsName));
|
|
|
|
m_form->monitorAddItem(i18n("%1 - Current Application", presentWindowsName));
|
|
|
|
m_form->monitorAddItem(BuiltInEffects::effectData(BuiltInEffect::DesktopGrid).displayName);
|
2017-04-02 18:56:52 +00:00
|
|
|
const QString cubeName = BuiltInEffects::effectData(BuiltInEffect::Cube).displayName;
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorAddItem(i18n("%1 - Cube", cubeName));
|
|
|
|
m_form->monitorAddItem(i18n("%1 - Cylinder", cubeName));
|
|
|
|
m_form->monitorAddItem(i18n("%1 - Sphere", cubeName));
|
2017-04-02 18:56:52 +00:00
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorAddItem(i18n("Toggle window switching"));
|
|
|
|
m_form->monitorAddItem(i18n("Toggle alternative window switching"));
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
const QString scriptFolder = QStringLiteral("kwin/scripts/");
|
|
|
|
const auto scripts = KPackage::PackageLoader::self()->listPackages(QStringLiteral("KWin/Script"), scriptFolder);
|
|
|
|
|
|
|
|
KConfigGroup config(m_config, "Plugins");
|
|
|
|
for (const KPluginMetaData &script: scripts) {
|
|
|
|
if (script.value(QStringLiteral("X-KWin-Border-Activate")) != QLatin1String("true")) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!config.readEntry(script.pluginId() + QStringLiteral("Enabled"), script.isEnabledByDefault())) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
m_scripts << script.pluginId();
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorAddItem(script.name());
|
|
|
|
m_scriptSettings[script.pluginId()] = new KWinTouchScreenScriptSettings(script.pluginId(), this);
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
monitorShowEvent();
|
|
|
|
}
|
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
void KWinScreenEdgesConfig::monitorLoadSettings()
|
2017-04-02 18:56:52 +00:00
|
|
|
{
|
|
|
|
// Load ElectricBorderActions
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorChangeEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->top()));
|
|
|
|
m_form->monitorChangeEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->right()));
|
|
|
|
m_form->monitorChangeEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->bottom()));
|
|
|
|
m_form->monitorChangeEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->left()));
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
// Load effect-specific actions:
|
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
// Present Windows BorderActivateAll
|
|
|
|
m_form->monitorChangeEdge(m_settings->touchBorderActivateAll(), PresentWindowsAll);
|
2017-04-02 18:56:52 +00:00
|
|
|
// PresentWindows BorderActivate
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorChangeEdge(m_settings->touchBorderActivatePresentWindows(), PresentWindowsCurrent);
|
2017-04-02 18:56:52 +00:00
|
|
|
// PresentWindows BorderActivateClass
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorChangeEdge(m_settings->touchBorderActivateClass(), PresentWindowsClass);
|
2017-04-02 18:56:52 +00:00
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
// Desktop Grid BorderActivate
|
|
|
|
m_form->monitorChangeEdge(m_settings->touchBorderActivateDesktopGrid(), DesktopGrid);
|
2017-04-02 18:56:52 +00:00
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
// Desktop Cube BorderActivate
|
|
|
|
m_form->monitorChangeEdge(m_settings->touchBorderActivateCube(), Cube);
|
|
|
|
// Desktop Cube BorderActivateCylinder
|
|
|
|
m_form->monitorChangeEdge(m_settings->touchBorderActivateCylinder(), Cylinder);
|
|
|
|
// Desktop Cube BorderActivateSphere
|
|
|
|
m_form->monitorChangeEdge(m_settings->touchBorderActivateSphere(), Sphere);
|
2017-04-02 18:56:52 +00:00
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
// TabBox BorderActivate
|
|
|
|
m_form->monitorChangeEdge(m_settings->touchBorderActivateTabBox(), TabBox);
|
2017-04-02 18:56:52 +00:00
|
|
|
// Alternative TabBox
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorChangeEdge(m_settings->touchBorderAlternativeActivate(), TabBoxAlternative);
|
2017-04-02 18:56:52 +00:00
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
// Scripts
|
2017-04-02 18:56:52 +00:00
|
|
|
for (int i=0; i < m_scripts.size(); i++) {
|
|
|
|
int index = EffectCount + i;
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorChangeEdge(m_scriptSettings[m_scripts[i]]->touchBorderActivate(), index);
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
void KWinScreenEdgesConfig::monitorLoadDefaultSettings()
|
2017-04-02 18:56:52 +00:00
|
|
|
{
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorChangeDefaultEdge(ElectricTop, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultTopValue()));
|
|
|
|
m_form->monitorChangeDefaultEdge(ElectricRight, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultRightValue()));
|
|
|
|
m_form->monitorChangeDefaultEdge(ElectricBottom, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultBottomValue()));
|
|
|
|
m_form->monitorChangeDefaultEdge(ElectricLeft, KWinScreenEdgesConfig::electricBorderActionFromString(m_settings->defaultLeftValue()));
|
|
|
|
|
|
|
|
// Present Windows BorderActivateAll
|
|
|
|
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateAllValue(), PresentWindowsAll);
|
|
|
|
// PresentWindows BorderActivate
|
|
|
|
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivatePresentWindowsValue(), PresentWindowsCurrent);
|
|
|
|
// PresentWindows BorderActivateClass
|
|
|
|
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateClassValue(), PresentWindowsClass);
|
|
|
|
|
|
|
|
// Desktop Grid BorderActivate
|
|
|
|
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateDesktopGridValue(), DesktopGrid);
|
|
|
|
|
|
|
|
// Desktop Cube BorderActivate
|
|
|
|
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateCubeValue(), Cube);
|
|
|
|
// Desktop Cube BorderActivateCylinder
|
|
|
|
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateCylinderValue(), Cylinder);
|
|
|
|
// Desktop Cube BorderActivateSphere
|
|
|
|
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateSphereValue(), Sphere);
|
|
|
|
|
|
|
|
// TabBox BorderActivate
|
|
|
|
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderActivateTabBoxValue(), TabBox);
|
|
|
|
// Alternative TabBox
|
|
|
|
m_form->monitorChangeDefaultEdge(m_settings->defaultTouchBorderAlternativeActivateValue(), TabBoxAlternative);
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
void KWinScreenEdgesConfig::monitorSaveSettings()
|
2017-04-02 18:56:52 +00:00
|
|
|
{
|
|
|
|
// Save ElectricBorderActions
|
2020-03-05 09:45:46 +00:00
|
|
|
m_settings->setTop(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricTop)));
|
|
|
|
m_settings->setRight(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricRight)));
|
|
|
|
m_settings->setBottom(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricBottom)));
|
|
|
|
m_settings->setLeft(KWinScreenEdgesConfig::electricBorderActionToString(m_form->selectedEdgeItem(ElectricLeft)));
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
// Save effect-specific actions:
|
|
|
|
|
|
|
|
// Present Windows
|
2020-03-05 09:45:46 +00:00
|
|
|
m_settings->setTouchBorderActivateAll(m_form->monitorCheckEffectHasEdge(PresentWindowsAll));
|
|
|
|
m_settings->setTouchBorderActivatePresentWindows(m_form->monitorCheckEffectHasEdge(PresentWindowsCurrent));
|
|
|
|
m_settings->setTouchBorderActivateClass(m_form->monitorCheckEffectHasEdge(PresentWindowsClass));
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
// Desktop Grid
|
2020-03-05 09:45:46 +00:00
|
|
|
m_settings->setTouchBorderActivateDesktopGrid(m_form->monitorCheckEffectHasEdge(DesktopGrid));
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
// Desktop Cube
|
2020-03-05 09:45:46 +00:00
|
|
|
m_settings->setTouchBorderActivateCube(m_form->monitorCheckEffectHasEdge(Cube));
|
|
|
|
m_settings->setTouchBorderActivateCylinder(m_form->monitorCheckEffectHasEdge(Cylinder));
|
|
|
|
m_settings->setTouchBorderActivateSphere(m_form->monitorCheckEffectHasEdge(Sphere));
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
// TabBox
|
2020-03-05 09:45:46 +00:00
|
|
|
m_settings->setTouchBorderActivateTabBox(m_form->monitorCheckEffectHasEdge(TabBox));
|
|
|
|
m_settings->setTouchBorderAlternativeActivate(m_form->monitorCheckEffectHasEdge(TabBoxAlternative));
|
2017-04-02 18:56:52 +00:00
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
// Scripts
|
|
|
|
for (int i = 0; i < m_scripts.size(); i++) {
|
2017-04-02 18:56:52 +00:00
|
|
|
int index = EffectCount + i;
|
2020-03-05 09:45:46 +00:00
|
|
|
m_scriptSettings[m_scripts[i]]->setTouchBorderActivate(m_form->monitorCheckEffectHasEdge(index));
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void KWinScreenEdgesConfig::monitorShowEvent()
|
|
|
|
{
|
|
|
|
// Check if they are enabled
|
|
|
|
KConfigGroup config(m_config, "Plugins");
|
|
|
|
|
|
|
|
// Present Windows
|
|
|
|
bool enabled = effectEnabled(BuiltInEffect::PresentWindows, config);
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorItemSetEnabled(PresentWindowsCurrent, enabled);
|
|
|
|
m_form->monitorItemSetEnabled(PresentWindowsAll, enabled);
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
// Desktop Grid
|
|
|
|
enabled = effectEnabled(BuiltInEffect::DesktopGrid, config);
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorItemSetEnabled(DesktopGrid, enabled);
|
2017-04-02 18:56:52 +00:00
|
|
|
|
|
|
|
// Desktop Cube
|
|
|
|
enabled = effectEnabled(BuiltInEffect::Cube, config);
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorItemSetEnabled(Cube, enabled);
|
|
|
|
m_form->monitorItemSetEnabled(Cylinder, enabled);
|
|
|
|
m_form->monitorItemSetEnabled(Sphere, enabled);
|
2017-04-02 18:56:52 +00:00
|
|
|
// tabbox, depends on reasonable focus policy.
|
|
|
|
KConfigGroup config2(m_config, "Windows");
|
|
|
|
QString focusPolicy = config2.readEntry("FocusPolicy", QString());
|
|
|
|
bool reasonable = focusPolicy != "FocusStrictlyUnderMouse" && focusPolicy != "FocusUnderMouse";
|
2020-03-05 09:45:46 +00:00
|
|
|
m_form->monitorItemSetEnabled(TabBox, reasonable);
|
|
|
|
m_form->monitorItemSetEnabled(TabBoxAlternative, reasonable);
|
KCM KWinTouchEdges disable edge if is immutable
Summary:
Disable touch screen edge modification, but allow the user to open an edge context menu and see the settings.
To set an edge immutable, just add `[$i]` right after the entry in `TouchEdges` group, although the edges settings are shared between some `[Effect-something]` group under the key `TouchBorderActivateSomething`.
Since one entry like `TouchBorderActivateSomething` lists all edges that use this effect, it doesn't make sense to set it immutable.
Test Plan:
In `kwinrc`, set the `TouchEdges` group immutable or any entry.
```
[TouchEdges]
Bottom=None
Left=None
Right=None
Top[$i]=None
```
Reviewers: ervin, bport, meven, zzag, #kwin, mart
Reviewed By: ervin, zzag, #kwin, mart
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D28507
2020-04-02 07:55:59 +00:00
|
|
|
|
|
|
|
// Disable Edge if TouchEdges group entries are immutable
|
|
|
|
m_form->monitorEnableEdge(ElectricTop, !m_settings->isTopImmutable());
|
|
|
|
m_form->monitorEnableEdge(ElectricRight, !m_settings->isRightImmutable());
|
|
|
|
m_form->monitorEnableEdge(ElectricBottom, !m_settings->isBottomImmutable());
|
|
|
|
m_form->monitorEnableEdge(ElectricLeft, !m_settings->isLeftImmutable());
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
ElectricBorderAction KWinScreenEdgesConfig::electricBorderActionFromString(const QString &string)
|
2017-04-02 18:56:52 +00:00
|
|
|
{
|
2020-03-05 09:45:46 +00:00
|
|
|
QString lowerName = string.toLower();
|
|
|
|
if (lowerName == QStringLiteral("showdesktop")) {
|
|
|
|
return ElectricActionShowDesktop;
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
2020-03-05 09:45:46 +00:00
|
|
|
if (lowerName == QStringLiteral("lockscreen")) {
|
|
|
|
return ElectricActionLockScreen;
|
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("krunner")) {
|
|
|
|
return ElectricActionKRunner;
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
2020-03-05 09:45:46 +00:00
|
|
|
if (lowerName == QStringLiteral("activitymanager")) {
|
|
|
|
return ElectricActionActivityManager;
|
|
|
|
}
|
|
|
|
if (lowerName == QStringLiteral("applicationlauncher")) {
|
|
|
|
return ElectricActionApplicationLauncher;
|
|
|
|
}
|
|
|
|
return ElectricActionNone;
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
|
2020-03-05 09:45:46 +00:00
|
|
|
QString KWinScreenEdgesConfig::electricBorderActionToString(int action)
|
2017-04-02 18:56:52 +00:00
|
|
|
{
|
2020-03-05 09:45:46 +00:00
|
|
|
switch (action) {
|
|
|
|
case 1:
|
|
|
|
return QStringLiteral("ShowDesktop");
|
|
|
|
case 2:
|
|
|
|
return QStringLiteral("LockScreen");
|
|
|
|
case 3:
|
|
|
|
return QStringLiteral("KRunner");
|
|
|
|
case 4:
|
|
|
|
return QStringLiteral("ActivityManager");
|
|
|
|
case 5:
|
|
|
|
return QStringLiteral("ApplicationLauncher");
|
|
|
|
default:
|
|
|
|
return QStringLiteral("None");
|
|
|
|
}
|
2017-04-02 18:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#include "touch.moc"
|