Merge pull request #610 from deltragon/fix-gtk-startup

fix gtk startup order
This commit is contained in:
Archisman Panigrahi 2024-08-04 18:27:16 -04:00 committed by GitHub
commit 9711a71b22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 10 deletions

View File

@ -52,7 +52,7 @@ class SafeEyes(Gtk.Application):
def __init__(self, system_locale, config, cli_args):
super().__init__(
application_id="io.github.slgobinath.SafeEyes",
flags=Gio.ApplicationFlags.IS_SERVICE
flags=Gio.ApplicationFlags.DEFAULT_FLAGS
)
self.active = False
self.break_screen = None
@ -64,12 +64,24 @@ class SafeEyes(Gtk.Application):
self.rpc_server = None
self._status = ''
self.cli_args = cli_args
self.system_locale = system_locale
def start(self):
"""
Start Safe Eyes
"""
self.run()
def do_startup(self):
Gtk.Application.do_startup(self)
logging.info('Starting up Application')
# Initialize the Safe Eyes Context
self.context['version'] = SAFE_EYES_VERSION
self.context['desktop'] = utility.desktop_environment()
self.context['is_wayland'] = utility.is_wayland()
self.context['locale'] = system_locale
self.context['locale'] = self.system_locale
self.context['api'] = {}
self.context['api']['show_settings'] = lambda: utility.execute_main_thread(
self.show_settings)
@ -114,10 +126,6 @@ class SafeEyes(Gtk.Application):
atexit.register(self.persist_session)
def start(self):
"""
Start Safe Eyes
"""
if self.config.get('use_rpc_server', True):
self.__start_rpc_server()
@ -128,10 +136,8 @@ class SafeEyes(Gtk.Application):
self.safe_eyes_core.start()
self.handle_system_suspend()
self.run()
def do_startup(self):
Gtk.Application.do_startup(self)
def do_activate(self):
logging.info('Application activated')
if self.cli_args.about:
self.show_about()