trayicon: set XAyatanaLabel attribute for "Show next break time in tray icon"
Fixes https://github.com/slgobinath/SafeEyes/issues/643 this a non-standard attribute that is not supported by many desktops, e.g. KDE and snixembed however, this also did not work with libappindicator on KDE before
This commit is contained in:
parent
0b80f503c9
commit
f25f554585
|
@ -49,6 +49,12 @@ SNI_NODE_INFO = Gio.DBusNodeInfo.new_for_xml("""
|
|||
<property name="Status" type="s" access="read"/>
|
||||
<signal name="NewIcon"/>
|
||||
<signal name="NewTooltip"/>
|
||||
|
||||
<property name="XAyatanaLabel" type="s" access="read"/>
|
||||
<signal name="XAyatanaNewLabel">
|
||||
<arg type="s" name="label" direction="out" />
|
||||
<arg type="s" name="guide" direction="out" />
|
||||
</signal>
|
||||
</interface>
|
||||
</node>""").interfaces[0]
|
||||
|
||||
|
@ -346,6 +352,7 @@ class StatusNotifierItemService(DBusService):
|
|||
IconName = 'io.github.slgobinath.SafeEyes-enabled'
|
||||
IconThemePath = ''
|
||||
ToolTip = ('', [], 'Safe Eyes', '')
|
||||
XAyatanaLabel = ""
|
||||
ItemIsMenu = True
|
||||
Menu = None
|
||||
|
||||
|
@ -398,6 +405,14 @@ class StatusNotifierItemService(DBusService):
|
|||
'NewTooltip'
|
||||
)
|
||||
|
||||
def set_xayatanalabel(self, label):
|
||||
self.XAyatanaLabel = label
|
||||
|
||||
self.emit_signal(
|
||||
"XAyatanaNewLabel",
|
||||
(label, "")
|
||||
)
|
||||
|
||||
class TrayIcon:
|
||||
"""
|
||||
Create and show the tray icon along with the tray menu.
|
||||
|
@ -611,6 +626,7 @@ class TrayIcon:
|
|||
description = ''
|
||||
|
||||
self.sni_service.set_tooltip('Safe Eyes', description)
|
||||
self.sni_service.set_xayatanalabel(description)
|
||||
|
||||
def quit_safe_eyes(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue