- Some notifications crashes fixed

- Icon gap removed if no icon needed in notification
This commit is contained in:
trigg 2022-04-09 11:14:52 +00:00
parent 746a621dad
commit ab5093773c
2 changed files with 14 additions and 10 deletions

View file

@ -134,16 +134,17 @@ class Discover:
def add_notification_message(self, bus, message):
args = message.get_args_list()
noti = {"title": "%s" % (args[3]), "body": "%s" % (args[4]),
"icon": "%s" % (args[2]), "cmd": "%s" % (args[0]), "time": time.time()}
if len(args) > 6:
dictionary = args[6]
if 'image-data' in dictionary:
noti['icon_raw'] = dictionary['image-data']
elif 'image_data' in dictionary:
noti['icon_raw'] = dictionary['image_data']
self.notification_messages.append(noti)
self.notification_overlay.set_content(self.notification_messages, True)
if len(args) > 4:
noti = {"title": "%s" % (args[3]), "body": "%s" % (args[4]),
"icon": "%s" % (args[2]), "cmd": "%s" % (args[0]), "time": time.time()}
if len(args) > 6:
dictionary = args[6]
if 'image-data' in dictionary:
noti['icon_raw'] = dictionary['image-data']
elif 'image_data' in dictionary:
noti['icon_raw'] = dictionary['image_data']
self.notification_messages.append(noti)
self.notification_overlay.set_content(self.notification_messages, True)
def do_args(self, data, normal_close):
"""

View file

@ -285,6 +285,7 @@ class NotificationOverlayWindow(OverlayWindow):
message = m_with_body % (self.sanitize_string(col),
self.sanitize_string(line["title"]))
icon = None
# If we've got an embedded image
if "icon_surface" in line and line["icon_surface"]:
icon = line["icon_surface"]
@ -308,7 +309,9 @@ class NotificationOverlayWindow(OverlayWindow):
icon_pad = self.icon_pad
if not self.show_icon:
icon = None
if not icon:
icon_pad = 0
icon_width = 0
layout = self.create_pango_layout(text)
layout.set_auto_dir(True)