diff options
author | wurstsalat <mailtrash@posteo.de> | 2022-09-26 12:31:41 +0300 |
---|---|---|
committer | wurstsalat <mailtrash@posteo.de> | 2022-09-26 12:31:41 +0300 |
commit | edc53ee1689f81e40933964bf93f030b64abf0c5 (patch) | |
tree | 33114fe0b28b4ca8062a3ce4eb49a866d00ea72c | |
parent | beee4cbe4ae8ebdb1896463b59872ad0cb604f15 (diff) |
imprv: Windows: Ellipsize body text in notifications
-rw-r--r-- | gajim/gtk/notification.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gajim/gtk/notification.py b/gajim/gtk/notification.py index 44d731447..531c10095 100644 --- a/gajim/gtk/notification.py +++ b/gajim/gtk/notification.py @@ -30,8 +30,9 @@ from typing import Any from typing import Optional from typing import Union -import sys import logging +import sys +import textwrap from gi.repository import GLib from gi.repository import Gio @@ -187,7 +188,11 @@ class PopupNotification(Gtk.Window): icon_name = self._get_icon_name(event) self._ui.image.set_from_icon_name(icon_name, Gtk.IconSize.DIALOG) self._ui.event_type_label.set_text(event.title) - self._ui.event_description_label.set_text(event.text) + body = textwrap.fill(event.text, + width=40, + max_lines=3, + placeholder='…') + self._ui.event_description_label.set_text(body) if timeout > 0: self._timeout_id = GLib.timeout_add_seconds(timeout, self.destroy) |