feat: basic plugin system

The wayland plugin now uses it.
This commit is contained in:
outfoxxed 2024-02-25 23:47:17 -08:00
parent 6c6272e523
commit 3bd587cfcc
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
8 changed files with 94 additions and 4 deletions

View file

@ -5,6 +5,11 @@ qt_add_library(quickshell-wayland STATIC
waylandlayershell.cpp
)
# required to make sure the constructor is linked
add_library(quickshell-wayland-init OBJECT init.cpp)
target_link_libraries(quickshell PRIVATE ${QT_DEPS} quickshell-waylandplugin quickshell-wayland-init)
qt_add_qml_module(quickshell-wayland URI QuickShell.Wayland)
find_package(PkgConfig REQUIRED)
@ -13,6 +18,7 @@ pkg_check_modules(wayland REQUIRED IMPORTED_TARGET wayland-client wayland-protoc
find_package(Qt6 REQUIRED COMPONENTS WaylandClient)
target_link_libraries(quickshell-wayland PRIVATE ${QT_DEPS} wayland-client)
target_link_libraries(quickshell-wayland-init PRIVATE ${QT_DEPS} wayland-client)
# wayland protocols

19
src/wayland/init.cpp Normal file
View file

@ -0,0 +1,19 @@
#include <qguiapplication.h>
#include <qqml.h>
#include "../core/plugin.hpp"
#include "waylandlayershell.hpp"
namespace {
class WaylandPlugin: public QuickshellPlugin {
bool applies() override { return QGuiApplication::platformName() == "wayland"; }
void registerTypes() override {
qmlRegisterType<WaylandPanelInterface>("QuickShell", 1, 0, "PanelWindow");
}
};
QS_REGISTER_PLUGIN(WaylandPlugin);
} // namespace

View file

@ -87,7 +87,6 @@ private:
class WaylandPanelInterface: public PanelWindowInterface {
Q_OBJECT;
QML_NAMED_ELEMENT(PanelWindow); // temp
public:
explicit WaylandPanelInterface(QObject* parent = nullptr);