mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-17 14:10:02 +02:00
Add a function for sending desktop notifications
This commit is contained in:
@@ -391,3 +391,15 @@ Configuration load_config_for(const fs::path& yabridge_path) {
|
||||
|
||||
return Configuration(*config_file, yabridge_path);
|
||||
}
|
||||
|
||||
bool send_notification(const std::string& title, const std::string body) {
|
||||
try {
|
||||
return bp::system(bp::search_path("notify-send"), "--urgency=critical",
|
||||
"--expire-time=20000", "--app-name=yabridge", title,
|
||||
body) == EXIT_SUCCESS;
|
||||
} catch (const boost::process::process_error&) {
|
||||
// We will have printed the message to the terminal anyways, so if the
|
||||
// user doesn't have libnotify installed we'll just fail silently
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user