Add the possibility to pass title and the summary to zenity notification
Now you can use zenity --notification --text="Title\nSummary" and it will use the first string before the first escape \n as the title, and the rest of the string as summary text.
This commit is contained in:
parent
99a34fe7e6
commit
d44ca59780
@ -315,6 +315,7 @@ zenity_notification (ZenityData *data, ZenityNotificationData *notification_data
|
|||||||
GError *error;
|
GError *error;
|
||||||
NotifyNotification *notification;
|
NotifyNotification *notification;
|
||||||
GHashTable *notification_hints;
|
GHashTable *notification_hints;
|
||||||
|
gchar **message;
|
||||||
|
|
||||||
/* create the notification widget */
|
/* create the notification widget */
|
||||||
if (!notify_is_initted ()) {
|
if (!notify_is_initted ()) {
|
||||||
@ -328,8 +329,16 @@ zenity_notification (ZenityData *data, ZenityNotificationData *notification_data
|
|||||||
if (notification_data->notification_text == NULL) {
|
if (notification_data->notification_text == NULL) {
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message = g_strsplit (g_strcompress (notification_data->notification_text), "\n", 2);
|
||||||
|
if (*message == NULL) {
|
||||||
|
g_printerr (_("Could not parse message\n"));
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
notification = notify_notification_new (notification_data->notification_text, NULL, data->window_icon);
|
notification = notify_notification_new (message[0], /* title */
|
||||||
|
message[1], /* summary */
|
||||||
|
data->window_icon);
|
||||||
if (notification == NULL) {
|
if (notification == NULL) {
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user