mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 02:45:58 +01:00
core: move to os/Process from hyprutils
nix bump too
This commit is contained in:
parent
dca75db127
commit
a8ff3a452c
5 changed files with 21 additions and 28 deletions
|
@ -101,7 +101,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
find_package(OpenGL REQUIRED COMPONENTS ${GLES_VERSION})
|
find_package(OpenGL REQUIRED COMPONENTS ${GLES_VERSION})
|
||||||
|
|
||||||
pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.1)
|
pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.4)
|
||||||
|
|
||||||
pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine>=0.4.2)
|
pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine>=0.4.2)
|
||||||
|
|
||||||
|
|
|
@ -151,11 +151,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1730968903,
|
"lastModified": 1731163338,
|
||||||
"narHash": "sha256-zFvzLXcSm0Ia4XI1SE4FQ9KE63hlGrRWhLtwMolWuR8=",
|
"narHash": "sha256-Qflei0JBeqQ0c8jxA8e982xAxJvfMwfx4Aci2eJi84s=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprutils",
|
"repo": "hyprutils",
|
||||||
"rev": "3ce0cde8709cdacbfba471f8e828433b58a561e9",
|
"rev": "60d3dece30f98e8ad85131829c8529950630d6bc",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -9,7 +9,7 @@ file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
|
||||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET tomlplusplus hyprutils>=0.1.1)
|
pkg_check_modules(deps REQUIRED IMPORTED_TARGET tomlplusplus hyprutils>=0.2.4)
|
||||||
|
|
||||||
add_executable(hyprpm ${SRCFILES})
|
add_executable(hyprpm ${SRCFILES})
|
||||||
|
|
||||||
|
|
|
@ -23,22 +23,19 @@
|
||||||
#include <toml++/toml.hpp>
|
#include <toml++/toml.hpp>
|
||||||
|
|
||||||
#include <hyprutils/string/String.hpp>
|
#include <hyprutils/string/String.hpp>
|
||||||
|
#include <hyprutils/os/Process.hpp>
|
||||||
using namespace Hyprutils::String;
|
using namespace Hyprutils::String;
|
||||||
|
using namespace Hyprutils::OS;
|
||||||
|
|
||||||
static std::string execAndGet(std::string cmd) {
|
static std::string execAndGet(std::string cmd) {
|
||||||
cmd += " 2>&1";
|
cmd += " 2>&1";
|
||||||
std::array<char, 128> buffer;
|
|
||||||
std::string result;
|
|
||||||
using PcloseType = int (*)(FILE*);
|
|
||||||
const std::unique_ptr<FILE, PcloseType> pipe(popen(cmd.c_str(), "r"), static_cast<PcloseType>(pclose));
|
|
||||||
if (!pipe)
|
|
||||||
return "";
|
|
||||||
|
|
||||||
result.reserve(buffer.size());
|
CProcess proc("/bin/sh", {cmd});
|
||||||
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) {
|
|
||||||
result += buffer.data();
|
if (!proc.runSync())
|
||||||
}
|
return "error";
|
||||||
return result;
|
|
||||||
|
return proc.stdOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
SHyprlandVersion CPluginManager::getHyprlandVersion() {
|
SHyprlandVersion CPluginManager::getHyprlandVersion() {
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
#include <execinfo.h>
|
#include <execinfo.h>
|
||||||
#endif
|
#endif
|
||||||
#include <hyprutils/string/String.hpp>
|
#include <hyprutils/string/String.hpp>
|
||||||
|
#include <hyprutils/os/Process.hpp>
|
||||||
using namespace Hyprutils::String;
|
using namespace Hyprutils::String;
|
||||||
|
using namespace Hyprutils::OS;
|
||||||
|
|
||||||
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
@ -583,18 +585,12 @@ 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) {
|
||||||
std::array<char, 128> buffer;
|
CProcess proc("/bin/sh", {cmd});
|
||||||
std::string result;
|
|
||||||
using PcloseType = int (*)(FILE*);
|
if (!proc.runSync())
|
||||||
const std::unique_ptr<FILE, PcloseType> pipe(popen(cmd, "r"), static_cast<PcloseType>(pclose));
|
return "error";
|
||||||
if (!pipe) {
|
|
||||||
Debug::log(ERR, "execAndGet: failed in pipe");
|
return proc.stdOut();
|
||||||
return "";
|
|
||||||
}
|
|
||||||
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) {
|
|
||||||
result += buffer.data();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void logSystemInfo() {
|
void logSystemInfo() {
|
||||||
|
|
Loading…
Reference in a new issue