Score:2

Why does my notification never appear?

cn flag

Here's what I'm trying.

    // 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 );
    }

The notification never appears. Am I missing something? Or perhaps this is an instance covered by the disclaimer in the documentation: "There is no guarantee that the notification is displayed immediately, or even at all."

Score:1
us flag

First install the required dependencies

sudo apt install build-essential libgtkmm-3.0-dev

Now compile the program

g++ Recipes.cc `pkg-config gtkmm-3.0 --cflags --libs` -o Recipes

Now run the program

./Recipes

enter image description here Works for me in Xubuntu 20.04 and also in Cinnamon running in Ubuntu 20.04, but does not work in gnomes hell.

Adiabat avatar
cn flag
sudo apt install build-essential libgtkmm-3.0-dev ...Reading package lists... Done Building dependency tree Reading state information... Done libgtkmm-3.0-dev is already the newest version (3.24.2-1build1). build-essential is already the newest version (12.8ubuntu1.1).
Adiabat avatar
cn flag
I guess you meant "gnome shell"?
Adiabat avatar
cn flag
Tried running it via alt-F2 (does that bypass the shell?) with same failing result.
us flag
@Adiabat That typo was intentional, given the number of useful things that do not work there out of the box.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.