diff --git a/data/com.github.stsdc.monitor.appdata.xml.in b/data/com.github.stsdc.monitor.appdata.xml.in index c2c49120..24855d86 100644 --- a/data/com.github.stsdc.monitor.appdata.xml.in +++ b/data/com.github.stsdc.monitor.appdata.xml.in @@ -28,6 +28,17 @@ https://github.com/stsdc/monitor/issues + +​ +​
    +
  • Update Portuguese translation (@rottenpants466)
  • +
  • Update Dutch translation (@Vistaus)
  • +
  • Smoother animations (@DevAlien)
  • +
  • Preselect first entry so that the info panel is always open (@DevAlien)
  • +
  • Show CPU temperature in the Indicator
  • +
+​
+​
    diff --git a/data/icons/icons.indicator.gresource.xml b/data/icons/icons.indicator.gresource.xml index 8f863b06..9ba3791a 100644 --- a/data/icons/icons.indicator.gresource.xml +++ b/data/icons/icons.indicator.gresource.xml @@ -5,5 +5,6 @@ ram-symbolic.svg swap-symbolic.svg file-deleted-symbolic.svg + temperature-sensor-symbolic.svg \ No newline at end of file diff --git a/data/icons/temperature-sensor-symbolic.svg b/data/icons/temperature-sensor-symbolic.svg new file mode 100644 index 00000000..acf316a2 --- /dev/null +++ b/data/icons/temperature-sensor-symbolic.svg @@ -0,0 +1,58 @@ + + + + + + image/svg+xml + + + + + + + + + + diff --git a/meson.build b/meson.build index fb04f056..42489952 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('com.github.stsdc.monitor', 'vala', 'c', version: '0.9.0') +project('com.github.stsdc.monitor', 'vala', 'c', version: '0.9.1') # these are Meson modules gnome = import('gnome') @@ -88,7 +88,6 @@ executable( 'src/Widgets/Labels/LabelH4.vala', 'src/Widgets/Chart/Chart.vala', 'src/Widgets/Chart/ProcessChart.vala', - 'src/Widgets/Chart/NetworkChart.vala', # Models @@ -144,6 +143,7 @@ shared_module( 'src/Indicator/Widgets/DisplayWidget.vala', 'src/Indicator/Widgets/PopoverWidget.vala', 'src/Indicator/Widgets/IndicatorWidget.vala', + 'src/Indicator/Widgets/TemperatureWidget.vala', 'src/Indicator/Services/DBusClient.vala', # 'src/Widgets/RevealerSwitch.vala', diff --git a/po/nl.po b/po/nl.po index 94259a18..2307ef3a 100644 --- a/po/nl.po +++ b/po/nl.po @@ -3,14 +3,14 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-04-28 22:18+0400\n" -"PO-Revision-Date: 2019-03-25 17:22+0100\n" +"PO-Revision-Date: 2020-08-22 19:23+0200\n" "Last-Translator: Heimen Stoffels \n" "Language-Team: \n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.1.1\n" +"X-Generator: Poedit 2.4.1\n" #: src/Utils.vala:13 #: src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala:32 @@ -22,11 +22,11 @@ msgstr "" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala:34 #: src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala:35 msgid "N/A" -msgstr "" +msgstr "n/b" #: src/Utils.vala:45 msgid "B" -msgstr "" +msgstr "B" #: src/Utils.vala:50 #: src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala:113 @@ -48,19 +48,19 @@ msgstr "Monitor afsluiten" #: src/Views/ProcessView/ProcessInfoView/OpenFilesListBox.vala:56 msgid "Deleted" -msgstr "" +msgstr "Verwijderd" #: src/Views/ProcessView/ProcessInfoView/Preventor.vala:21 msgid "Are you sure you want to do this?" -msgstr "" +msgstr "Weet je zeker dat je dit wilt doen?" #: src/Views/ProcessView/ProcessInfoView/Preventor.vala:24 msgid "Yes" -msgstr "" +msgstr "Ja" #: src/Views/ProcessView/ProcessInfoView/Preventor.vala:28 msgid "No" -msgstr "" +msgstr "Nee" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala:39 #: src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala:59 @@ -69,62 +69,59 @@ msgstr "PID" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala:40 msgid "NI" -msgstr "" +msgstr "NI" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala:41 -#, fuzzy msgid "PRI" -msgstr "PID" +msgstr "PRI" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoHeader.vala:42 msgid "THR" -msgstr "" +msgstr "THR" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala:18 msgid "Opened files" -msgstr "" +msgstr "Geopende bestanden" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala:22 msgid "Characters" -msgstr "" +msgstr "Tekens" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala:27 msgid "System calls" -msgstr "" +msgstr "Systeemaanroepen" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala:32 msgid "Read/Written" -msgstr "" +msgstr "Uitgelezen/Weggeschreven" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoIOStats.vala:37 msgid "Cancelled write" -msgstr "" +msgstr "Wegschrijven afgebroken" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala:79 -#, fuzzy msgid "End Process" msgstr "Proces beëindigen" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala:81 -#, fuzzy msgid "End selected process" -msgstr "Proces beëindigen" +msgstr "Geselecteerd proces beëindigen" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala:85 msgid "Kill Process" -msgstr "" +msgstr "Proces vernietigen" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala:86 msgid "Kill selected process" -msgstr "" +msgstr "Geselecteerd proces vernietigen" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala:96 msgid "Confirm kill of the process?" -msgstr "" +msgstr "Weet je het zeker?" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala:103 msgid "Confirm end of the process?" -msgstr "" +msgstr "Weet je het zeker?" #. setup name column #: src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala:17 @@ -134,7 +131,7 @@ msgstr "Procesnaam" #: src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala:38 #: src/Widgets/Statusbar/Statusbar.vala:8 msgid "CPU" -msgstr "Processor" +msgstr "CPU" #: src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala:49 #: src/Widgets/Statusbar/Statusbar.vala:11 @@ -150,12 +147,12 @@ msgstr "GiB" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala:50 #, c-format msgid "CPU: %.1f%%" -msgstr "" +msgstr "CPU: %.1f%%" #: src/Views/ProcessView/ProcessInfoView/ProcessInfoCPURAM.vala:51 #, c-format msgid "RAM: %.1f%%" -msgstr "" +msgstr "RAM: %.1f%%" #: src/Widgets/Headerbar/Headerbar.vala:13 msgid "Monitor" @@ -166,36 +163,34 @@ msgid "Settings" msgstr "Instellingen" #: src/Widgets/Headerbar/Headerbar.vala:35 -#, fuzzy msgid "Show an indicator:" -msgstr "Indicator tonen" +msgstr "Indicator tonen:" #: src/Widgets/Headerbar/Headerbar.vala:41 msgid "Start in background:" -msgstr "" +msgstr "Geminimaliseerd opstarten:" #: src/Widgets/Headerbar/Search.vala:14 msgid "Search Process" -msgstr "Zoek een proces" +msgstr "Zoeken naar proces" #: src/Widgets/Headerbar/Search.vala:15 -#, fuzzy msgid "Type process name or PID to search" msgstr "Voer de procesnaam of PID in" #: src/Widgets/Statusbar/Statusbar.vala:14 msgid "Swap" -msgstr "" +msgstr "Wisselgeheugen" #: src/Widgets/Statusbar/Statusbar.vala:16 #: src/Widgets/Statusbar/Statusbar.vala:20 #: src/Widgets/Statusbar/Statusbar.vala:25 msgid "Calculating…" -msgstr "" +msgstr "Bezig met berekenen…" #: src/Widgets/Statusbar/Statusbar.vala:38 msgid "GHz" -msgstr "" +msgstr "GHz" #~ msgid "Monitor Indicator" #~ msgstr "Monitor-indicator" diff --git a/src/Indicator/Indicator.vala b/src/Indicator/Indicator.vala index a6add5c0..e75b82d8 100644 --- a/src/Indicator/Indicator.vala +++ b/src/Indicator/Indicator.vala @@ -22,6 +22,7 @@ public class Monitor.Indicator : Wingpanel.Indicator { dbusclient.interface.update.connect ((sysres) => { display_widget.cpu_widget.percentage = sysres.cpu_percentage; + display_widget.temperature_widget.degree = sysres.cpu_temperature; display_widget.memory_widget.percentage = sysres.memory_percentage; }); diff --git a/src/Indicator/Widgets/DisplayWidget.vala b/src/Indicator/Widgets/DisplayWidget.vala index d43351b0..2d9729cf 100644 --- a/src/Indicator/Widgets/DisplayWidget.vala +++ b/src/Indicator/Widgets/DisplayWidget.vala @@ -2,6 +2,8 @@ public class Monitor.Widgets.DisplayWidget : Gtk.Grid { public IndicatorWidget cpu_widget; public IndicatorWidget memory_widget; + public TemperatureWidget temperature_widget; + construct { valign = Gtk.Align.CENTER; @@ -9,7 +11,11 @@ public class Monitor.Widgets.DisplayWidget : Gtk.Grid { memory_widget = new IndicatorWidget ("ram-symbolic"); + temperature_widget = new TemperatureWidget ("temperature-sensor-symbolic"); + + add (cpu_widget); add (memory_widget); + add (temperature_widget); } } diff --git a/src/Indicator/Widgets/TemperatureWidget.vala b/src/Indicator/Widgets/TemperatureWidget.vala new file mode 100644 index 00000000..fe883dc2 --- /dev/null +++ b/src/Indicator/Widgets/TemperatureWidget.vala @@ -0,0 +1,25 @@ +public class Monitor.Widgets.TemperatureWidget : Gtk.Box { + private Gtk.Label degree_label; + + public string icon_name { get; construct; } + public double degree { + set { degree_label.label = "%d℃".printf ((int)Math.round (value)); } + } + + public TemperatureWidget (string icon_name) { + Object ( + orientation: Gtk.Orientation.HORIZONTAL, + icon_name: icon_name + ); + } + + construct { + var icon = new Gtk.Image.from_icon_name (icon_name, Gtk.IconSize.SMALL_TOOLBAR); + + degree_label = new Gtk.Label (Utils.NOT_AVAILABLE); + degree_label.margin = 2; + + pack_start (icon); + pack_start (degree_label); + } +} diff --git a/src/MainWindow.vala b/src/MainWindow.vala index f36441ac..37a48110 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -1,125 +1,133 @@ - public class Monitor.MainWindow : Gtk.Window { - // application reference - private Shortcuts shortcuts; +public class Monitor.MainWindow : Gtk.Window { + // application reference + private Shortcuts shortcuts; - private Resources resources; + private Resources resources; - // Widgets - public Headerbar headerbar; - // private Gtk.Button process_info_button; + // Widgets + public Headerbar headerbar; - public ProcessView process_view; - public SystemView system_view; - private Gtk.Stack stack; + public ProcessView process_view; + public SystemView system_view; + private Gtk.Stack stack; - private Statusbar statusbar; + private Statusbar statusbar; - public DBusServer dbusserver; + public DBusServer dbusserver; - // Constructs a main window - public MainWindow (MonitorApp app) { - this.set_application (app); + // Constructs a main window + public MainWindow (MonitorApp app) { + this.set_application (app); - setup_window_state (); + setup_window_state (); - get_style_context ().add_class ("rounded"); + get_style_context ().add_class ("rounded"); - resources = new Resources (); + resources = new Resources (); - process_view = new ProcessView (); - system_view = new SystemView (resources); + process_view = new ProcessView (); + system_view = new SystemView (resources); - stack = new Gtk.Stack (); - stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT); - stack.add_titled (process_view, "process_view", _("Processes")); - stack.add_titled (system_view, "system_view", _("System")); + stack = new Gtk.Stack (); + stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT); + stack.add_titled (process_view, "process_view", _ ("Processes")); + stack.add_titled (system_view, "system_view", _ ("System")); - Gtk.StackSwitcher stack_switcher = new Gtk.StackSwitcher (); - stack_switcher.set_stack(stack); + Gtk.StackSwitcher stack_switcher = new Gtk.StackSwitcher (); + stack_switcher.set_stack (stack); - headerbar = new Headerbar (this); - headerbar.set_custom_title (stack_switcher); - set_titlebar (headerbar); + headerbar = new Headerbar (this); + headerbar.set_custom_title (stack_switcher); + set_titlebar (headerbar); - statusbar = new Statusbar (); + statusbar = new Statusbar (); - var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); - main_box.pack_start (stack, true, true, 0); - main_box.pack_start (statusbar, false, true, 0); - this.add (main_box); + var main_box = new Gtk.Box (Gtk.Orientation.VERTICAL, 0); + main_box.pack_start (stack, true, true, 0); + main_box.pack_start (statusbar, false, true, 0); + this.add (main_box); - show_all (); + show_all (); - dbusserver = DBusServer.get_default (); - - stack.notify["visible-child-name"].connect (() => { - headerbar.search.sensitive = stack.visible_child_name == "process_view"; - }); + dbusserver = DBusServer.get_default (); + + stack.notify["visible-child-name"].connect (() => { + headerbar.search.sensitive = stack.visible_child_name == "process_view"; + }); - Timeout.add_seconds (2, () => { - resources.update(); + Timeout.add_seconds (2, () => { + new Thread ("resource-updates", () => { + resources.update (); var res = resources.serialize (); statusbar.update (res); dbusserver.update (res); - process_view.update(); - system_view.update(); - dbusserver.indicator_state (MonitorApp.settings.get_boolean ("indicator-state")); - return true; - }); - - dbusserver.quit.connect (() => app.quit()); - dbusserver.show.connect (() => { - this.deiconify (); - this.present (); - setup_window_state (); - this.show_all (); + Idle.add (() => { + process_view.update (); + system_view.update (); + dbusserver.indicator_state (MonitorApp.settings.get_boolean ("indicator-state")); + return false; + }); + return true; }); + return true; + }); - shortcuts = new Shortcuts (this); - key_press_event.connect ((e) => shortcuts.handle (e)); - this.delete_event.connect (() => { - int window_width, window_height, position_x, position_y; - get_size (out window_width, out window_height); - get_position (out position_x, out position_y); - MonitorApp.settings.set_int ("window-width", window_width); - MonitorApp.settings.set_int ("window-height", window_height); - MonitorApp.settings.set_int ("position-x", position_x); - MonitorApp.settings.set_int ("position-y", position_y); - MonitorApp.settings.set_boolean ("is-maximized", this.is_maximized); + dbusserver.quit.connect (() => app.quit ()); + dbusserver.show.connect (() => { + this.deiconify (); + this.present (); + setup_window_state (); + this.show_all (); + }); + + shortcuts = new Shortcuts (this); + key_press_event.connect ((e) => shortcuts.handle (e)); + + this.delete_event.connect (() => { + int window_width, window_height, position_x, position_y; + get_size (out window_width, out window_height); + get_position (out position_x, out position_y); + MonitorApp.settings.set_int ("window-width", window_width); + MonitorApp.settings.set_int ("window-height", window_height); + MonitorApp.settings.set_int ("position-x", position_x); + MonitorApp.settings.set_int ("position-y", position_y); + MonitorApp.settings.set_boolean ("is-maximized", this.is_maximized); + + MonitorApp.settings.set_string ("opened-view", stack.visible_child_name); + + if (MonitorApp.settings.get_boolean ("indicator-state")) { + this.hide_on_delete (); + } else { + dbusserver.indicator_state (false); + app.quit (); + } - MonitorApp.settings.set_string ("opened-view", stack.visible_child_name); + return true; + }); - if (MonitorApp.settings.get_boolean ("indicator-state")) { - this.hide_on_delete (); - } else { - dbusserver.indicator_state (false); - app.quit (); - } + dbusserver.indicator_state (MonitorApp.settings.get_boolean ("indicator-state")); + stack.visible_child_name = MonitorApp.settings.get_string ("opened-view"); + } - return true; - }); + private void setup_window_state () { + int window_width = MonitorApp.settings.get_int ("window-width"); + int window_height = MonitorApp.settings.get_int ("window-height"); + this.set_default_size (window_width, window_height); - dbusserver.indicator_state (MonitorApp.settings.get_boolean ("indicator-state")); - stack.visible_child_name = MonitorApp.settings.get_string ("opened-view"); + if (MonitorApp.settings.get_boolean ("is-maximized")) { + this.maximize (); } - private void setup_window_state () { - int window_width = MonitorApp.settings.get_int ("window-width"); - int window_height = MonitorApp.settings.get_int ("window-height"); - this.set_default_size (window_width, window_height); - - if (MonitorApp.settings.get_boolean ("is-maximized")) { this.maximize (); } - - int position_x = MonitorApp.settings.get_int ("position-x"); - int position_y = MonitorApp.settings.get_int ("position-y"); - if (position_x == -1 || position_y == -1) { - // -1 is default value of these keys, which means this is the first launch - this.window_position = Gtk.WindowPosition.CENTER; - } else { - move (position_x, position_y); - } + int position_x = MonitorApp.settings.get_int ("position-x"); + int position_y = MonitorApp.settings.get_int ("position-y"); + if (position_x == -1 || position_y == -1) { + // -1 is default value of these keys, which means this is the first launch + this.window_position = Gtk.WindowPosition.CENTER; + } else { + move (position_x, position_y); } } +} diff --git a/src/Models/TreeViewModel.vala b/src/Models/TreeViewModel.vala index 665211b4..d298dcad 100644 --- a/src/Models/TreeViewModel.vala +++ b/src/Models/TreeViewModel.vala @@ -9,6 +9,7 @@ public enum Monitor.Column { public class Monitor.TreeViewModel : Gtk.TreeStore { public ProcessManager process_manager; private Gee.Map process_rows; + public signal void added_first_row (); construct { process_rows = new Gee.HashMap (); @@ -55,7 +56,9 @@ public class Monitor.TreeViewModel : Gtk.TreeStore { Column.ICON, process.icon.to_string (), Column.PID, process.stat.pid, -1); - + if (process_rows.size < 1) { + added_first_row (); + } // add the process to our cache of process_rows process_rows.set (process.stat.pid, iter); return true; diff --git a/src/Resources/Resources.vala b/src/Resources/Resources.vala index 04f2b898..ed72eb51 100644 --- a/src/Resources/Resources.vala +++ b/src/Resources/Resources.vala @@ -19,6 +19,7 @@ public class Monitor.Resources : Object { return ResourcesSerialized () { cpu_percentage = cpu.percentage, cpu_frequency = cpu.frequency, + cpu_temperature = cpu.temperature, memory_percentage = memory.percentage, memory_used = memory.used, memory_total = memory.total, diff --git a/src/Resources/ResourcesSerialized.vala b/src/Resources/ResourcesSerialized.vala index 019f5382..9785b9b6 100644 --- a/src/Resources/ResourcesSerialized.vala +++ b/src/Resources/ResourcesSerialized.vala @@ -1,6 +1,7 @@ public struct ResourcesSerialized { public int cpu_percentage; public double cpu_frequency; + public double cpu_temperature; public int memory_percentage; public double memory_used; public double memory_total; diff --git a/src/Resources/TemperatureSensor.vala b/src/Resources/TemperatureSensor.vala index b64a8e20..bb8136bb 100644 --- a/src/Resources/TemperatureSensor.vala +++ b/src/Resources/TemperatureSensor.vala @@ -26,45 +26,53 @@ class TemperatureSensor : Object { private void traverser () { - Dir hwmon_dir = Dir.open (hwmon_path, 0); + try { + Dir hwmon_dir = Dir.open (hwmon_path, 0); + + string ? hwmonx = null; + while ((hwmonx = hwmon_dir.read_name ()) != null) { + string hwmonx_name = Path.build_filename (hwmon_path, hwmonx, "name"); - string ? hwmonx = null; - while ((hwmonx = hwmon_dir.read_name ()) != null) { - string hwmonx_name = Path.build_filename (hwmon_path, hwmonx, "name"); - string sensor_location = open_file (hwmonx_name); + string sensor_name = open_file (hwmonx_name); - if (sensor_location == "coretemp" || sensor_location == "k10temp") { - debug ("Found temp. sensor: %s", sensor_location); + // thank u, next + if (sensor_name == "") { continue; } - Dir hwmonx_dir = Dir.open (Path.build_filename (hwmon_path, hwmonx), 0); - string ? hwmonx_prop = null; - while ((hwmonx_prop = hwmonx_dir.read_name ()) != null) { - // debug (open_file (hwmonx_name)); + if (sensor_name == "coretemp" || sensor_name == "k10temp") { + debug ("Found temp. sensor: %s", sensor_name); - if (hwmonx_prop.contains ("temp")) { - // AMD stuff - // Tdie contains true temperature value, while Tctl contains value for fans - // Tctl = Tdie + offset in some processors - if ("Tdie" == open_file (Path.build_filename (hwmon_path, hwmonx, hwmonx_prop))) { - string tempx_input = "temp%c_input".printf(hwmonx_prop[4]); - cpu_temp_paths.add (Path.build_filename (hwmon_path, hwmonx, tempx_input)); - - debug (open_file (cpu_temp_paths[0])); + Dir hwmonx_dir = Dir.open (Path.build_filename (hwmon_path, hwmonx), 0); + string ? hwmonx_prop = null; + while ((hwmonx_prop = hwmonx_dir.read_name ()) != null) { + // debug (open_file (hwmonx_name)); - // Intel stuff - // Intel reports per core - } else if (open_file (Path.build_filename (hwmon_path, hwmonx, hwmonx_prop)).contains ("Core")) { - string tempx_input = "temp%c_input".printf(hwmonx_prop[4]); - cpu_temp_paths.add (Path.build_filename (hwmon_path, hwmonx, tempx_input)); - debug (open_file (cpu_temp_paths[0])); + if (hwmonx_prop.contains ("temp")) { + // AMD stuff + // Tdie contains true temperature value, while Tctl contains value for fans + // Tctl = Tdie + offset in some processors + if ("Tdie" == open_file (Path.build_filename (hwmon_path, hwmonx, hwmonx_prop))) { + string tempx_input = "temp%c_input".printf(hwmonx_prop[4]); + cpu_temp_paths.add (Path.build_filename (hwmon_path, hwmonx, tempx_input)); + + debug (open_file (cpu_temp_paths[0])); + + // Intel stuff + // Intel reports per core + } else if (open_file (Path.build_filename (hwmon_path, hwmonx, hwmonx_prop)).contains ("Core")) { + string tempx_input = "temp%c_input".printf(hwmonx_prop[4]); + cpu_temp_paths.add (Path.build_filename (hwmon_path, hwmonx, tempx_input)); + debug (open_file (cpu_temp_paths[0])); + } } } + } else if (sensor_name == "amdgpu" ) { + debug ("Found temp. sensor: %s", sensor_name); + } else { + debug ("Found temp. sensor: %s", sensor_name); } - } else if (sensor_location == "amdgpu" ) { - debug ("Found temp. sensor: %s", sensor_location); - } else { - debug ("Found temp. sensor: %s", sensor_location); } + } catch (FileError e) { + warning (@"Could not open dir: %s", e.message); } } @@ -74,8 +82,8 @@ class TemperatureSensor : Object { FileUtils.get_contents (filename, out read); return read.replace ("\n",""); } catch (FileError e) { - error ("%s\n", e.message); - return "0"; + warning ("%s", e.message); + return ""; } } } \ No newline at end of file diff --git a/src/Views/ProcessView/ProcessInfoView/Preventor.vala b/src/Views/ProcessView/ProcessInfoView/Preventor.vala index df5e80bc..7979eff8 100644 --- a/src/Views/ProcessView/ProcessInfoView/Preventor.vala +++ b/src/Views/ProcessView/ProcessInfoView/Preventor.vala @@ -10,7 +10,6 @@ public class Monitor.Preventor : Gtk.Stack { public signal void confirmed (bool is_confirmed); construct { - vexpand = true; valign = Gtk.Align.END; preventive_action_bar = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); diff --git a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala index c0163bd7..cbfff8d8 100644 --- a/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala +++ b/src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala @@ -66,6 +66,7 @@ public class Monitor.ProcessInfoView : Gtk.Box { var process_action_bar = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); + process_action_bar.margin_top = 12; process_action_bar.valign = Gtk.Align.END; process_action_bar.halign = Gtk.Align.END; diff --git a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala index 31ae9d01..6c650b4d 100644 --- a/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala +++ b/src/Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala @@ -69,7 +69,10 @@ public class Monitor.CPUProcessTreeView : Gtk.TreeView { set_model (model); - + model.added_first_row.connect (() => { + focus_on_first_row (); + }); + cursor_changed.connect (_cursor_changed); // model.process_manager.updated.connect (_cursor_changed); } diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index 4187c1f4..feaf36ad 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -9,7 +9,7 @@ public class Monitor.SystemCPUView : Gtk.Box { private LabelRoundy cpu_temperature_label; private LabelH4 processor_name_label; - private Gtk.Button view_threads_usage_button; + // private Gtk.Button view_threads_usage_button; private Gtk.Revealer cpu_threads_revealer; @@ -104,7 +104,7 @@ public class Monitor.SystemCPUView : Gtk.Box { smol_charts_container.attach (grid_frequency_info, 0, 0, 1, 1); smol_charts_container.attach (grid_temperature_info, 0, 1, 1, 1); smol_charts_container.row_spacing = 6; - smol_charts_container.margin_left = 6; + smol_charts_container.margin_start = 6; // Thanks Goncalo var charts_container = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0); diff --git a/src/Views/SystemView/SystemNetworkView.vala b/src/Views/SystemView/SystemNetworkView.vala index a89a3f86..71a7faf9 100644 --- a/src/Views/SystemView/SystemNetworkView.vala +++ b/src/Views/SystemView/SystemNetworkView.vala @@ -1,5 +1,5 @@ public class Monitor.SystemNetworkView : Gtk.Grid { - private NetworkChart network_chart; + private Chart network_chart; private Network network; private LabelH4 network_name_label; @@ -21,7 +21,8 @@ public class Monitor.SystemNetworkView : Gtk.Grid { network_upload_label = new LabelRoundy (_ ("UP")); network_upload_label.val.set_width_chars (7); - network_chart = new NetworkChart (2); + network_chart = new Chart (2); + network_chart.config.y_axis.fixed_max = null; var labels_grid = new Gtk.Grid (); labels_grid.row_spacing = 6; diff --git a/src/Widgets/Chart/Chart.vala b/src/Widgets/Chart/Chart.vala index dfd85ec8..44b38fc1 100644 --- a/src/Widgets/Chart/Chart.vala +++ b/src/Widgets/Chart/Chart.vala @@ -39,10 +39,6 @@ public class Monitor.Chart : Gtk.Box { var serie = new LiveChart.Serie (("Serie %d").printf(i), renderer); serie.set_main_color ({ 0.35 + i/20, 0.8, 0.1, 1.0}); live_chart.add_serie (serie); - - // workaround for `gee_collection_get_size: assertion 'self != NULL' failed` - // https://github.com/lcallarec/live-chart/issues/16 - live_chart.add_value (serie, 0); } add (live_chart); } @@ -51,10 +47,10 @@ public class Monitor.Chart : Gtk.Box { live_chart.add_value_by_index (serie_number, value); } - // public void set_data (int serie_number, Gee.ArrayList history) { - // var refresh_rate_is_ms = 2000; //your own refresh rate in milliseconds - // live_chart.add_unaware_timestamp_collection(live_chart.series[serie_number], history, refresh_rate_is_ms); - // } + public void set_data (int serie_number, Gee.ArrayList history) { + var refresh_rate_in_ms = 2000; + live_chart.add_unaware_timestamp_collection_by_index(serie_number, history, refresh_rate_in_ms); + } public void clear () { diff --git a/src/Widgets/Chart/NetworkChart.vala b/src/Widgets/Chart/NetworkChart.vala deleted file mode 100644 index ae8e8b1c..00000000 --- a/src/Widgets/Chart/NetworkChart.vala +++ /dev/null @@ -1,67 +0,0 @@ -public class Monitor.NetworkChart : Gtk.Box { - private LiveChart.Chart live_chart; - public LiveChart.Config config; - - construct { - get_style_context ().add_class ("graph"); - - vexpand = true; - height_request = 120; - - config = new LiveChart.Config (); - // config.y_axis.unit = "%"; - // config.y_axis.tick_interval = 25; - // config.y_axis.fixed_max = 100.0; - config.y_axis.labels.visible = false; - config.x_axis.labels.visible = false; - - config.padding = LiveChart.Padding () { - smart = LiveChart.AutoPadding.NONE, - top = 0, - right = 0, - bottom = 0, - left = -1 - }; - - live_chart = new LiveChart.Chart (config); - live_chart.expand = true; - live_chart.legend.visible = false; - live_chart.grid.visible = true; - live_chart.background.main_color = Gdk.RGBA () { - red= 1, green= 1, blue= 1, alpha= 1 - }; //White background - - } - - public NetworkChart (int series_quantity) { - for (int i = 0; i < series_quantity; i++) { - var renderer = new LiveChart.SmoothLineArea (new LiveChart.Values(1000)); - var serie = new LiveChart.Serie (("Serie %d").printf(i), renderer); - serie.set_main_color ({ 0.35 + i/20, 0.8, 0.1, 1.0}); - live_chart.add_serie (serie); - - // workaround for `gee_collection_get_size: assertion 'self != NULL' failed` - // https://github.com/lcallarec/live-chart/issues/16 - // why 3? I don't know. - live_chart.add_value (serie, 3); - } - add (live_chart); - } - - public void update (int serie_number, double value) { - live_chart.add_value_by_index (serie_number, value); - } - - // public void set_data (int serie_number, Gee.ArrayList history) { - // var refresh_rate_is_ms = 2000; //your own refresh rate in milliseconds - // live_chart.add_unaware_timestamp_collection(live_chart.series[serie_number], history, refresh_rate_is_ms); - // } - - - public void clear () { - // var series = live_chart.series; - // foreach (var serie in series) { - // serie.clear(); - // } - } -} diff --git a/subprojects/live-chart b/subprojects/live-chart index 7e1d4ca8..debce440 160000 --- a/subprojects/live-chart +++ b/subprojects/live-chart @@ -1 +1 @@ -Subproject commit 7e1d4ca8e3c0fee3b88b5ff0cdd447d8001824a2 +Subproject commit debce4403230c699756c112794e88dfa9c2aeb8e