Skip to content

Commit

Permalink
hyprpm: Add option to notify on fail and keep original notify (hyprwm…
Browse files Browse the repository at this point in the history
…#8167)

* Only generate notification on fail

Hyprpm fail/pass notification are mutually exclusive.

* Add option to notify on fail and keep original notify (hyprwm#1)

* Add option to notify on fail and keep original notify
---------

Co-authored-by: KAGEYAM4 <[email protected]>

---------

Co-authored-by: littleblack111 <[email protected]>
  • Loading branch information
KAGEYAM4 and littleblack111 authored Oct 21, 2024
1 parent 9df0f0b commit 5e96d73
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions hyprpm/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ constexpr std::string_view HELP = R"#(┏ hyprpm, a Hyprland Plugin Manager
┣ Flags:
┣ --notify | -n → Send a hyprland notification for important events (e.g. load fail)
┣ --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
┣ --help | -h → Show this menu
┣ --verbose | -v → Enable too much logging
┣ --force | -f → Force an operation ignoring checks (e.g. update -f)
Expand All @@ -43,7 +44,7 @@ int main(int argc, char** argv, char** envp) {
}

std::vector<std::string> command;
bool notify = false, verbose = false, force = false, noShallow = false;
bool notify = false, notifyFail = false, verbose = false, force = false, noShallow = false;

for (int i = 1; i < argc; ++i) {
if (ARGS[i].starts_with("-")) {
Expand All @@ -52,6 +53,8 @@ int main(int argc, char** argv, char** envp) {
return 0;
} else if (ARGS[i] == "--notify" || ARGS[i] == "-n") {
notify = true;
} else if (ARGS[i] == "--notify-fail" || ARGS[i] == "-nn") {
notifyFail = notify = true;
} else if (ARGS[i] == "--verbose" || ARGS[i] == "-v") {
verbose = true;
} else if (ARGS[i] == "--no-shallow" || ARGS[i] == "-s") {
Expand Down Expand Up @@ -155,7 +158,7 @@ int main(int argc, char** argv, char** envp) {
break;
default: break;
}
} else if (notify) {
} else if (notify && !notifyFail) {
g_pPluginManager->notify(ICON_OK, 0, 4000, "[hyprpm] Loaded plugins");
}
} else if (command[0] == "list") {
Expand Down

0 comments on commit 5e96d73

Please sign in to comment.