pluginapi: allow registering hyprctl commands

closes #4616
This commit is contained in:
Vaxry 2024-02-05 01:56:38 +00:00
parent 939696f97e
commit 60bda7ee3d
7 changed files with 155 additions and 111 deletions

View file

@ -9,28 +9,17 @@ class CHyprCtl {
public:
CHyprCtl();
enum eHyprCtlOutputFormat {
FORMAT_NORMAL = 0,
FORMAT_JSON
};
std::string makeDynamicCall(const std::string& input);
std::shared_ptr<SHyprCtlCommand> registerCommand(SHyprCtlCommand cmd);
void unregisterCommand(const std::shared_ptr<SHyprCtlCommand>& cmd);
std::string getReply(std::string);
struct SCommand {
std::string name = "";
bool exact = true;
std::function<std::string(eHyprCtlOutputFormat, std::string)> fn;
};
std::string makeDynamicCall(const std::string& input);
std::shared_ptr<SCommand> registerCommand(SCommand cmd);
void unregisterCommand(const std::shared_ptr<SCommand>& cmd);
std::string getReply(std::string);
int m_iSocketFD = -1;
int m_iSocketFD = -1;
private:
void startHyprCtlSocket();
void startHyprCtlSocket();
std::vector<std::shared_ptr<SCommand>> m_vCommands;
std::vector<std::shared_ptr<SHyprCtlCommand>> m_vCommands;
};
inline std::unique_ptr<CHyprCtl> g_pHyprCtl;