From e873111bdc6bd32b5013c95420c3b500a975e826 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 21 Nov 2023 18:51:28 +0530 Subject: [PATCH] When starting in system tray do not flash the main window briefly Fixes #2044118 [Issue with "--start-in-tray" switch and MS RDP](https://bugs.launchpad.net/calibre/+bug/2044118) --- src/calibre/gui2/ui.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index ea8ee3b3b2..a1186a42ce 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -392,6 +392,10 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ if config['autolaunch_server']: self.start_content_server() + if self.system_tray_icon is not None and self.system_tray_icon.isVisible() and opts.start_in_tray: + QTimer.singleShot(0, self.hide_windows) + show_gui = False + setattr(self, '__systray_minimized', True) if show_gui: self.show() self.read_settings() @@ -413,8 +417,6 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ register_keyboard_shortcuts() self.keyboard.finalize() - if self.system_tray_icon is not None and self.system_tray_icon.isVisible() and opts.start_in_tray: - self.hide_windows() self.auto_adder = AutoAdder(gprefs['auto_add_path'], self) self.listener = Listener(parent=self)