From 480c6b66d59a2fee1595312cc5182b7b8f6daee5 Mon Sep 17 00:00:00 2001 From: anaximeno Date: Mon, 25 May 2026 23:47:50 -0100 Subject: [PATCH 1/4] notification: Limit max height and enable vscroll when displaying and disable when in the applet menu --- .../notifications@cinnamon.org/applet.js | 9 ++++- js/ui/messageTray.js | 39 +++++++++---------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js b/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js index 361cbca58f..34861933b5 100644 --- a/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js +++ b/files/usr/share/cinnamon/applets/notifications@cinnamon.org/applet.js @@ -74,7 +74,7 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet { } _openMenu() { - this._update_timestamp(); + this._update_notification_status(); this.menu.toggle(); } @@ -310,13 +310,18 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet { Util.spawnCommandLine("cinnamon-settings notifications"); } - _update_timestamp() { + _update_notification_status() { let len = this.notifications.length; if (len > 0) { for (let i = 0; i < len; i++) { let notification = this.notifications[i]; let orig_time = notification._timestamp; notification._timeLabel.clutter_text.set_markup(timeify(orig_time)); + + // Disable body scroll for notifications and allow the notification widget to expand. + // This is to avoid having notifications with scrollable bodies inside the scrollable notification menu, + // which would be a bad user experience. + notification.setBodyExpand(true); } } } diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index b1495031fc..5feba3f070 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -392,38 +392,28 @@ var Notification = class Notification { _setBodyArea(text, allowMarkup) { if (text) { if (!this._scrollArea) { - /* FIXME: vscroll should be enabled - * -vfade covers too much for this size of scrollable - * -scrollview min-height is broken inside tray with a scrollview - * - * TODO: when scrollable: - * - * applet connects to this signal to enable captured-event passthru so you can grab the scrollbar: - * let vscroll = this._scrollArea.get_vscroll_bar(); - * vscroll.connect('scroll-start', () => { this.emit('scrolling-changed', true) }); - * vscroll.connect('scroll-stop', () => { this.emit('scrolling-changed', false) }); - * - * `enable_mouse_scrolling` makes it difficult to scroll when there are many notifications - * in the tray because most of the area is these smaller scrollviews which capture the event. - * ideally, this should only be disabled when the notification is in the tray and there are - * many notifications. - */ this._scrollArea = new St.ScrollView({ name: 'notification-scrollview', - vscrollbar_policy: St.PolicyType.NEVER, hscrollbar_policy: St.PolicyType.NEVER, - enable_mouse_scrolling: false/*, - style_class: 'vfade'*/ }); + }); + + this._scrollArea.set_clip_to_allocation(true); + + this.setBodyExpand(false); this._table.add(this._scrollArea, { row: 1, - col: 2 + col: 2, + y_expand: false, + y_fill: false, + y_align: St.Align.START }); let content = new St.BoxLayout({ name: 'notification-body', vertical: true }); + this._scrollArea.add_actor(content); // body label @@ -463,6 +453,14 @@ var Notification = class Notification { adjustment.value = adjustment.upper; } + setBodyExpand(enabled) { + if (this._scrollArea) { + this._scrollArea.vscrollbar_policy = enabled ? St.PolicyType.NEVER : St.PolicyType.AUTOMATIC; + this._scrollArea.enable_mouse_scrolling = !enabled; + this._table.set_style(`max-height: ${enabled ? 'none' : '300px'};`); + } + } + _updateLayout() { if (this._imageBin || this._scrollArea || this._actionArea) { this._table.add_style_class_name('multi-line-notification'); @@ -470,6 +468,7 @@ var Notification = class Notification { this._table.remove_style_class_name('multi-line-notification'); } + // XXX: check this if (this._imageBin) { this._table.add_style_class_name('notification-with-image'); } else { From ba1f02b4185f8bca842c3c427a628bd2611db725 Mon Sep 17 00:00:00 2001 From: anaximeno Date: Mon, 25 May 2026 23:50:58 -0100 Subject: [PATCH 2/4] scrollview-scroll-bar: Fix grab assertion fail over scroll bar on repent leaves Fix `St:ERROR:../src/st/st-scroll-bar.c:662:handle_button_press_event_cb: assertion failed: (!priv->grab_device) Bail out! St:ERROR:../src/st/st-scroll-bar.c:662:handle_button_press_event_cb: assertion failed: (!priv->grab_device)`, this can happen if events are lost when the scrollbar's container is hidden or removed while dragging and can trigger a full break of Cinnamon. --- src/st/st-scroll-bar.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/st/st-scroll-bar.c b/src/st/st-scroll-bar.c index c4551b5e90..abe7c4495d 100644 --- a/src/st/st-scroll-bar.c +++ b/src/st/st-scroll-bar.c @@ -659,6 +659,10 @@ handle_button_press_event_cb (ClutterActor *actor, priv->x_origin += clutter_actor_get_x (priv->trough); priv->y_origin += clutter_actor_get_y (priv->trough); + /* Clean up any stale grab before creating a new one. */ + if (priv->grab_device) + stop_scrolling (bar); + g_assert (!priv->grab_device); clutter_input_device_grab (device, priv->handle); From 129ec90ceeaf8b2b7c804b68e5af937b3050912f Mon Sep 17 00:00:00 2001 From: anaximeno Date: Tue, 26 May 2026 01:14:53 -0100 Subject: [PATCH 3/4] notification: Made adjustments for notifications with image and added vscroll signals --- js/ui/messageTray.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 5feba3f070..ebcaa0c8b7 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -399,7 +399,13 @@ var Notification = class Notification { this._scrollArea.set_clip_to_allocation(true); - this.setBodyExpand(false); + let vscroll = this._scrollArea.get_vscroll_bar(); + if (vscroll) { + vscroll.connect('scroll-start', () => { this.emit('scrolling-changed', true) }); + vscroll.connect('scroll-stop', () => { this.emit('scrolling-changed', false) }); + } + + this.setBodyExpand(false, false); this._table.add(this._scrollArea, { row: 1, @@ -453,12 +459,16 @@ var Notification = class Notification { adjustment.value = adjustment.upper; } - setBodyExpand(enabled) { + setBodyExpand(enabled, updateLayout = true) { + this._bodyExpandEnabled = enabled; if (this._scrollArea) { this._scrollArea.vscrollbar_policy = enabled ? St.PolicyType.NEVER : St.PolicyType.AUTOMATIC; this._scrollArea.enable_mouse_scrolling = !enabled; this._table.set_style(`max-height: ${enabled ? 'none' : '300px'};`); } + if (updateLayout) { + this._updateLayout(); + } } _updateLayout() { @@ -468,8 +478,7 @@ var Notification = class Notification { this._table.remove_style_class_name('multi-line-notification'); } - // XXX: check this - if (this._imageBin) { + if (this._imageBin && !this._bodyExpandEnabled) { this._table.add_style_class_name('notification-with-image'); } else { this._table.remove_style_class_name('notification-with-image'); @@ -503,7 +512,8 @@ var Notification = class Notification { x_expand: false, y_expand: false, x_fill: false, - y_fill: false + y_fill: false, + y_align: St.Align.START }); this._updateLayout(); } From 02bb497934cd633d8681326250b2e2084d93ae6c Mon Sep 17 00:00:00 2001 From: anaximeno Date: Tue, 26 May 2026 01:29:02 -0100 Subject: [PATCH 4/4] notification: Increase max-height size to 40em when expand is disabled --- js/ui/messageTray.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index ebcaa0c8b7..22afff4b8e 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -464,7 +464,7 @@ var Notification = class Notification { if (this._scrollArea) { this._scrollArea.vscrollbar_policy = enabled ? St.PolicyType.NEVER : St.PolicyType.AUTOMATIC; this._scrollArea.enable_mouse_scrolling = !enabled; - this._table.set_style(`max-height: ${enabled ? 'none' : '300px'};`); + this._table.set_style(`max-height: ${enabled ? 'none' : '40em'};`); } if (updateLayout) { this._updateLayout();