Merge pull request #646 from deltragon/xayatanalabel

trayicon: set XAyatanaLabel attribute for "Show next break time in tray icon"
This commit is contained in:
Archisman Panigrahi 2024-09-23 13:50:01 -04:00 committed by GitHub
commit 628abe298a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

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