mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-03 17:46:00 +01:00
Linux: Allow using calibre-tray.png in the calibre resources folder to override the system tray icon. Fixes #1738518 [Feature request - custom systray icon](https://bugs.launchpad.net/calibre/+bug/1738518)
This commit is contained in:
parent
df177fe455
commit
8f0d9cc028
1 changed files with 8 additions and 4 deletions
|
|
@ -16,7 +16,8 @@
|
|||
|
||||
import dbus
|
||||
from PyQt5.Qt import (
|
||||
QApplication, QObject, pyqtSignal, Qt, QPoint, QRect, QMenu, QSystemTrayIcon)
|
||||
QApplication, QObject, pyqtSignal, Qt, QPoint, QRect, QMenu,
|
||||
QSystemTrayIcon, QIcon)
|
||||
|
||||
from calibre.gui2.dbus_export.menu import DBusMenu
|
||||
from calibre.gui2.dbus_export.utils import icon_cache
|
||||
|
|
@ -38,7 +39,11 @@ def __init__(self, **kw):
|
|||
self.context_menu = None
|
||||
self.is_visible = True
|
||||
self.tool_tip = ''
|
||||
self._icon = QApplication.instance().windowIcon()
|
||||
path = I('calibre-tray.png')
|
||||
if path and os.path.exists(path):
|
||||
self._icon = QIcon(path)
|
||||
else:
|
||||
self._icon = QApplication.instance().windowIcon()
|
||||
self.show_menu.connect(self._show_menu, type=Qt.QueuedConnection)
|
||||
_sni_count += 1
|
||||
kw['num'] = _sni_count
|
||||
|
|
@ -97,6 +102,7 @@ def supportsMessages(cls):
|
|||
def emit_activated(self):
|
||||
self.activated.emit(QSystemTrayIcon.Trigger)
|
||||
|
||||
|
||||
_status_item_menu_count = 0
|
||||
|
||||
|
||||
|
|
@ -234,5 +240,3 @@ def NewToolTip(self):
|
|||
@dbus_signal(IFACE, 's')
|
||||
def NewStatus(self, status):
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue