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.
This commit is contained in:
parent
459aa66d8e
commit
8f6edea521
11 changed files with 80 additions and 34 deletions
|
@ -607,12 +607,6 @@ if (KWIN_BUILD_ACTIVITIES)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (KWIN_BUILD_RUNNERS)
|
|
||||||
set(kwin_SRCS ${kwin_SRCS}
|
|
||||||
runners/windowsrunnerinterface.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (HAVE_LINUX_VT_H)
|
if (HAVE_LINUX_VT_H)
|
||||||
set(kwin_SRCS ${kwin_SRCS}
|
set(kwin_SRCS ${kwin_SRCS}
|
||||||
virtual_terminal.cpp
|
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.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.Session.xml sm.h KWin::SessionManager)
|
||||||
qt5_add_dbus_adaptor(kwin_SRCS org.kde.KWin.Plugins.xml dbusinterface.h KWin::PluginManagerDBusInterface)
|
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}/kf5_org.freedesktop.ScreenSaver.xml screenlocker_interface)
|
||||||
qt5_add_dbus_interface(kwin_SRCS ${KSCREENLOCKER_DBUS_INTERFACES_DIR}/org.kde.screensaver.xml kscreenlocker_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)
|
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Activities)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (KWIN_BUILD_RUNNERS)
|
|
||||||
set(kwin_KDE_LIBS ${kwin_KDE_LIBS} KF5::Runner)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(kwinLibs
|
set(kwinLibs
|
||||||
${kwin_OWN_LIBS}
|
${kwin_OWN_LIBS}
|
||||||
${kwin_QT_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 the KWin/Script service type
|
||||||
install(FILES scripting/kwinscript.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
|
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)
|
add_subdirectory(qml)
|
||||||
|
|
||||||
if (BUILD_TESTING)
|
if (BUILD_TESTING)
|
||||||
|
|
|
@ -15,3 +15,6 @@ endif()
|
||||||
if (lcms2_FOUND)
|
if (lcms2_FOUND)
|
||||||
add_subdirectory(colord-integration)
|
add_subdirectory(colord-integration)
|
||||||
endif()
|
endif()
|
||||||
|
if (KWIN_BUILD_RUNNERS)
|
||||||
|
add_subdirectory(krunner-integration)
|
||||||
|
endif()
|
||||||
|
|
12
plugins/krunner-integration/CMakeLists.txt
Normal file
12
plugins/krunner-integration/CMakeLists.txt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
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)
|
38
plugins/krunner-integration/main.cpp
Normal file
38
plugins/krunner-integration/main.cpp
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/*
|
||||||
|
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"
|
6
plugins/krunner-integration/metadata.json
Normal file
6
plugins/krunner-integration/metadata.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"KPlugin": {
|
||||||
|
"EnabledByDefault": true,
|
||||||
|
"Id": "kwin5_plugin_krunner"
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,7 +20,20 @@
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
WindowsRunner::WindowsRunner(QObject *parent)
|
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);
|
new Krunner1Adaptor(this);
|
||||||
qDBusRegisterMetaType<RemoteMatch>();
|
qDBusRegisterMetaType<RemoteMatch>();
|
||||||
|
@ -31,10 +44,6 @@ WindowsRunner::WindowsRunner(QObject *parent)
|
||||||
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin"));
|
QDBusConnection::sessionBus().registerService(QStringLiteral("org.kde.KWin"));
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowsRunner::~WindowsRunner()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoteActions WindowsRunner::Actions()
|
RemoteActions WindowsRunner::Actions()
|
||||||
{
|
{
|
||||||
RemoteActions actions;
|
RemoteActions actions;
|
|
@ -13,21 +13,23 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "plugin.h"
|
||||||
|
#include "dbusutils_p.h"
|
||||||
|
|
||||||
|
#include <KRunner/QueryMatch>
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QDBusContext>
|
#include <QDBusContext>
|
||||||
#include <QDBusMessage>
|
#include <QDBusMessage>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDBusArgument>
|
#include <QDBusArgument>
|
||||||
|
|
||||||
#include <KRunner/QueryMatch>
|
|
||||||
#include "dbusutils_p.h"
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
class VirtualDesktop;
|
class VirtualDesktop;
|
||||||
class AbstractClient;
|
class AbstractClient;
|
||||||
|
|
||||||
class WindowsRunner : public QObject, protected QDBusContext
|
class WindowsRunner : public Plugin, protected QDBusContext
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.WindowsRunner")
|
Q_CLASSINFO("D-Bus Interface", "org.kde.KWin.WindowsRunner")
|
||||||
|
@ -54,6 +56,7 @@ private:
|
||||||
ActivateDesktopAction
|
ActivateDesktopAction
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void initialize();
|
||||||
RemoteMatch desktopMatch(const VirtualDesktop *desktop, const WindowsRunnerAction action = ActivateDesktopAction, qreal relevance = 1.0) const;
|
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;
|
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;
|
bool actionSupported(const AbstractClient *client, const WindowsRunnerAction action) const;
|
|
@ -60,10 +60,6 @@
|
||||||
// Qt
|
// Qt
|
||||||
#include <QtConcurrentRun>
|
#include <QtConcurrentRun>
|
||||||
|
|
||||||
#ifdef KF5Runner_FOUND
|
|
||||||
#include <runners/windowsrunnerinterface.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -201,9 +197,6 @@ Workspace::Workspace()
|
||||||
});
|
});
|
||||||
|
|
||||||
new DBusInterface(this);
|
new DBusInterface(this);
|
||||||
#ifdef KF5Runner_FOUND
|
|
||||||
new WindowsRunner(this);
|
|
||||||
#endif
|
|
||||||
Outline::create(this);
|
Outline::create(this);
|
||||||
|
|
||||||
initShortcuts();
|
initShortcuts();
|
||||||
|
|
Loading…
Reference in a new issue