Вот что я пытаюсь.
// Ubuntu 20.04, fully updated
// g++ -o Recipes Recipes.cc `pkg-config gtkmm-3.0 --cflags --libs`
#include <gtkmm.h>
class Recipes : public Gtk::Application
{
public:
static Glib::RefPtr<Recipes > create ();
protected:
Recipes ();
};
Glib::RefPtr<Recipes > Recipes::create ()
{
return ( Glib::RefPtr<Recipes > ( new Recipes () ) );
}
Recipes::Recipes ()
: Gtk::Application ( "org.pwolff.recipes" )
{
register_application ();
Glib::RefPtr<Gio::Notification > refNote = Gio::Notification::create ( "recipe" );
refNote->set_body ( "Chipotle Shrimp" );
refNote->set_priority ( Gio::NOTIFICATION_PRIORITY_URGENT );
send_notification ( "recipe", refNote );
}
int main ( int argc, char *argv[] )
{
Glib::RefPtr<Recipes > refApp = Recipes::create ();
const int status = refApp->run ( argc, argv );
return ( status );
}
Уведомление никогда не появляется. Я что-то упускаю? Или, возможно, это случай, на который распространяется отказ от ответственности в документации: «Нет гарантии, что уведомление будет отображаться немедленно или даже вообще».
Сначала установите необходимые зависимости
sudo apt install build-essential libgtkmm-3.0-dev
Теперь скомпилируйте программу
g++ Recipes.cc `pkg-config gtkmm-3.0 --cflags --libs` -o Recipes
Теперь запустите программу
./Recipes
У меня работает в Xubuntu 20.04, а также в Cinnamon, работающем в Ubuntu 20.04, но не работает в аду гномов.