hyprctl: Add Config Flag to hyprctl systeminfo (#6160)

This commit is contained in:
Gabriel Ford 2024-05-25 20:46:07 +00:00 committed by GitHub
parent addd3e7f1a
commit 553232a3e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 4 deletions

View file

@ -23,6 +23,7 @@
#include "../devices/IKeyboard.hpp"
#include "../devices/ITouch.hpp"
#include "../devices/Tablet.hpp"
#include "config/ConfigManager.hpp"
static void trimTrailingComma(std::string& str) {
if (!str.empty() && str.back() == ',')
@ -897,6 +898,12 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
result += std::format(" {} by {} ver {}\n", pl->name, pl->author, pl->version);
}
if (g_pHyprCtl->m_sCurrentRequestParams.sysInfoConfig) {
result += "\n======Config-Start======\n";
result += g_pConfigManager->getConfigString();
result += "\n======Config-End========\n";
}
return result;
}
@ -1640,6 +1647,8 @@ std::string CHyprCtl::getReply(std::string request) {
reloadAll = true;
else if (c == 'a')
m_sCurrentRequestParams.all = true;
else if (c == 'c')
m_sCurrentRequestParams.sysInfoConfig = true;
}
if (sepIndex < request.size())

View file

@ -17,7 +17,8 @@ class CHyprCtl {
int m_iSocketFD = -1;
struct {
bool all = false;
bool all = false;
bool sysInfoConfig = false;
} m_sCurrentRequestParams;
private:
@ -26,4 +27,4 @@ class CHyprCtl {
std::vector<SP<SHyprCtlCommand>> m_vCommands;
};
inline std::unique_ptr<CHyprCtl> g_pHyprCtl;
inline std::unique_ptr<CHyprCtl> g_pHyprCtl;