2023-12-07 11:41:09 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
enum eHeadersErrors {
|
|
|
|
HEADERS_OK = 0,
|
|
|
|
HEADERS_NOT_HYPRLAND,
|
|
|
|
HEADERS_MISSING,
|
|
|
|
HEADERS_CORRUPTED,
|
|
|
|
HEADERS_MISMATCHED,
|
2023-12-13 03:32:57 +01:00
|
|
|
HEADERS_DUPLICATED
|
2023-12-07 11:41:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
enum eNotifyIcons {
|
|
|
|
ICON_WARNING = 0,
|
|
|
|
ICON_INFO,
|
|
|
|
ICON_HINT,
|
|
|
|
ICON_ERROR,
|
|
|
|
ICON_CONFUSED,
|
|
|
|
ICON_OK,
|
|
|
|
ICON_NONE
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ePluginLoadStateReturn {
|
|
|
|
LOADSTATE_OK = 0,
|
|
|
|
LOADSTATE_FAIL,
|
|
|
|
LOADSTATE_PARTIAL_FAIL,
|
|
|
|
LOADSTATE_HEADERS_OUTDATED
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SHyprlandVersion {
|
|
|
|
std::string branch;
|
|
|
|
std::string hash;
|
2024-04-10 18:33:50 +02:00
|
|
|
std::string date;
|
2024-04-05 01:44:21 +02:00
|
|
|
int commits = 0;
|
2023-12-07 11:41:09 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class CPluginManager {
|
|
|
|
public:
|
2024-03-06 13:01:04 +01:00
|
|
|
bool addNewPluginRepo(const std::string& url, const std::string& rev);
|
2023-12-07 11:41:09 +01:00
|
|
|
bool removePluginRepo(const std::string& urlOrName);
|
|
|
|
|
|
|
|
eHeadersErrors headersValid();
|
2024-01-28 03:04:35 +01:00
|
|
|
bool updateHeaders(bool force = false);
|
2023-12-07 11:41:09 +01:00
|
|
|
bool updatePlugins(bool forceUpdateAll);
|
|
|
|
|
|
|
|
void listAllPlugins();
|
|
|
|
|
|
|
|
bool enablePlugin(const std::string& name);
|
|
|
|
bool disablePlugin(const std::string& name);
|
|
|
|
ePluginLoadStateReturn ensurePluginsLoadState();
|
|
|
|
|
|
|
|
bool loadUnloadPlugin(const std::string& path, bool load);
|
|
|
|
SHyprlandVersion getHyprlandVersion();
|
|
|
|
|
|
|
|
void notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message);
|
|
|
|
|
|
|
|
bool m_bVerbose = false;
|
2023-12-13 03:32:57 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
std::string headerError(const eHeadersErrors err);
|
2023-12-07 11:41:09 +01:00
|
|
|
};
|
|
|
|
|
2024-03-06 13:01:04 +01:00
|
|
|
inline std::unique_ptr<CPluginManager> g_pPluginManager;
|