mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 04:45:57 +01:00
Merge branch 'main' into bind-longPress
This commit is contained in:
commit
2b5d0e521b
3 changed files with 22 additions and 5 deletions
|
@ -30,7 +30,7 @@ using namespace Hyprutils::OS;
|
||||||
static std::string execAndGet(std::string cmd) {
|
static std::string execAndGet(std::string cmd) {
|
||||||
cmd += " 2>&1";
|
cmd += " 2>&1";
|
||||||
|
|
||||||
CProcess proc("/bin/sh", {cmd});
|
CProcess proc("/bin/sh", {"-c", cmd});
|
||||||
|
|
||||||
if (!proc.runSync())
|
if (!proc.runSync())
|
||||||
return "error";
|
return "error";
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "HyprCtl.hpp"
|
#include "HyprCtl.hpp"
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
|
#include <fstream>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -950,11 +951,27 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
|
||||||
const std::string GPUINFO = execAndGet("lspci -vnn | grep VGA");
|
const std::string GPUINFO = execAndGet("lspci -vnn | grep VGA");
|
||||||
#endif
|
#endif
|
||||||
result += "GPU information: \n" + GPUINFO;
|
result += "GPU information: \n" + GPUINFO;
|
||||||
if (GPUINFO.contains("NVIDIA") && std::filesystem::exists("/proc/driver/nvidia/version"))
|
if (GPUINFO.contains("NVIDIA") && std::filesystem::exists("/proc/driver/nvidia/version")) {
|
||||||
result += execAndGet("cat /proc/driver/nvidia/version | grep NVRM");
|
std::ifstream file("/proc/driver/nvidia/version");
|
||||||
|
std::string line;
|
||||||
|
if (file.is_open()) {
|
||||||
|
while (std::getline(file, line)) {
|
||||||
|
if (!line.contains("NVRM"))
|
||||||
|
continue;
|
||||||
|
result += line;
|
||||||
|
result += "\n";
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
result += "error";
|
||||||
|
}
|
||||||
result += "\n\n";
|
result += "\n\n";
|
||||||
|
|
||||||
result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n";
|
if (std::ifstream file("/etc/os-release"); file.is_open()) {
|
||||||
|
std::stringstream buffer;
|
||||||
|
buffer << file.rdbuf();
|
||||||
|
result += "os-release: " + buffer.str() + "\n\n";
|
||||||
|
} else
|
||||||
|
result += "os-release: error\n\n";
|
||||||
|
|
||||||
result += "plugins:\n";
|
result += "plugins:\n";
|
||||||
if (g_pPluginSystem) {
|
if (g_pPluginSystem) {
|
||||||
|
|
|
@ -585,7 +585,7 @@ float vecToRectDistanceSquared(const Vector2D& vec, const Vector2D& p1, const Ve
|
||||||
|
|
||||||
// Execute a shell command and get the output
|
// Execute a shell command and get the output
|
||||||
std::string execAndGet(const char* cmd) {
|
std::string execAndGet(const char* cmd) {
|
||||||
CProcess proc("/bin/sh", {cmd});
|
CProcess proc("/bin/sh", {"-c", cmd});
|
||||||
|
|
||||||
if (!proc.runSync())
|
if (!proc.runSync())
|
||||||
return "error";
|
return "error";
|
||||||
|
|
Loading…
Reference in a new issue