2022-03-20 16:51:14 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <fstream>
|
2022-04-04 19:44:25 +02:00
|
|
|
#include "../helpers/MiscFunctions.hpp"
|
2025-01-17 15:21:35 +00:00
|
|
|
#include "../desktop/Window.hpp"
|
2024-02-05 01:43:45 +00:00
|
|
|
#include <functional>
|
2022-03-20 16:51:14 +01:00
|
|
|
|
2024-09-25 10:36:43 +01:00
|
|
|
// exposed for main.cpp
|
|
|
|
|
std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request);
|
2024-10-11 13:19:16 +02:00
|
|
|
std::string versionRequest(eHyprCtlOutputFormat format, std::string request);
|
2024-09-25 10:36:43 +01:00
|
|
|
|
2024-02-05 01:43:45 +00:00
|
|
|
class CHyprCtl {
|
|
|
|
|
public:
|
|
|
|
|
CHyprCtl();
|
2024-06-02 18:42:54 +02:00
|
|
|
~CHyprCtl();
|
2022-08-28 11:19:08 +02:00
|
|
|
|
2024-05-05 17:16:00 +01:00
|
|
|
std::string makeDynamicCall(const std::string& input);
|
|
|
|
|
SP<SHyprCtlCommand> registerCommand(SHyprCtlCommand cmd);
|
|
|
|
|
void unregisterCommand(const SP<SHyprCtlCommand>& cmd);
|
|
|
|
|
std::string getReply(std::string);
|
2024-02-05 01:43:45 +00:00
|
|
|
|
2024-05-05 17:16:00 +01:00
|
|
|
int m_iSocketFD = -1;
|
2024-02-05 01:43:45 +00:00
|
|
|
|
2024-03-08 17:47:12 +00:00
|
|
|
struct {
|
2024-05-25 20:46:07 +00:00
|
|
|
bool all = false;
|
|
|
|
|
bool sysInfoConfig = false;
|
2024-03-08 17:47:12 +00:00
|
|
|
} m_sCurrentRequestParams;
|
|
|
|
|
|
2024-07-07 17:52:56 +02:00
|
|
|
static std::string getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format);
|
|
|
|
|
static std::string getWorkspaceData(PHLWORKSPACE w, eHyprCtlOutputFormat format);
|
|
|
|
|
static std::string getMonitorData(Hyprutils::Memory::CSharedPointer<CMonitor> m, eHyprCtlOutputFormat format);
|
|
|
|
|
|
2024-02-05 01:43:45 +00:00
|
|
|
private:
|
2024-05-05 17:16:00 +01:00
|
|
|
void startHyprCtlSocket();
|
2024-02-05 01:43:45 +00:00
|
|
|
|
2024-05-05 17:16:00 +01:00
|
|
|
std::vector<SP<SHyprCtlCommand>> m_vCommands;
|
2024-06-02 18:42:54 +02:00
|
|
|
wl_event_source* m_eventSource = nullptr;
|
2024-07-31 21:00:14 +02:00
|
|
|
std::string m_socketPath;
|
2024-02-05 01:43:45 +00:00
|
|
|
};
|
|
|
|
|
|
2025-01-23 21:55:41 +01:00
|
|
|
inline UP<CHyprCtl> g_pHyprCtl;
|