def attempt_gnome_client(self): """Attempt to find a GNOME Session to register with""" try: from gi.repository import Gnome self.gnome_program = Gnome.init(APP_NAME, APP_VERSION) # VERIFY FOR GTK3 self.gnome_client = Gnome.Ui.master_client() # VERIFY FOR GTK3 self.gnome_client.connect_to_session_manager() self.gnome_client.connect('save-yourself', self.save_yourself) self.gnome_client.connect('die', self.die) dbg('GNOME session support enabled and registered') except (ImportError, AttributeError): self.gnome_client = False dbg('GNOME session support not available')