✨ ags(notifications): more advanced notification body truncating
This commit is contained in:
@@ -23,6 +23,10 @@ export function NotificationWidget(notification: AstalNotifd.Notification|number
|
|||||||
AstalNotifd.get_default().get_notification(notification)
|
AstalNotifd.get_default().get_notification(notification)
|
||||||
: notification;
|
: notification;
|
||||||
|
|
||||||
|
const body: string = notification.body.split(' ').map(strPart =>
|
||||||
|
strPart.length >= 25 ? `${strPart.substring(0, 22)}...`
|
||||||
|
: strPart).join(' ');
|
||||||
|
|
||||||
return new Widget.EventBox({
|
return new Widget.EventBox({
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
if(notification instanceof AstalNotifd.Notification) {
|
if(notification instanceof AstalNotifd.Notification) {
|
||||||
@@ -118,7 +122,7 @@ export function NotificationWidget(notification: AstalNotifd.Notification|number
|
|||||||
xalign: 0,
|
xalign: 0,
|
||||||
truncate: false,
|
truncate: false,
|
||||||
wrap: true,
|
wrap: true,
|
||||||
label: notification.body.replace(/\&/g, "&")
|
label: body.replace(/\&/g, "&")
|
||||||
} as Widget.LabelProps)
|
} as Widget.LabelProps)
|
||||||
]
|
]
|
||||||
} as Widget.BoxProps)
|
} as Widget.BoxProps)
|
||||||
|
|||||||
Reference in New Issue
Block a user