aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2023-12-06 19:25:04 +0000
committerVaxry <[email protected]>2023-12-06 23:31:04 +0000
commit148ea1673272c2a34bcfe0437fecf09844a03a53 (patch)
treeb6e3d88650fe38a4b44c2fdca1d6b787e8d005cb
parent0ac88687248b9f7d7a67213250e14ccc14e7d3eb (diff)
downloadHyprland-148ea1673272c2a34bcfe0437fecf09844a03a53.tar.gz
Hyprland-148ea1673272c2a34bcfe0437fecf09844a03a53.zip
add list
-rw-r--r--hyprpm/src/core/PluginManager.cpp15
-rw-r--r--hyprpm/src/core/PluginManager.hpp2
-rw-r--r--hyprpm/src/main.cpp3
3 files changed, 19 insertions, 1 deletions
diff --git a/hyprpm/src/core/PluginManager.cpp b/hyprpm/src/core/PluginManager.cpp
index b50fb040..af946785 100644
--- a/hyprpm/src/core/PluginManager.cpp
+++ b/hyprpm/src/core/PluginManager.cpp
@@ -367,7 +367,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
const auto REPOS = DataState::getAllRepositories();
if (REPOS.size() < 1) {
- std::cout << "\n" << std::string{Colors::RED} + "✖" + Colors::RESET + " No repos to update.";
+ std::cout << "\n" << std::string{Colors::RED} + "✖" + Colors::RESET + " No repos to update.\n";
return true;
}
@@ -631,4 +631,17 @@ bool CPluginManager::loadUnloadPlugin(const std::string& path, bool load) {
execAndGet("hyprctl plugin unload " + path);
return true;
+}
+
+void CPluginManager::listAllPlugins() {
+ const auto REPOS = DataState::getAllRepositories();
+
+ for (auto& r : REPOS) {
+ std::cout << std::string{Colors::RESET} + " → Repository " + r.name + ":\n";
+
+ for (auto& p : r.plugins) {
+ std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name + "\n └─ enabled: " << (p.enabled ? Colors::GREEN : Colors::RED) << (p.enabled ? "true" : "false")
+ << Colors::RESET << "\n";
+ }
+ }
} \ No newline at end of file
diff --git a/hyprpm/src/core/PluginManager.hpp b/hyprpm/src/core/PluginManager.hpp
index f344c59d..5c587c8a 100644
--- a/hyprpm/src/core/PluginManager.hpp
+++ b/hyprpm/src/core/PluginManager.hpp
@@ -21,6 +21,8 @@ class CPluginManager {
bool updateHeaders();
bool updatePlugins(bool forceUpdateAll);
+ void listAllPlugins();
+
bool enablePlugin(const std::string& name);
bool disablePlugin(const std::string& name);
void ensurePluginsLoadState();
diff --git a/hyprpm/src/main.cpp b/hyprpm/src/main.cpp
index 4e519d53..02131df3 100644
--- a/hyprpm/src/main.cpp
+++ b/hyprpm/src/main.cpp
@@ -16,6 +16,7 @@ const std::string HELP = R"#(┏ hyprpm, a Hyprland Plugin Manager
┣ disable [name] → Disable a plugin
┣ update → Check and update all plugins if needed
┣ load → Load hyprpm state. Ensure all enabled plugins are loaded.
+┣ list → List all installed plugins
)#";
@@ -79,6 +80,8 @@ int main(int argc, char** argv, char** envp) {
g_pPluginManager->ensurePluginsLoadState();
} else if (ARGS[1] == "load") {
g_pPluginManager->ensurePluginsLoadState();
+ } else if (ARGS[1] == "list") {
+ g_pPluginManager->listAllPlugins();
} else {
std::cout << HELP;
return 1;