diff options
Diffstat (limited to 'src/Notification.cpp')
-rw-r--r-- | src/Notification.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Notification.cpp b/src/Notification.cpp new file mode 100644 index 0000000..1201557 --- /dev/null +++ b/src/Notification.cpp @@ -0,0 +1,25 @@ +#include "../include/Notification.hpp" +#include "../include/Program.h" +#include <assert.h> +#include <stdio.h> + +namespace QuickMedia { + 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; + } + + void show_notification(const std::string &title, const std::string &description, Urgency urgency) { + const char *args[] = { "notify-send", "-u", urgency_string(urgency), "--", title.c_str(), description.c_str(), nullptr }; + exec_program_async(args, nullptr); + fprintf(stderr, "Notification: title: %s, description: %s\n", title.c_str(), description.c_str()); + } +}
\ No newline at end of file |