2023-02-27 13:32:38 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../defines.hpp"
|
|
|
|
#include "PluginAPI.hpp"
|
|
|
|
#include <csetjmp>
|
|
|
|
|
|
|
|
class IHyprWindowDecoration;
|
|
|
|
|
|
|
|
class CPlugin {
|
|
|
|
public:
|
|
|
|
std::string name = "";
|
|
|
|
std::string description = "";
|
|
|
|
std::string author = "";
|
|
|
|
std::string version = "";
|
|
|
|
|
|
|
|
std::string path = "";
|
|
|
|
|
2023-05-01 16:10:53 +02:00
|
|
|
bool m_bLoadedWithConfig = false;
|
|
|
|
|
2023-02-27 13:32:38 +01:00
|
|
|
HANDLE m_pHandle = nullptr;
|
|
|
|
|
|
|
|
std::vector<IHyprLayout*> registeredLayouts;
|
|
|
|
std::vector<IHyprWindowDecoration*> registeredDecorations;
|
|
|
|
std::vector<std::pair<std::string, HOOK_CALLBACK_FN*>> registeredCallbacks;
|
|
|
|
std::vector<std::string> registeredDispatchers;
|
2024-02-05 02:56:38 +01:00
|
|
|
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;
|