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)
This commit is contained in:
Kovid Goyal 2023-11-21 18:51:28 +05:30
parent 0419739c50
commit e873111bdc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -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)