mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 14:09:48 +01:00
hyprctl: Add Config Flag to hyprctl systeminfo
(#6160)
This commit is contained in:
parent
addd3e7f1a
commit
553232a3e4
6 changed files with 40 additions and 4 deletions
8
.github/ISSUE_TEMPLATE/bug.yml
vendored
8
.github/ISSUE_TEMPLATE/bug.yml
vendored
|
@ -12,8 +12,12 @@ body:
|
|||
- type: textarea
|
||||
id: ver
|
||||
attributes:
|
||||
label: Hyprland Version
|
||||
description: "Paste the output of `hyprctl systeminfo` here."
|
||||
label: System Info and Version
|
||||
description: |
|
||||
Paste the output of `hyprctl systeminfo -c` here (If you are on a
|
||||
version that shows you help menu, omit the `-c` and attach config files
|
||||
to the issue). If you have configs outside of the main config shown
|
||||
here, please attach.
|
||||
value: "<details>
|
||||
<summary>System/Version info</summary>
|
||||
|
||||
|
|
|
@ -297,6 +297,8 @@ int main(int argc, char** argv) {
|
|||
fullArgs += "r";
|
||||
} else if (ARGS[i] == "-a" && !fullArgs.contains("a")) {
|
||||
fullArgs += "a";
|
||||
} else if ((ARGS[i] == "-c" || ARGS[i] == "--config") && !fullArgs.contains("c")) {
|
||||
fullArgs += "c";
|
||||
} else if (ARGS[i] == "--batch") {
|
||||
fullRequest = "--batch ";
|
||||
} else if (ARGS[i] == "--instance" || ARGS[i] == "-i") {
|
||||
|
|
|
@ -633,6 +633,25 @@ std::string CConfigManager::getMainConfigPath() {
|
|||
return getConfigDir() + "/hypr/" + (ISDEBUG ? "hyprlandd.conf" : "hyprland.conf");
|
||||
}
|
||||
|
||||
const std::string CConfigManager::getConfigString() {
|
||||
std::string configString;
|
||||
std::string currFileContent;
|
||||
|
||||
for (auto path : configPaths) {
|
||||
std::ifstream configFile(path);
|
||||
configString += ("\n\nConfig File: " + path + ": ");
|
||||
if (!configFile.is_open()) {
|
||||
Debug::log(LOG, "Config file not readable/found!");
|
||||
configString += "Read Failed\n";
|
||||
continue;
|
||||
}
|
||||
configString += "Read Succeeded\n";
|
||||
currFileContent.assign(std::istreambuf_iterator<char>(configFile), std::istreambuf_iterator<char>());
|
||||
configString.append(currFileContent);
|
||||
}
|
||||
return configString;
|
||||
}
|
||||
|
||||
std::string CConfigManager::getErrors() {
|
||||
return m_szConfigErrors;
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ class CConfigManager {
|
|||
void onPluginLoadUnload(const std::string& name, bool load);
|
||||
static std::string getConfigDir();
|
||||
static std::string getMainConfigPath();
|
||||
const std::string getConfigString();
|
||||
|
||||
SMonitorRule getMonitorRuleFor(const CMonitor&);
|
||||
SWorkspaceRule getWorkspaceRuleFor(PHLWORKSPACE workspace);
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue