From de181c8bb7803b9f3a5f6445aa60e1c26f49daeb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 28 Aug 2017 13:00:53 +0530 Subject: [PATCH] If the --start-in-tray option is specified, create a tray icon even if the configuration option to enable tray icons is disabled. --- src/calibre/gui2/ui.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index c1f8de3d06..c60fb139f8 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -269,7 +269,8 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ self.tb_wrapper = textwrap.TextWrapper(width=40) self.viewers = collections.deque() self.system_tray_icon = None - if config['systray_icon']: + do_systray = config['systray_icon'] or opts.start_in_tray + if do_systray: self.system_tray_icon = factory(app_id='com.calibre-ebook.gui').create_system_tray_icon(parent=self, title='calibre') if self.system_tray_icon is not None: self.system_tray_icon.setIcon(QIcon(I('lt.png', allow_user_override=False))) @@ -278,8 +279,9 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ self.system_tray_icon.setToolTip(self.jobs_button.tray_tooltip()) self.system_tray_icon.setVisible(True) self.jobs_button.tray_tooltip_updated.connect(self.system_tray_icon.setToolTip) - elif config['systray_icon']: - prints('Failed to create system tray icon, your desktop environment probably does not support the StatusNotifier spec') + elif do_systray: + prints('Failed to create system tray icon, your desktop environment probably' + ' does not support the StatusNotifier spec https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/') self.system_tray_menu = QMenu(self) self.toggle_to_tray_action = self.system_tray_menu.addAction(QIcon(I('page.png')), '') self.toggle_to_tray_action.triggered.connect(self.system_tray_icon_activated)