Commit 8f6edea5 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Turn krunner integration into a plugin

krunner stuff doesn't really belong in kwin, it has nothing to do with
compositing or any other things that are the domain of compositors.
Given that, being as a plugin suits the krunner integration stuff best.
parent 459aa66d
......@@ -607,12 +607,6 @@ if (KWIN_BUILD_ACTIVITIES)
)
endif()
if (KWIN_BUILD_RUNNERS)
set(kwin_SRCS ${kwin_SRCS}
runners/windowsrunnerinterface.cpp
)
endif()
if (HAVE_LINUX_VT_H)
set(kwin_SRCS ${kwin_SRCS}
virtual_terminal.cpp
......@@ -643,9 +637,6 @@ qt5_add_dbus_adaptor(kwin_SRCS ${kwin_effects_dbus_xml} effects.h KWin::EffectsH
qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.VirtualDesktopManager.xml dbusinterface.h KWin::VirtualDesktopManagerDBusInterface)
qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.Session.xml sm.h KWin::SessionManager)
qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.Plugins.xml dbusinterface.h KWin::PluginManagerDBusInterface)
if (KWIN_BUILD_RUNNERS)
qt5_add_dbus_adaptor(kwin_SRCS "runners/org.kde.krunner1.xml" runners/windowsrunnerinterface.h KWin::WindowsRunner)
endif()
qt5_add_dbus_interface(kwin_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface)
qt5_add_dbus_interface(kwin_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_interface)
......@@ -722,10 +713,6 @@ if (KWIN_BUILD_ACTIVITIES)
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities)
endif()
if (KWIN_BUILD_RUNNERS)
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Runner)
endif()
set(kwinLibs
${kwin_OWN_LIBS}
${kwin_QT_LIBS}
......@@ -847,11 +834,6 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kwin_export.h DESTINATION ${INCLUDE_IN
# Install the KWin/Script service type
install(FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
# install KWin krunner runner
if (KWIN_BUILD_RUNNERS)
install(FILES runners/kwin-runner-windows.desktop DESTINATION ${KDE_INSTALL_DATAROOTDIR}/krunner/dbusplugins)
endif()
add_subdirectory(qml)
if (BUILD_TESTING)
......
......@@ -15,3 +15,6 @@ endif()
if (lcms2_FOUND)
add_subdirectory(colord-integration)
endif()
if (KWIN_BUILD_RUNNERS)
add_subdirectory(krunner-integration)
endif()
set(krunnerintegration_SOURCES
main.cpp
windowsrunnerinterface.cpp
)
qt5_add_dbus_adaptor(krunnerintegration_SOURCES org.kde.krunner1.xml windowsrunnerinterface.h KWin::WindowsRunner)
add_library(krunnerintegration MODULE ${krunnerintegration_SOURCES})
target_link_libraries(krunnerintegration kwin KF5::Runner)
install(TARGETS krunnerintegration DESTINATION ${PLUGIN_INSTALL_DIR}/kwin/plugins/)
install(FILES kwin-runner-windows.desktop DESTINATION ${KDE_INSTALL_DATAROOTDIR}/krunner/dbusplugins)
/*
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "windowsrunnerinterface.h"
#include "main.h"
#include <KPluginFactory>
using namespace KWin;
class KWIN_EXPORT KRunnerIntegrationFactory : public PluginFactory
{
Q_OBJECT
Q_PLUGIN_METADATA(IID PluginFactory_iid FILE "metadata.json")
Q_INTERFACES(KWin::PluginFactory)
public:
explicit KRunnerIntegrationFactory(QObject *parent = nullptr);
Plugin *create() const override;
};
KRunnerIntegrationFactory::KRunnerIntegrationFactory(QObject *parent)
: PluginFactory(parent)
{
}
Plugin *KRunnerIntegrationFactory::create() const
{
return new WindowsRunner();
}
K_EXPORT_PLUGIN_VERSION(KWIN_PLUGIN_API_VERSION)
#include "main.moc"
{
"KPlugin": {
"EnabledByDefault": true,
"Id": "kwin5_plugin_krunner"
}
}
......@@ -20,7 +20,20 @@
namespace KWin
{
WindowsRunner::WindowsRunner(QObject *parent)
: QObject(parent)
: Plugin(parent)
{
if (workspace()) {
initialize();
} else {
connect(kwinApp(), &Application::workspaceCreated, this, &WindowsRunner::initialize);
}
}
WindowsRunner::~WindowsRunner()
{
}
void WindowsRunner::initialize()
{
new Krunner1Adaptor(this);
qDBusRegisterMetaType<RemoteMatch>();
......@@ -31,10 +44,6 @@ WindowsRunner::WindowsRunner(QObject *parent)
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin"));
}
WindowsRunner::~WindowsRunner()
{
}
RemoteActions WindowsRunner::Actions()
{
RemoteActions actions;
......
......@@ -13,21 +13,23 @@
#pragma once
#include "plugin.h"
#include "dbusutils_p.h"
#include <KRunner/QueryMatch>
#include <QObject>
#include <QDBusContext>
#include <QDBusMessage>
#include <QString>
#include <QDBusArgument>
#include <KRunner/QueryMatch>
#include "dbusutils_p.h"
namespace KWin
{
class VirtualDesktop;
class AbstractClient;
class WindowsRunner : public QObject, protected QDBusContext
class WindowsRunner : public Plugin, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.WindowsRunner")
......@@ -54,6 +56,7 @@ private:
ActivateDesktopAction
};
void initialize();
RemoteMatch desktopMatch(const VirtualDesktop *desktop, const WindowsRunnerAction action = ActivateDesktopAction, qreal relevance = 1.0) const;
RemoteMatch windowsMatch(const AbstractClient *client, const WindowsRunnerAction action = ActivateAction, qreal relevance = 1.0, Plasma::QueryMatch::Type type = Plasma::QueryMatch::ExactMatch) const;
bool actionSupported(const AbstractClient *client, const WindowsRunnerAction action) const;
......
......@@ -60,10 +60,6 @@
// Qt
#include <QtConcurrentRun>
#ifdef KF5Runner_FOUND
#include <runners/windowsrunnerinterface.h>
#endif
namespace KWin
{
......@@ -201,9 +197,6 @@ Workspace::Workspace()
});
new DBusInterface(this);
#ifdef KF5Runner_FOUND
new WindowsRunner(this);
#endif
Outline::create(this);
initShortcuts();
......
Markdown is supported
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