diff --git a/.github/actions/setup_base/action.yml b/.github/actions/setup_base/action.yml index 6df442b3231..c510bb74fe0 100644 --- a/.github/actions/setup_base/action.yml +++ b/.github/actions/setup_base/action.yml @@ -63,15 +63,6 @@ runs: librsvg \ re2 - - name: Get glaze - shell: bash - run: | - git clone https://github.com/stephenberry/glaze.git - cd glaze - cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build - cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` - cmake --install build - - name: Get hyprwayland-scanner-git shell: bash run: | diff --git a/hyprctl/Strings.hpp b/hyprctl/Strings.hpp index f77626a52be..eb427e051d5 100644 --- a/hyprctl/Strings.hpp +++ b/hyprctl/Strings.hpp @@ -124,9 +124,10 @@ const std::string_view PLUGIN_HELP = R"#(usage: hyprctl [flags] plugin requests: load → Loads a plugin. Path must be absolute unload → Unloads a plugin. Path must be absolute - list → Lists all loaded plugins + list [-t] → Lists all loaded plugins flags: + -t → Terse output mode See 'hyprctl --help')#"; const std::string_view SETPROP_HELP = R"#(usage: hyprctl [flags] setprop [lock] diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp index 16d6622366c..ecf09da6b91 100644 --- a/hyprctl/main.cpp +++ b/hyprctl/main.cpp @@ -358,6 +358,8 @@ int main(int argc, char** argv) { if (ARGS[i] == "-j" && !fullArgs.contains("j")) { fullArgs += "j"; json = true; + } else if (ARGS[i] == "-t" && !fullArgs.contains("t")) { + fullArgs += "t"; } else if (ARGS[i] == "-r" && !fullArgs.contains("r")) { fullArgs += "r"; } else if (ARGS[i] == "-a" && !fullArgs.contains("a")) { diff --git a/hyprpm/CMakeLists.txt b/hyprpm/CMakeLists.txt index d744ac1635c..22cb8caaa02 100644 --- a/hyprpm/CMakeLists.txt +++ b/hyprpm/CMakeLists.txt @@ -11,23 +11,9 @@ set(CMAKE_CXX_STANDARD 23) pkg_check_modules(hyprpm_deps REQUIRED IMPORTED_TARGET tomlplusplus hyprutils>=0.2.4) -find_package(glaze QUIET) -if (NOT glaze_FOUND) - set(GLAZE_VERSION v4.2.3) - message(STATUS "glaze dependency not found, retrieving ${GLAZE_VERSION} with FetchContent") - include(FetchContent) - FetchContent_Declare( - glaze - GIT_REPOSITORY https://github.com/stephenberry/glaze.git - GIT_TAG ${GLAZE_VERSION} - GIT_SHALLOW TRUE - ) - FetchContent_MakeAvailable(glaze) -endif() - add_executable(hyprpm ${SRCFILES}) -target_link_libraries(hyprpm PUBLIC PkgConfig::hyprpm_deps glaze::glaze) +target_link_libraries(hyprpm PUBLIC PkgConfig::hyprpm_deps) # binary install(TARGETS hyprpm) diff --git a/hyprpm/src/core/PluginManager.cpp b/hyprpm/src/core/PluginManager.cpp index 80d0a4021c5..c60e799f554 100644 --- a/hyprpm/src/core/PluginManager.cpp +++ b/hyprpm/src/core/PluginManager.cpp @@ -19,7 +19,6 @@ #include #include -#include #include #include @@ -792,21 +791,19 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState(bool forceReload) std::println(stderr, "PluginManager: no $HOME or $HYPRLAND_INSTANCE_SIGNATURE"); return LOADSTATE_FAIL; } - const auto HYPRPMPATH = DataState::getDataStatePath(); - - const auto json = glz::read_json(execAndGet("hyprctl plugins list -j")); - if (!json) { - std::println(stderr, "PluginManager: couldn't parse hyprctl output"); - return LOADSTATE_FAIL; - } + const auto HYPRPMPATH = DataState::getDataStatePath(); std::vector loadedPlugins; - for (const auto& plugin : json.value()) { - if (!plugin.is_object() || !plugin.contains("name")) { - std::println(stderr, "PluginManager: couldn't parse plugin object"); + const auto pluginLines = execAndGet("hyprctl plugins list -t"); + std::istringstream pluginStream(pluginLines); + std::string pluginLine; + while (std::getline(pluginStream, pluginLine)) { + if (pluginLine == "error") { + std::println(stderr, "PluginManager: couldn't parse hyprctl output"); return LOADSTATE_FAIL; } - loadedPlugins.emplace_back(plugin["name"].get()); + if (pluginLine != "") + loadedPlugins.emplace_back(pluginLine); } std::println("{}", successString("Ensuring plugin load state")); diff --git a/hyprpm/src/meson.build b/hyprpm/src/meson.build index fd914f9d238..2ef6c32389a 100644 --- a/hyprpm/src/meson.build +++ b/hyprpm/src/meson.build @@ -8,7 +8,6 @@ executable( dependency('hyprutils', version: '>= 0.1.1'), dependency('threads'), dependency('tomlplusplus'), - dependency('glaze', method: 'cmake'), ], install: true, ) diff --git a/nix/default.nix b/nix/default.nix index 8e3af31d1b0..9293a35c7c3 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -5,14 +5,12 @@ pkg-config, pkgconf, makeWrapper, - cmake, meson, ninja, aquamarine, binutils, cairo, git, - glaze, hyprcursor, hyprgraphics, hyprland-protocols, @@ -104,7 +102,6 @@ in makeWrapper meson ninja - cmake # needed for glaze pkg-config ]; @@ -119,7 +116,6 @@ in aquamarine cairo git - glaze hyprcursor hyprgraphics hyprland-protocols diff --git a/src/SharedDefs.hpp b/src/SharedDefs.hpp index a46a2429bc3..ebce5e9d2bc 100644 --- a/src/SharedDefs.hpp +++ b/src/SharedDefs.hpp @@ -43,7 +43,8 @@ struct SCallbackInfo { enum eHyprCtlOutputFormat : uint8_t { FORMAT_NORMAL = 0, - FORMAT_JSON + FORMAT_JSON, + FORMAT_TERSE }; struct SHyprCtlCommand { diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 41b0abe11ac..0e8bb66c280 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -1507,6 +1507,10 @@ static std::string dispatchPlugin(eHyprCtlOutputFormat format, std::string reque } trimTrailingComma(result); result += "]"; + } else if (format == eHyprCtlOutputFormat::FORMAT_TERSE) { + for (auto const& p : PLUGINS) { + result += std::format("{}\n", p->name); + } } else { if (PLUGINS.size() == 0) return "no plugins loaded"; @@ -1718,6 +1722,8 @@ std::string CHyprCtl::getReply(std::string request) { if (c == 'j') format = eHyprCtlOutputFormat::FORMAT_JSON; + else if (c == 't') + format = eHyprCtlOutputFormat::FORMAT_TERSE; else if (c == 'r') reloadAll = true; else if (c == 'a') @@ -1754,7 +1760,7 @@ std::string CHyprCtl::getReply(std::string request) { } } - if (result.empty()) + if (result.empty() && format != eHyprCtlOutputFormat::FORMAT_TERSE) return "unknown request"; if (reloadAll) {