Skip to content

Commit

Permalink
Merge pull request #610 from deltragon/fix-gtk-startup
Browse files Browse the repository at this point in the history
fix gtk startup order
  • Loading branch information
archisman-panigrahi authored Aug 4, 2024
2 parents 09e648a + c23c84f commit 9711a71
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions safeeyes/safeeyes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -64,12 +64,24 @@ def __init__(self, system_locale, config, cli_args):
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)
Expand Down Expand Up @@ -114,10 +126,6 @@ def __init__(self, system_locale, config, cli_args):

atexit.register(self.persist_session)

def start(self):
"""
Start Safe Eyes
"""
if self.config.get('use_rpc_server', True):
self.__start_rpc_server()

Expand All @@ -128,10 +136,8 @@ def start(self):
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()
Expand Down

0 comments on commit 9711a71

Please sign in to comment.