Verified Commit fa2241e2 authored by Fushan Wen's avatar Fushan Wen
Browse files

shell: Follow `ActivateWhenTypingOnDesktop` from KRunner

When the option is unchecked, typing on the desktop will not activate
KRunner.

FEATURE: 318538
FIXED-IN: 5.25
parent 078a1c99
Pipeline #151193 passed with stage
in 8 minutes and 23 seconds
......@@ -80,6 +80,7 @@ target_link_libraries(plasmashell
Qt::DBus
KF5::KIOCore
KF5::WindowSystem
KF5::ConfigCore # Activate KRunner on the desktop
KF5::Crash
KF5::Plasma
KF5::PlasmaQuick
......
......@@ -62,6 +62,18 @@ DesktopView::DesktopView(Plasma::Corona *corona, QScreen *targetScreen)
QObject::connect(m_activityController, &KActivities::Controller::activityAdded, this, &DesktopView::candidateContainmentsChanged);
QObject::connect(m_activityController, &KActivities::Controller::activityRemoved, this, &DesktopView::candidateContainmentsChanged);
// KRunner settings
KSharedConfig::Ptr config = KSharedConfig::openConfig(QStringLiteral("krunnerrc"));
KConfigGroup configGroup(config, "General");
m_activateKRunnerWhenTypingOnDesktop = configGroup.readEntry("ActivateWhenTypingOnDesktop", true);
m_configWatcher = KConfigWatcher::create(config);
connect(m_configWatcher.data(), &KConfigWatcher::configChanged, this, [this](const KConfigGroup &group, const QByteArrayList &names) {
if (names.contains(QByteArray("ActivateWhenTypingOnDesktop"))) {
m_activateKRunnerWhenTypingOnDesktop = group.readEntry("ActivateWhenTypingOnDesktop", true);
}
});
}
DesktopView::~DesktopView()
......@@ -267,6 +279,10 @@ void DesktopView::keyPressEvent(QKeyEvent *e)
return;
}
if (!m_activateKRunnerWhenTypingOnDesktop) {
return;
}
// When a key is pressed on desktop when nothing else is active forward the key to krunner
if (handleKRunnerTextInput(e)) {
e->accept();
......
......@@ -10,6 +10,8 @@
#include <PlasmaQuick/ContainmentView>
#include <QPointer>
#include <KConfigWatcher>
namespace KWayland
{
namespace Client
......@@ -96,4 +98,8 @@ private:
WindowType m_windowType;
KWayland::Client::PlasmaShellSurface *m_shellSurface;
QString m_krunnerText;
// KRunner config
KConfigWatcher::Ptr m_configWatcher;
bool m_activateKRunnerWhenTypingOnDesktop;
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment