diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-05-28 02:08:40 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-05-28 02:08:40 +0200 |
commit | 9799803529c57930a0e7f12e45cbcf2b2e4419eb (patch) | |
tree | b2c488b49d901e5bc5e911a2e714a6748f37158e /include/Notification.hpp | |
parent | 217101c7a79dccf8617a7d3251d4b06bc7cb5905 (diff) |
Add support for mangadex
Diffstat (limited to 'include/Notification.hpp')
-rw-r--r-- | include/Notification.hpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/Notification.hpp b/include/Notification.hpp new file mode 100644 index 0000000..22f2f77 --- /dev/null +++ b/include/Notification.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include "Program.h" +#include <assert.h> +#include <string> + +namespace QuickMedia { + enum class Urgency { + LOW, + NORMAL, + CRITICAL + }; + + static const char* urgency_string(Urgency urgency) { + switch(urgency) { + case Urgency::LOW: + return "low"; + case Urgency::NORMAL: + return "normal"; + case Urgency::CRITICAL: + return "critical"; + } + assert(false); + return nullptr; + } + + static void show_notification(const std::string &title, const std::string &description, Urgency urgency = Urgency::NORMAL) { + const char *args[] = { "notify-send", "-u", urgency_string(urgency), "--", title.c_str(), description.c_str(), nullptr }; + exec_program_async(args, nullptr); + printf("Notification: title: %s, description: %s\n", title.c_str(), description.c_str()); + } +}
\ No newline at end of file |