2023-02-27 13:32:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
|
|
|
#include "PluginAPI.hpp"
|
|
|
|
#include <csetjmp>
|
|
|
|
|
|
|
|
class IHyprWindowDecoration;
|
|
|
|
|
|
|
|
class CPlugin {
|
|
|
|
public:
|
2024-04-22 16:50:01 +02:00
|
|
|
std::string name = "";
|
|
|
|
std::string description = "";
|
|
|
|
std::string author = "";
|
|
|
|
std::string version = "";
|
2023-02-27 13:32:38 +01:00
|
|
|
|
2024-04-22 16:50:01 +02:00
|
|
|
std::string path = "";
|
2023-02-27 13:32:38 +01:00
|
|
|
|
2024-04-22 16:50:01 +02:00
|
|
|
bool m_bLoadedWithConfig = false;
|
2023-05-01 16:10:53 +02:00
|
|
|
|
2024-04-22 16:50:01 +02:00
|
|
|
HANDLE m_pHandle = nullptr;
|
2023-02-27 13:32:38 +01:00
|
|
|
|
2024-04-22 16:50:01 +02:00
|
|
|
std::vector<IHyprLayout*> registeredLayouts;
|
|
|
|
std::vector<IHyprWindowDecoration*> registeredDecorations;
|
|
|
|
std::vector<std::pair<std::string, std::weak_ptr<HOOK_CALLBACK_FN>>> registeredCallbacks;
|
|
|
|
std::vector<std::string> registeredDispatchers;
|
|
|
|
std::vector<std::shared_ptr<SHyprCtlCommand>> registeredHyprctlCommands;
|
2023-02-27 13:32:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class CPluginSystem {
|
|
|
|
public:
|
|
|
|
CPluginSystem();
|
|
|
|
|
2023-05-01 16:10:53 +02:00
|
|
|
CPlugin* loadPlugin(const std::string& path);
|
|
|
|
void unloadPlugin(const CPlugin* plugin, bool eject = false);
|
|
|
|
void unloadAllPlugins();
|
|
|
|
std::vector<std::string> updateConfigPlugins(const std::vector<std::string>& plugins, bool& changed);
|
|
|
|
CPlugin* getPluginByPath(const std::string& path);
|
|
|
|
CPlugin* getPluginByHandle(HANDLE handle);
|
|
|
|
std::vector<CPlugin*> getAllPlugins();
|
2023-02-27 13:32:38 +01:00
|
|
|
|
2023-05-01 16:10:53 +02:00
|
|
|
bool m_bAllowConfigVars = false;
|
2023-11-17 23:22:31 +01:00
|
|
|
std::string m_szLastError = "";
|
2023-02-27 13:32:38 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::vector<std::unique_ptr<CPlugin>> m_vLoadedPlugins;
|
|
|
|
|
|
|
|
jmp_buf m_jbPluginFaultJumpBuf;
|
|
|
|
};
|
|
|
|
|
2023-03-01 00:11:49 +01:00
|
|
|
inline std::unique_ptr<CPluginSystem> g_pPluginSystem;
|