Is it possible to run only one copy of GTK application but without creating any windows? This example allows you to run several copies of the program, but I somehow need to enforce that only one be allowed to run.
#include <gtkmm.h>
int
main(int argc, char** argv)
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
app->hold();
return app->run();
}
If I add a GTK window everything is working as I'd expect it to do. i.e. only one copy is running, the second one just exits. But my application lives in a system tray and doesn't create any windows at start.
#include <gtkmm.h>
int
main(int argc, char** argv)
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "org.gtkmm.example");
Gtk::Window window;
return app->run(window);
}