From 191a66f92ba57ea1d397c4eab17e75b4d5c4447d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 15 Sep 2026 15:01:44 -0700 Subject: [PATCH 1/4] LogView: Show priority --- data/icons/bug-symbolic.svg | 20 ++++++++++ data/icons/icons.indicator.gresource.xml | 1 + src/Views/LogView/LogCell.vala | 3 +- src/Views/LogView/LogView.vala | 19 +++++++++ src/Views/LogView/PriorityCell.vala | 49 ++++++++++++++++++++++++ src/Views/LogView/SystemdLogEntry.vala | 15 ++++++-- src/Views/LogView/SystemdLogModel.vala | 7 +++- src/meson.build | 1 + 8 files changed, 109 insertions(+), 6 deletions(-) create mode 100644 data/icons/bug-symbolic.svg create mode 100644 src/Views/LogView/PriorityCell.vala diff --git a/data/icons/bug-symbolic.svg b/data/icons/bug-symbolic.svg new file mode 100644 index 000000000..f3706fe3d --- /dev/null +++ b/data/icons/bug-symbolic.svg @@ -0,0 +1,20 @@ + + + + diff --git a/data/icons/icons.indicator.gresource.xml b/data/icons/icons.indicator.gresource.xml index a2569a58d..baf66930b 100644 --- a/data/icons/icons.indicator.gresource.xml +++ b/data/icons/icons.indicator.gresource.xml @@ -1,6 +1,7 @@ + bug-symbolic.svg cpu-symbolic.svg gpu-symbolic.svg ram-symbolic.svg diff --git a/src/Views/LogView/LogCell.vala b/src/Views/LogView/LogCell.vala index f2394cd85..a01857048 100644 --- a/src/Views/LogView/LogCell.vala +++ b/src/Views/LogView/LogCell.vala @@ -6,7 +6,8 @@ public class Monitor.LogCell : Granite.Bin { public enum CellType { ORIGIN, - MESSAGE + MESSAGE, + PRIORITY } public CellType cell_type { get; construct; } diff --git a/src/Views/LogView/LogView.vala b/src/Views/LogView/LogView.vala index b5c96a6a1..f707e5200 100644 --- a/src/Views/LogView/LogView.vala +++ b/src/Views/LogView/LogView.vala @@ -28,8 +28,14 @@ public class Monitor.LogView : Granite.Bin { origin_factory.setup.connect (setup_origin); origin_factory.bind.connect (bind); + var priority_factory = new Gtk.SignalListItemFactory (); + priority_factory.setup.connect (setup_priority); + priority_factory.bind.connect (bind_priority); + var origin_column = new Gtk.ColumnViewColumn (_("Sender"), origin_factory); + var priority_column = new Gtk.ColumnViewColumn (null, priority_factory); + var message_factory = new Gtk.SignalListItemFactory (); message_factory.setup.connect (setup_message); message_factory.bind.connect (bind); @@ -44,6 +50,7 @@ public class Monitor.LogView : Granite.Bin { vexpand = true }; column_view.append_column (origin_column); + column_view.append_column (priority_column); column_view.append_column (message_column); var scrolled = new Gtk.ScrolledWindow () { @@ -82,6 +89,18 @@ public class Monitor.LogView : Granite.Bin { item.child = new LogCell (MESSAGE); } + private void setup_priority (Object obj) { + var item = (Gtk.ListItem) obj; + item.child = new PriorityCell (); + } + + private void bind_priority (Object obj) { + var item = (Gtk.ListItem) obj; + var entry = (SystemdLogEntry) item.item; + var cell = (PriorityCell) item.child; + cell.bind (entry); + } + private void bind (Object obj) { var item = (Gtk.ListItem) obj; var entry = (SystemdLogEntry) item.item; diff --git a/src/Views/LogView/PriorityCell.vala b/src/Views/LogView/PriorityCell.vala new file mode 100644 index 000000000..d583db704 --- /dev/null +++ b/src/Views/LogView/PriorityCell.vala @@ -0,0 +1,49 @@ +/* + * SPDX-License-Identifier: GPL-3.0-or-later + * SPDX-FileCopyrightText: 2026 elementary, Inc. (https://elementary.io) + */ + +public class Monitor.PriorityCell : Granite.Bin { + private Gtk.Image image; + + construct { + image = new Gtk.Image (); + + child = image; + } + + public void bind (SystemdLogEntry entry) { + switch (entry.priority) { + case INFO: + image.icon_name = "dialog-information-symbolic"; + image.tooltip_text = _("Information"); + image.css_classes = {"accent", "blue"}; + break; + case DEBUG: + image.icon_name = "bug-symbolic"; + image.tooltip_text = _("Debug"); + image.css_classes = {"accent", "purple"}; + break; + case ALERT: + case NOTICE: + image.icon_name = "mail-important-symbolic"; + image.tooltip_text = _("Attention"); + image.css_classes = {"accent", "yellow"}; + break; + case WARNING: + image.icon_name = "dialog-warning-symbolic"; + image.tooltip_text = _("Warning"); + break; + case ERR: + image.icon_name = "process-error-symbolic"; + image.tooltip_text = _("Error"); + break; + case CRIT: + case EMERG: + image.icon_name = "alarm-symbolic"; + image.tooltip_text = _("Emergency"); + image.css_classes = {"error"}; + break; + } + } +} diff --git a/src/Views/LogView/SystemdLogEntry.vala b/src/Views/LogView/SystemdLogEntry.vala index 5beb2d913..f821f32b7 100644 --- a/src/Views/LogView/SystemdLogEntry.vala +++ b/src/Views/LogView/SystemdLogEntry.vala @@ -7,17 +7,24 @@ public string origin { get; construct; } public string message { get; construct; } public DateTime dt { get; construct; } - public string relative_time { get; construct; } + public Systemd.Journal.Priority priority { get; construct; } + public string relative_time { get; private set; } public uint section_start { get; set; } - public SystemdLogEntry (string origin, string message, DateTime time) { + public SystemdLogEntry (string origin, string message, DateTime time, Systemd.Journal.Priority priority) { Object ( - origin: origin, message: message, dt: time, - relative_time: format_time (time) + origin: origin, + message: message, + dt: time, + priority: priority ); } + construct { + relative_time = format_time (dt); + } + public bool matches (string term) { return origin.contains (term) || message.contains (term); } diff --git a/src/Views/LogView/SystemdLogModel.vala b/src/Views/LogView/SystemdLogModel.vala index 4225466a8..9e5e6fbea 100644 --- a/src/Views/LogView/SystemdLogModel.vala +++ b/src/Views/LogView/SystemdLogModel.vala @@ -135,6 +135,8 @@ public class Monitor.SystemdLogModel : GLib.Object, GLib.ListModel, Gtk.SectionM unowned uint8[] data; unowned uint8[] comm_data; + unowned uint8[] priority_data; + res = journal.get_data ("MESSAGE", out data); if (res != 0) { critical ("Failed to get message: %s", strerror (-res)); @@ -146,8 +148,11 @@ public class Monitor.SystemdLogModel : GLib.Object, GLib.ListModel, Gtk.SectionM comm_data = "_COMM=kernel".data; } + res = journal.get_data ("PRIORITY", out priority_data); + var origin = ((string) comm_data).offset ("_COMM=".length); var message = ((string) data).offset ("MESSAGE=".length); + var priority = ((string) priority_data).offset ("PRIORITY=".length); uint64 time; res = journal.get_realtime_usec (out time); @@ -158,7 +163,7 @@ public class Monitor.SystemdLogModel : GLib.Object, GLib.ListModel, Gtk.SectionM var dt = new DateTime.from_unix_utc ((int64) (time / TimeSpan.SECOND)); - var entry = new SystemdLogEntry (origin, message, dt); + var entry = new SystemdLogEntry (origin, message, dt, (Systemd.Journal.Priority) priority.to_int ()); // Filter if we're searching. We drop them and don't add them and use a filter model // because when searching for e.g. a non existent term this would fill up memory *quick* diff --git a/src/meson.build b/src/meson.build index 6bfc3d36d..beb0ad176 100644 --- a/src/meson.build +++ b/src/meson.build @@ -21,6 +21,7 @@ source_app_files = [ 'Views/SystemView/SystemGPUView.vala', 'Views/LogView/LogCell.vala', + 'Views/LogView/PriorityCell.vala', 'Views/LogView/LogView.vala', 'Views/LogView/SystemdLogEntry.vala', 'Views/LogView/SystemdLogModel.vala', From 3aff41bb991955cc8e5004aa0bbca8693f95eb6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 15 Sep 2026 15:19:50 -0700 Subject: [PATCH 2/4] Way nicer info icon --- data/icons/icons.indicator.gresource.xml | 1 + data/icons/process-information-symbolic.svg | 15 +++++++++++++++ src/Views/LogView/PriorityCell.vala | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 data/icons/process-information-symbolic.svg diff --git a/data/icons/icons.indicator.gresource.xml b/data/icons/icons.indicator.gresource.xml index baf66930b..d686cf045 100644 --- a/data/icons/icons.indicator.gresource.xml +++ b/data/icons/icons.indicator.gresource.xml @@ -10,6 +10,7 @@ file-deleted-symbolic.svg temperature-sensor-symbolic.svg temperature-gpu-symbolic.svg + process-information-symbolic.svg extra/16/bash.svg extra/48/bash.svg extra/64/bash.svg diff --git a/data/icons/process-information-symbolic.svg b/data/icons/process-information-symbolic.svg new file mode 100644 index 000000000..6408398e7 --- /dev/null +++ b/data/icons/process-information-symbolic.svg @@ -0,0 +1,15 @@ + + + + + diff --git a/src/Views/LogView/PriorityCell.vala b/src/Views/LogView/PriorityCell.vala index d583db704..2ea304597 100644 --- a/src/Views/LogView/PriorityCell.vala +++ b/src/Views/LogView/PriorityCell.vala @@ -15,7 +15,7 @@ public class Monitor.PriorityCell : Granite.Bin { public void bind (SystemdLogEntry entry) { switch (entry.priority) { case INFO: - image.icon_name = "dialog-information-symbolic"; + image.icon_name = "process-information-symbolic"; image.tooltip_text = _("Information"); image.css_classes = {"accent", "blue"}; break; From 0b410422fca495ea5e3539907834dc5814cc0526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 15 Sep 2026 15:35:03 -0700 Subject: [PATCH 3/4] Separate notice and alert --- data/icons/icons.indicator.gresource.xml | 1 + data/icons/process-attention-symbolic.svg | 31 +++++++++++++++++++++++ src/Views/LogView/PriorityCell.vala | 10 +++++--- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 data/icons/process-attention-symbolic.svg diff --git a/data/icons/icons.indicator.gresource.xml b/data/icons/icons.indicator.gresource.xml index d686cf045..2f058d8e7 100644 --- a/data/icons/icons.indicator.gresource.xml +++ b/data/icons/icons.indicator.gresource.xml @@ -10,6 +10,7 @@ file-deleted-symbolic.svg temperature-sensor-symbolic.svg temperature-gpu-symbolic.svg + process-attention-symbolic.svg process-information-symbolic.svg extra/16/bash.svg extra/48/bash.svg diff --git a/data/icons/process-attention-symbolic.svg b/data/icons/process-attention-symbolic.svg new file mode 100644 index 000000000..d69e09200 --- /dev/null +++ b/data/icons/process-attention-symbolic.svg @@ -0,0 +1,31 @@ + + + + diff --git a/src/Views/LogView/PriorityCell.vala b/src/Views/LogView/PriorityCell.vala index 2ea304597..fa75a759b 100644 --- a/src/Views/LogView/PriorityCell.vala +++ b/src/Views/LogView/PriorityCell.vala @@ -24,10 +24,14 @@ public class Monitor.PriorityCell : Granite.Bin { image.tooltip_text = _("Debug"); image.css_classes = {"accent", "purple"}; break; - case ALERT: case NOTICE: - image.icon_name = "mail-important-symbolic"; - image.tooltip_text = _("Attention"); + image.icon_name = "process-attention-symbolic"; + image.tooltip_text = _("Notice"); + image.css_classes = {"accent", "purple"}; + break; + case ALERT: + image.icon_name = "process-attention-symbolic"; + image.tooltip_text = _("Alert"); image.css_classes = {"accent", "yellow"}; break; case WARNING: From be1527c1f11f96cea58e3edaf21513b55af276d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 15 Sep 2026 16:20:40 -0700 Subject: [PATCH 4/4] Add critical icon --- data/icons/icons.indicator.gresource.xml | 1 + data/icons/process-critical-symbolic.svg | 21 +++++++++++++++ data/icons/process-information-symbolic.svg | 29 ++++++++++++--------- src/Views/LogView/PriorityCell.vala | 9 +++---- 4 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 data/icons/process-critical-symbolic.svg diff --git a/data/icons/icons.indicator.gresource.xml b/data/icons/icons.indicator.gresource.xml index 2f058d8e7..ad678d28b 100644 --- a/data/icons/icons.indicator.gresource.xml +++ b/data/icons/icons.indicator.gresource.xml @@ -11,6 +11,7 @@ temperature-sensor-symbolic.svg temperature-gpu-symbolic.svg process-attention-symbolic.svg + process-critical-symbolic.svg process-information-symbolic.svg extra/16/bash.svg extra/48/bash.svg diff --git a/data/icons/process-critical-symbolic.svg b/data/icons/process-critical-symbolic.svg new file mode 100644 index 000000000..9f80452b2 --- /dev/null +++ b/data/icons/process-critical-symbolic.svg @@ -0,0 +1,21 @@ + + + + diff --git a/data/icons/process-information-symbolic.svg b/data/icons/process-information-symbolic.svg index 6408398e7..d59c28e8d 100644 --- a/data/icons/process-information-symbolic.svg +++ b/data/icons/process-information-symbolic.svg @@ -1,15 +1,20 @@ - - + xmlns='http://www.w3.org/2000/svg' + xmlns:svg='http://www.w3.org/2000/svg' + xmlns:gpa='https://www.gtk.org/grappa' + gpa:version='1' + gpa:state='0' + id='svg1' + width='16' + height='16'> + id='path4' + class='' + fill='url(#gpa:accent) rgb(0,34,255)' + fill-opacity='1' + fill-rule='nonzero' + d='M 8 0 A 8 8 0 0 0 0 8 A 8 8 0 0 0 8 16 A 8 8 0 0 0 16 8 A 8 8 0 0 0 8 0 Z M 9 2.25 A 1.25 1.25 0 0 1 10.25 3.5 A 1.25 1.25 0 0 1 9 4.75 A 1.25 1.25 0 0 1 7.75 3.5 A 1.25 1.25 0 0 1 9 2.25 Z M 8.21289 6 A 1.1209 1.43562 52.0181 0 1 9.1875 7.25 L 7.99219 12.0312 A 0.220101 0.2819 52.0181 0 0 8.35156 12.2246 L 9.16016 11.7148 A 0.393039 0.503395 52.0181 0 1 9.72266 11.7227 L 9.77734 11.7773 A 0.289503 0.370789 52.0181 0 1 9.68555 12.252 L 8.17188 13.4629 A 1.52733 1.95616 52.0181 0 1 6.78711 14 A 1.1209 1.43562 52.0181 0 1 5.8125 12.75 L 7.00781 7.96875 A 0.220101 0.2819 52.0181 0 0 6.64844 7.77539 L 5.83789 8.28516 A 0.393039 0.503395 52.0181 0 1 5.27734 8.27734 L 5.22266 8.22266 A 0.289503 0.370789 52.0181 0 1 5.31445 7.74805 L 6.82812 6.53711 A 1.52733 1.95616 52.0181 0 1 8.21289 6 Z' + gpa:animation-repeat='0' + gpa:animation-segment='0'> + diff --git a/src/Views/LogView/PriorityCell.vala b/src/Views/LogView/PriorityCell.vala index fa75a759b..4cb64a3cc 100644 --- a/src/Views/LogView/PriorityCell.vala +++ b/src/Views/LogView/PriorityCell.vala @@ -26,12 +26,12 @@ public class Monitor.PriorityCell : Granite.Bin { break; case NOTICE: image.icon_name = "process-attention-symbolic"; - image.tooltip_text = _("Notice"); + image.tooltip_text = _("Message"); image.css_classes = {"accent", "purple"}; break; case ALERT: image.icon_name = "process-attention-symbolic"; - image.tooltip_text = _("Alert"); + image.tooltip_text = _("Alert"); image.css_classes = {"accent", "yellow"}; break; case WARNING: @@ -44,9 +44,8 @@ public class Monitor.PriorityCell : Granite.Bin { break; case CRIT: case EMERG: - image.icon_name = "alarm-symbolic"; - image.tooltip_text = _("Emergency"); - image.css_classes = {"error"}; + image.icon_name = "process-critical-symbolic"; + image.tooltip_text = _("Critical"); break; } }