Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Services/Notification.vala
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class Notifications.Notification : Object {
public string sender;
public string[] actions;
public List<Gtk.Button> buttons;
public string category { get; private set; }
public string? default_action { get; private set; default = null; }
public uint32 replaces_id;
public uint32 server_id { get; construct set; default = 0; } // 0 means the notification is outdated i.e. not present in the server anymore
Expand Down Expand Up @@ -143,6 +144,9 @@ public class Notifications.Notification : Object {
}
}

// GLib.Notification.set_category ()
category = lookup_string (hints, "category");

if (app_info == null) {
desktop_id = FALLBACK_DESKTOP_ID;
app_info = new DesktopAppInfo (desktop_id);
Expand Down
9 changes: 8 additions & 1 deletion src/Widgets/NotificationEntry.vala
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public class Notifications.NotificationEntry : Gtk.ListBoxRow {
};
image_overlay.add_overlay (secondary_image);


Icon app_icon = new ThemedIcon ("dialog-information");
if (notification.app_icon.contains ("/")) {
var file = File.new_for_uri (notification.app_icon);
Expand All @@ -81,6 +80,14 @@ public class Notifications.NotificationEntry : Gtk.ListBoxRow {
primary_image.add_css_class (Granite.CssClass.CARD);
primary_image.add_css_class (Granite.CssClass.CHECKERBOARD);
secondary_image.gicon = app_icon;

// Assume this is an avatar
if (notification.category == "im.received" ||
// Hardcoding is evil but this bothers me
notification.app_icon == "com.discordapp.Discord"
) {
primary_image.add_css_class (Granite.CssClass.CIRCULAR);
}
} else {
primary_image.gicon = app_icon;
}
Expand Down
Loading