diff options
| author | KAGEYAM4 <75798544+KAGEYAM4@users.noreply.github.com> | 2025-11-18 22:03:02 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-18 16:33:02 +0000 |
| commit | 9495f989b422158e42c2fae954e34729e4adacdb (patch) | |
| tree | 3f729fe765561703879ee10484b9b8510b7c91df /hyprpm | |
| parent | 2c9c4d090537504e1cb4c02450c41a73f161a090 (diff) | |
hyprpm: remove -nn flag and make notification behaviour more consist… (#11272)
* [hyprpm] Remove -nn flag and make notification behaviour more consistent.
Before -> -nn turns on -n explicitly, and many notify() are ran without checking the flag.
After -> warning and error notification will always work, -n will only give visual confirmation that plugin loaded successfully, eye candy.
* [hyprpm] Add -nn breaking change fallback to nofity users.
Added deprecation warning for the --notify-fail flag.
Diffstat (limited to 'hyprpm')
| -rw-r--r-- | hyprpm/src/main.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/hyprpm/src/main.cpp b/hyprpm/src/main.cpp index 47a557e2..777d1d46 100644 --- a/hyprpm/src/main.cpp +++ b/hyprpm/src/main.cpp @@ -25,8 +25,8 @@ constexpr std::string_view HELP = R"#(┏ hyprpm, a Hyprland Plugin Manager ┃ ┣ Flags: ┃ -┣ --notify | -n → Send a hyprland notification for important events (including both successes and fail events). -┣ --notify-fail | -nn → Send a hyprland notification for fail events only. +┣ --notify | -n → Send a hyprland notification confirming successful plugin load. +┃ Warnings/Errors trigger notifications regardless of this flag. ┣ --help | -h → Show this menu. ┣ --verbose | -v → Enable too much logging. ┣ --force | -f → Force an operation ignoring checks (e.g. update -f). @@ -47,7 +47,7 @@ int main(int argc, char** argv, char** envp) { } std::vector<std::string> command; - bool notify = false, notifyFail = false, verbose = false, force = false, noShallow = false; + bool notify = false, verbose = false, force = false, noShallow = false; std::string customHlUrl; for (int i = 1; i < argc; ++i) { @@ -58,7 +58,9 @@ int main(int argc, char** argv, char** envp) { } else if (ARGS[i] == "--notify" || ARGS[i] == "-n") { notify = true; } else if (ARGS[i] == "--notify-fail" || ARGS[i] == "-nn") { - notifyFail = notify = true; + // TODO: Deprecated since v.053.0. Remove in version>0.56.0 + std::println(stderr, "{}", failureString("Deprececated flag.")); + g_pPluginManager->notify(ICON_INFO, 0, 10000, "[hyprpm] -n flag is deprecated, see hyprpm --help."); } else if (ARGS[i] == "--verbose" || ARGS[i] == "-v") { verbose = true; } else if (ARGS[i] == "--no-shallow" || ARGS[i] == "-s") { @@ -149,8 +151,9 @@ int main(int argc, char** argv, char** envp) { if (ret2 != LOADSTATE_OK) return 1; - } else if (notify) + } else { g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Couldn't update headers"); + } } else if (command[0] == "enable") { if (command.size() < 2) { std::println(stderr, "{}", failureString("Not enough args for enable.")); @@ -194,19 +197,17 @@ int main(int argc, char** argv, char** envp) { auto ret = g_pPluginManager->ensurePluginsLoadState(force); if (ret != LOADSTATE_OK) { - if (notify) { - switch (ret) { - case LOADSTATE_FAIL: - case LOADSTATE_PARTIAL_FAIL: g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Failed to load plugins"); break; - case LOADSTATE_HEADERS_OUTDATED: - g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Failed to load plugins: Outdated headers. Please run hyprpm update manually."); - break; - default: break; - } + switch (ret) { + case LOADSTATE_FAIL: + case LOADSTATE_PARTIAL_FAIL: g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Failed to load plugins"); break; + case LOADSTATE_HEADERS_OUTDATED: + g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Failed to load plugins: Outdated headers. Please run hyprpm update manually."); + break; + default: break; } return 1; - } else if (notify && !notifyFail) { + } else if (notify) { g_pPluginManager->notify(ICON_OK, 0, 4000, "[hyprpm] Loaded plugins"); } } else if (command[0] == "purge-cache") { |
