diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 8f027c53..8b137891 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1 @@ -ko_fi: stsdc -custom: https://www.paypal.me/stsdc \ No newline at end of file + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e8b275e1..56c5845e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -21,7 +21,7 @@ jobs: apt update apt install -y libgala-dev libgee-0.8-dev libglib2.0-dev libgranite-dev libgtk-3-dev libhandy-1-dev apt install -y libdbus-glib-1-dev libwnck-3-dev libgtop2-dev libwingpanel-3.0-dev libudisks2-dev - apt install -y libxnvctrl0 libxnvctrl-dev libcurl4-gnutls-dev + apt install -y libxnvctrl0 libxnvctrl-dev libcurl4-gnutls-dev libflatpak-dev apt install -y meson valac sassc git - name: Build env: diff --git a/.github/workflows/publish-launchpad.yml b/.github/workflows/publish-launchpad.yml index 3309d707..9a62bf83 100644 --- a/.github/workflows/publish-launchpad.yml +++ b/.github/workflows/publish-launchpad.yml @@ -40,7 +40,7 @@ jobs: apt update apt install -y devscripts dput locales apt install -y libgala-dev libgee-0.8-dev libglib2.0-dev libgranite-dev libgtk-3-dev libhandy-1-dev libxnvctrl0 libxnvctrl-dev - apt install -y libdbus-glib-1-dev libwnck-3-dev libgtop2-dev libwingpanel-3.0-dev appstream debhelper libudisks2-dev libcurl4-gnutls-dev + apt install -y libdbus-glib-1-dev libwnck-3-dev libgtop2-dev libwingpanel-3.0-dev appstream debhelper libudisks2-dev libcurl4-gnutls-dev libflatpak-dev apt install -y meson valac sassc git - name: Set locale diff --git a/README.md b/README.md index d51f75a2..32d3ab76 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,6 @@

Manage processes and monitor system resources

- - - - Buy Me A Coffee Release @@ -26,7 +22,7 @@ ## Install -### elementary os 6 and 6.1 +### elementary OS 7 Horus If you have never added a PPA on your system before, you might need to run this command first: @@ -41,9 +37,12 @@ sudo add-apt-repository ppa:stsdc/monitor sudo apt install com.github.stsdc.monitor ``` -Monitor will then be available from the Applications menu. +Monitor will be available from the Applications menu. + +### ~~Fedora (36)~~ -### Fedora (36) +> [!WARNING] +> Dropped support due to lack of Pantheon dependencies on COPR. ```bash sudo dnf copr enable stsdc/monitor @@ -54,23 +53,7 @@ sudo dnf install com.github.stsdc.monitor ### Install dependencies -* meson -* appstream -* debhelper (>= 9) -* libgtk-3-dev -* libglib2.0-dev -* valac (>= 0.26) -* libgranite-dev (>= 5.2.0) -* libwnck-3-dev -* libgtop2-dev -* libwingpanel-3.0-dev -* libhandy-1-dev -* libudisks2-dev -* libxnvctrl0 -* libxnvctrl-dev -* libcurl4-gnutls-dev -* libjson-glib-dev -* sassc +Check dependencies in [the deb control file](debian/control). ### Clone, Build & Install diff --git a/com.github.stsdc.monitor.spec b/com.github.stsdc.monitor.spec index 8b0cf706..4a916f94 100755 --- a/com.github.stsdc.monitor.spec +++ b/com.github.stsdc.monitor.spec @@ -2,7 +2,7 @@ %global appname com.github.stsdc.monitor Name: com.github.stsdc.monitor -Version: 0.16.1 +Version: 0.17.0 Release: %autorelease Summary: Manage processes and monitor system resources License: GPLv3 diff --git a/data/com.github.stsdc.monitor.gschema.xml b/data/com.github.stsdc.monitor.gschema.xml index 34b7f91b..a242f8ff 100644 --- a/data/com.github.stsdc.monitor.gschema.xml +++ b/data/com.github.stsdc.monitor.gschema.xml @@ -70,6 +70,11 @@

To show GPU used percentage in Monitor Indicator or not To show GPU used percentage in Monitor Indicator or not + + false + To show GPU temperature in Monitor Indicator or not + To show GPU temperature in Monitor Indicator or not + true To enable smooth lines in charts diff --git a/data/icons/icons.indicator.gresource.xml b/data/icons/icons.indicator.gresource.xml index 003597b8..fc41b25c 100644 --- a/data/icons/icons.indicator.gresource.xml +++ b/data/icons/icons.indicator.gresource.xml @@ -7,9 +7,12 @@ swap-symbolic.svg file-deleted-symbolic.svg temperature-sensor-symbolic.svg + temperature-gpu-symbolic.svg extra/16/bash.svg extra/48/bash.svg + extra/64/bash.svg extra/16/docker.svg extra/48/docker.svg + extra/64/docker.svg \ No newline at end of file diff --git a/data/icons/temperature-gpu-symbolic.svg b/data/icons/temperature-gpu-symbolic.svg new file mode 100644 index 00000000..138823fb --- /dev/null +++ b/data/icons/temperature-gpu-symbolic.svg @@ -0,0 +1,49 @@ + +image/svg+xml diff --git a/debian/changelog b/debian/changelog index 449c778c..b6c76782 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +com.github.stsdc.monitor (0.17.0) jammy; urgency=low + + * Add GPU temperature to the Indicator + * Fix assigning right icon and name to a process (special thanks to @ppvan and @Nahu) + * Allow to filter processes by command + * Fix for icons appear slightly smaller in detailed process view + + -- Stanisław Dac Sun, 23 Jul 2023 00:35:37 +0000 + com.github.stsdc.monitor (0.16.1-0) jammy; urgency=low * Fix segfault when user can't be retrieved for process diff --git a/debian/control b/debian/control index 2de03ec4..ab9b29f2 100644 --- a/debian/control +++ b/debian/control @@ -18,6 +18,7 @@ Build-Depends: meson, libxnvctrl-dev, libcurl4-gnutls-dev, libjson-glib-dev, + libflatpak-dev, sassc Standards-Version: 4.1.1 diff --git a/meson.build b/meson.build index c17bb40d..2c47b0f3 100644 --- a/meson.build +++ b/meson.build @@ -1,4 +1,4 @@ -project('com.github.stsdc.monitor', 'vala', 'c', version: '0.16.1') +project('com.github.stsdc.monitor', 'vala', 'c', version: '0.17.0') # these are Meson modules gnome = import('gnome') @@ -37,6 +37,7 @@ app_dependencies = [ dependency('x11'), dependency('udisks2'), dependency('json-glib-1.0'), + dependency('flatpak'), livechart_proj.get_variable('livechart_dep'), diff --git a/src/Indicator/Indicator.vala b/src/Indicator/Indicator.vala index 33fe5d50..0a95547e 100644 --- a/src/Indicator/Indicator.vala +++ b/src/Indicator/Indicator.vala @@ -29,6 +29,7 @@ public class Monitor.Indicator : Wingpanel.Indicator { display_widget.network_up_widget.visible = settings.get_boolean ("indicator-network-upload-state"); display_widget.network_down_widget.visible = settings.get_boolean ("indicator-network-download-state"); display_widget.gpu_widget.visible = settings.get_boolean ("indicator-gpu-state"); + display_widget.gpu_temperature_widget.visible = settings.get_boolean ("indicator-gpu-temperature-state"); }); @@ -39,6 +40,7 @@ public class Monitor.Indicator : Wingpanel.Indicator { dbusclient.interface.indicator_network_up_state.connect ((state) => display_widget.network_up_widget.visible = state); dbusclient.interface.indicator_network_down_state.connect ((state) => display_widget.network_down_widget.visible = state); dbusclient.interface.indicator_gpu_state.connect ((state) => display_widget.gpu_widget.visible = state); + dbusclient.interface.indicator_gpu_temperature_state.connect ((state) => display_widget.gpu_temperature_widget.visible = state); dbusclient.interface.update.connect ((sysres) => { display_widget.cpu_widget.state_percentage = sysres.cpu_percentage; @@ -47,6 +49,7 @@ public class Monitor.Indicator : Wingpanel.Indicator { display_widget.network_up_widget.state_bandwidth = sysres.network_up; display_widget.network_down_widget.state_bandwidth = sysres.network_down; display_widget.gpu_widget.state_percentage = sysres.gpu_percentage; + display_widget.gpu_temperature_widget.state_temperature = (int) Math.round (sysres.gpu_temperature); }); popover_widget.quit_monitor.connect (() => { diff --git a/src/Indicator/Services/DBusClient.vala b/src/Indicator/Services/DBusClient.vala index 8e0894be..b15bfde9 100644 --- a/src/Indicator/Services/DBusClient.vala +++ b/src/Indicator/Services/DBusClient.vala @@ -10,6 +10,7 @@ public interface Monitor.DBusClientInterface : Object { public signal void indicator_network_up_state (bool state); public signal void indicator_network_down_state (bool state); public signal void indicator_gpu_state (bool state); + public signal void indicator_gpu_temperature_state (bool state); } diff --git a/src/Indicator/Widgets/DisplayWidget.vala b/src/Indicator/Widgets/DisplayWidget.vala index 5c994264..3dc40ed2 100644 --- a/src/Indicator/Widgets/DisplayWidget.vala +++ b/src/Indicator/Widgets/DisplayWidget.vala @@ -7,6 +7,7 @@ public class Monitor.Widgets.DisplayWidget : Gtk.Grid { public IndicatorWidget network_down_widget = new IndicatorWidget ("go-down-symbolic"); public IndicatorWidget gpu_widget = new IndicatorWidget ("gpu-symbolic"); + public IndicatorWidget gpu_temperature_widget = new IndicatorWidget ("temperature-gpu-symbolic"); construct { valign = Gtk.Align.CENTER; @@ -14,6 +15,7 @@ public class Monitor.Widgets.DisplayWidget : Gtk.Grid { add (cpu_widget); add (memory_widget); add (gpu_widget); + add (gpu_temperature_widget); add (temperature_widget); add (network_up_widget); add (network_down_widget); diff --git a/src/Managers/Container.vala b/src/Managers/Container.vala index 980c1c3f..2c30e693 100644 --- a/src/Managers/Container.vala +++ b/src/Managers/Container.vala @@ -158,11 +158,8 @@ namespace Monitor { // Newer version of json library has default values option if (json_memory_stats.has_member ("stats")) { var json_memory_stats_stats = json_memory_stats.get_object_member ("stats"); - this.mem_used = json_memory_stats.get_int_member ("usage") - json_memory_stats_stats.get_int_member ("inactive_file"); - this.mem_available = json_memory_stats.get_int_member ("limit"); - } else { - this.mem_used = 0; - this.mem_available = 0; + this.mem_used = json_memory_stats.get_int_member_with_default ("usage", 0) - json_memory_stats_stats.get_int_member ("inactive_file"); + this.mem_available = json_memory_stats.get_int_member_with_default ("limit", 0); } var json_cpu_stats = root_object.get_object_member ("cpu_stats"); @@ -177,14 +174,10 @@ namespace Monitor { if (json_cpu_stats.has_member ("system_cpu_usage")) { - this.system_cpu_usage = json_cpu_stats.get_int_member ("system_cpu_usage"); - this.pre_system_cpu_usage = json_precpu_stats.get_int_member ("system_cpu_usage"); - - this.number_cpus = json_cpu_stats.get_int_member ("online_cpus"); - } else { - this.system_cpu_usage = 0; - this.pre_system_cpu_usage = 0; - this.number_cpus = 0; + this.system_cpu_usage = json_cpu_stats.get_int_member_with_default ("system_cpu_usage", 0); + this.pre_system_cpu_usage = json_precpu_stats.get_int_member_with_default ("system_cpu_usage", 0); + + this.number_cpus = json_cpu_stats.get_int_member_with_default ("online_cpus", 0); } // debug("%lld, %lld", total_usage, pretotal_usage); diff --git a/src/Managers/ContainerManager.vala b/src/Managers/ContainerManager.vala index 118277af..9d04fae1 100644 --- a/src/Managers/ContainerManager.vala +++ b/src/Managers/ContainerManager.vala @@ -6,30 +6,30 @@ namespace Monitor { ERROR_NO_ENTRY, } - struct Container { - public string id; - public string name; - public string image; - public string state; - public string ? label_project; - public string ? label_service; - public string ? label_config; - public string ? label_workdir; - } - - struct ContainerInspectInfo { - public string name; - public string image; - public string status; - public string[] ? binds; - public string[] ? envs; - public string[] ? ports; - } - - struct DockerVersionInfo { - public string version; - public string api_version; - } + // struct Container { + // public string id; + // public string name; + // public string image; + // public string state; + // public string ? label_project; + // public string ? label_service; + // public string ? label_config; + // public string ? label_workdir; + // } + + // struct ContainerInspectInfo { + // public string name; + // public string image; + // public string status; + // public string[] ? binds; + // public string[] ? envs; + // public string[] ? ports; + // } + + // struct DockerVersionInfo { + // public string version; + // public string api_version; + // } public class ContainerManager : Object { private static GLib.Once instance; @@ -141,7 +141,6 @@ namespace Monitor { throw new ApiClientError.ERROR ("Server error"); } - // var json = ""; string ? line = null; @@ -149,7 +148,6 @@ namespace Monitor { json += line; } - // var root_node = parse_json (json); var root_array = root_node.get_array (); assert_nonnull (root_array); @@ -161,15 +159,6 @@ namespace Monitor { this.add_container (container_object); - // - - - - // - - - // - } var remove_me = new Gee.HashSet (); foreach (var container in this.container_list.values) { diff --git a/src/Managers/Process.vala b/src/Managers/Process.vala index e407facc..ff55c5f1 100644 --- a/src/Managers/Process.vala +++ b/src/Managers/Process.vala @@ -44,6 +44,8 @@ public class Monitor.Process : GLib.Object { public Gee.HashSet open_files_paths; + public Gee.HashSet children = new Gee.HashSet (); + /** * CPU usage of this process from the last time that it was updated, measured in percent * @@ -91,9 +93,8 @@ public class Monitor.Process : GLib.Object { username = passwd.pw_name; } - - exists = parse_stat () && read_cmdline (); + get_children_pids (); get_usage (0, 1); } @@ -112,7 +113,6 @@ public class Monitor.Process : GLib.Object { } // Kills the process - // Returns if kill was successful public bool kill () { // Sends a kill signal that cannot be ignored if (Posix.kill (stat.pid, Posix.Signal.KILL) == 0) { @@ -122,7 +122,6 @@ public class Monitor.Process : GLib.Object { } // Ends the process - // Returns if end was successful public bool end () { // Sends a terminate signal if (Posix.kill (stat.pid, Posix.Signal.TERM) == 0) { @@ -131,6 +130,19 @@ public class Monitor.Process : GLib.Object { return false; } + private bool get_children_pids () { + string ? children_content = ProcessUtils.read_file ("/proc/%d/task/%d/children".printf (stat.pid, stat.pid)); + if (children_content == "" || children_content == null) { + return false; + } + + var splitted_children_pids = children_content.split (" "); + foreach (var child in splitted_children_pids) { + this.children.add (int.parse (child)); + } + return true; + } + private bool parse_io () { var io_file = File.new_for_path ("/proc/%d/io".printf (stat.pid)); @@ -273,7 +285,10 @@ public class Monitor.Process : GLib.Object { } if (cmdline.length <= 0) { - // was empty, not an error + // if cmdline has 0 length we look into stat file + // useful for kworker processes + command = stat.comm; + return true; } diff --git a/src/Managers/ProcessManager.vala b/src/Managers/ProcessManager.vala index 74212bb9..b2d38659 100644 --- a/src/Managers/ProcessManager.vala +++ b/src/Managers/ProcessManager.vala @@ -17,7 +17,6 @@ namespace Monitor { private Gee.HashSet kernel_process_blacklist; private Gee.HashMap apps_info_list; - public signal void process_added (Process process); public signal void process_removed (int pid); public signal void updated (); @@ -29,7 +28,6 @@ namespace Monitor { apps_info_list = new Gee.HashMap (); populate_apps_info (); - update_processes.begin (); } @@ -38,8 +36,6 @@ namespace Monitor { foreach (AppInfo app_info in _apps_info) { string commandline = (app_info.get_commandline ()); - // debug ("%s\n", commandline); - // GLib.DesktopAppInfo? dai = info as GLib.DesktopAppInfo; // if (dai != null) { @@ -47,51 +43,13 @@ namespace Monitor { // if (id != null) // appid_map.insert (id, info); // } - - if (commandline == null) continue; - // sanitize_cmd (ref cmd); apps_info_list.set (commandline, app_info); } } - // private static void sanitize_cmd(ref string? commandline) { - // if (commandline == null) - // return; - - //// flatpak: parse the command line of the containerized program - // if (commandline.contains("flatpak run")) { - // var index = commandline.index_of ("--command=") + 10; - // commandline = commandline.substring (index); - // } - - //// TODO: unify this with the logic in get_full_process_cmd - //// commandline = Process.first_component (commandline); - //// commandline = Path.get_basename (commandline); - //// commandline = Process.sanitize_name (commandline); - - //// Workaround for google-chrome - // if (commandline.contains ("google-chrome-stable")) - // commandline = "chrome"; - // } - - // public static AppInfo? app_info_for_process (Process p) { - // AppInfo? info = null; - - // if (p.command != null) - // info = apps_info[p.command]; - - // if (info == null && p.app_id != null) - // info = appid_map[p.app_id]; - - // return info; - // } - - - - /** * Gets a process by its pid, making sure that it's updated. */ @@ -174,7 +132,7 @@ namespace Monitor { var uid = Posix.getuid (); GTop.ProcList proclist; - // var pids = GTop.get_proclist (out proclist, GTop.GLIBTOP_KERN_PROC_UID, uid); + // var pids = GTop.get_proclist (out proclist, GTop.GLIBTOP_KERN_PROC_UID, uid); var pids = GTop.get_proclist (out proclist, GTop.GLIBTOP_KERN_PROC_ALL, uid); for (int i = 0; i < proclist.number; i++) { @@ -192,36 +150,118 @@ namespace Monitor { /* emit the updated signal so that subscribers can update */ updated (); + } - /** - * Parses a pid and adds a Process to our process_list or to the kernel_blacklist - * - * returns the created process - */ - private Process ? add_process (int pid, bool lazy_signal = false) { - // create the process - var process = new Process (pid); + /** Sets name and icon for a process that is a Flatpak app and its children. */ + private void set_flatpak_name_icon (Process process, GLib.Icon icon, string name) { + process.application_name = name; + process.icon = icon; + foreach (int pid in process.children) { + var _process = this.get_process (pid); + if (_process != null) { + set_flatpak_name_icon (_process, icon, name); + } + } + } - // placeholding shortened commandline - process.application_name = ProcessUtils.sanitize_commandline (process.command); + private bool match_process_app (Process process) { + var command_sanitized = ProcessUtils.sanitize_commandline (process.command); + var command_sanitized_basename = Path.get_basename (command_sanitized); + + process.application_name = command_sanitized_basename; + + foreach (var flatpak_app in Flatpak.Instance.get_all ()) { + if (flatpak_app.get_pid () == process.stat.pid || flatpak_app.get_child_pid () == process.stat.pid) { + debug ("Found Flatpak app: %s ", flatpak_app.get_app ()); + foreach (var key in apps_info_list.keys) { + if (apps_info_list.get (key).get_id ().replace (".desktop", "") == flatpak_app.get_app ()) { + set_flatpak_name_icon (process, apps_info_list.get (key).get_icon (), apps_info_list.get (key).get_name ()); + } + } + } + } - // checking maybe it's an application foreach (var key in apps_info_list.keys) { - if (key.contains (process.application_name)) { + if (apps_info_list.get (key).get_executable () == command_sanitized) { + process.application_name = apps_info_list.get (key).get_name (); + process.icon = apps_info_list.get (key).get_icon (); + } else if (apps_info_list.get (key).get_executable () == process.command.split (" ")[1]) { + process.application_name = apps_info_list.get (key).get_name (); + process.icon = apps_info_list.get (key).get_icon (); + } else if (key.split (" ")[1] != null) { + if (key.split (" ")[1].contains ("%") || key.split (" ")[1].contains ("--")) { + if (apps_info_list.get (key).get_executable () == command_sanitized_basename) { + process.application_name = apps_info_list.get (key).get_name (); + process.icon = apps_info_list.get (key).get_icon (); + return true; + } + } + + // Steam case + // Must match a proper executable and not game executable e.g. steam steam://rungameid/210770 + if ((Path.get_basename (key.split (" ")[0]) == command_sanitized_basename) && !key.split (" ")[1].contains ("steam")) { + process.application_name = apps_info_list.get (key).get_name (); + process.icon = apps_info_list.get (key).get_icon (); + return true; + } + + // workaround for some flatpak apps + if (process.command.contains (apps_info_list.get (key).get_id ().replace (".desktop", ""))) { + process.application_name = apps_info_list.get (key).get_name (); + process.icon = apps_info_list.get (key).get_icon (); + return true; + } + } else if (apps_info_list.get (key).get_commandline () == process.command) { process.application_name = apps_info_list.get (key).get_name (); - // debug (apps_info_list.get (key).get_icon ().to_string ()); process.icon = apps_info_list.get (key).get_icon (); + return true; + + + } else if (process.command.split (" ")[0].contains (".exe")) { + var splitted = process.command.split (" ")[0].split ("\\"); + process.application_name = splitted[splitted.length - 1].chomp (); + process.icon = new ThemedIcon ("application-x-ms-dos-executable"); + return true; + } + // some processes have semicolon in command + // do not sanitizing to improve readability + else if (process.command.split (" ")[0].contains (":")) { + process.application_name = process.command; + return true; } } - if (process.application_name == "bash") { - debug ("app name is [bash] " + process.application_name); - process.icon = ProcessUtils.get_bash_icon (); + if (ProcessUtils.is_shell (command_sanitized_basename)) { + process.icon = new ThemedIcon ("bash"); + debug ("app name is " + process.application_name); } - if (process.application_name == "docker" || process.application_name == "dockerd") { - process.icon = ProcessUtils.get_docker_icon (); + if (command_sanitized_basename == "docker" || command_sanitized_basename == "dockerd" || command_sanitized_basename == "docker-proxy") { + process.icon = new ThemedIcon ("docker"); + process.application_name = command_sanitized_basename; + debug ("app name is " + process.application_name); } + + // process.application_name = process.command; + + return true; + } + + /** + * Parses a pid and adds a Process to our `process_list` or to the `kernel_blacklist` + * + * returns the created process + */ + private Process ? add_process (int pid, bool lazy_signal = false) { + // create the process + var process = new Process (pid); + + if (!process.exists) { + return null; + } + + this.match_process_app (process); + if (process.exists) { if (process.stat.pgrp != 0) { // regular process, add it to our cache diff --git a/src/Managers/ProcessUtils.vala b/src/Managers/ProcessUtils.vala index d5b28a7b..31807093 100644 --- a/src/Managers/ProcessUtils.vala +++ b/src/Managers/ProcessUtils.vala @@ -1,25 +1,29 @@ public class Monitor.ProcessUtils { // checks if it is run by shell - private static bool is_shell (string chunk) { + public static bool is_shell (string chunk) { return "sh" == chunk || "bash" == chunk || "zsh" == chunk; } - private static bool is_python (string chunk) { + public static bool is_python (string chunk) { return chunk.contains ("python"); } public static string sanitize_commandline (string ? commandline) { - if (commandline == null) return Path.get_basename (""); + if (commandline == null) return ""; // splitting command; might include many options var splitted_commandline = commandline.split (" "); // check if started by any shell if (is_shell (splitted_commandline[0]) || is_python (splitted_commandline[0]) ) { - return Path.get_basename (splitted_commandline[1]); + return commandline; } - return Path.get_basename (splitted_commandline[0]); + // if (!splitted_commandline[0].contains ("/")) { + // return commandline; + // } + + return splitted_commandline[0]; } public static string ? read_file (string path) { @@ -58,12 +62,4 @@ public class Monitor.ProcessUtils { return null; } } - - public static Icon ? get_bash_icon () { - return new ThemedIcon ("bash"); - } - - public static Icon ? get_docker_icon () { - return new ThemedIcon ("docker"); - } } diff --git a/src/Models/TreeViewModel.vala b/src/Models/TreeViewModel.vala index 330a3a1c..4394f823 100644 --- a/src/Models/TreeViewModel.vala +++ b/src/Models/TreeViewModel.vala @@ -4,6 +4,7 @@ public enum Monitor.Column { CPU, MEMORY, PID, + CMD } public class Monitor.TreeViewModel : Gtk.TreeStore { @@ -20,6 +21,7 @@ public class Monitor.TreeViewModel : Gtk.TreeStore { typeof (double), typeof (int64), typeof (int), + typeof (string), }); process_manager = ProcessManager.get_default (); @@ -53,6 +55,7 @@ public class Monitor.TreeViewModel : Gtk.TreeStore { Column.NAME, process.application_name, Column.ICON, process.icon.to_string (), Column.PID, process.stat.pid, + Column.CMD, process.command, -1); if (process_rows.size < 1) { added_first_row (); diff --git a/src/Resources/Resources.vala b/src/Resources/Resources.vala index 20cc6a6b..1238dd0b 100644 --- a/src/Resources/Resources.vala +++ b/src/Resources/Resources.vala @@ -86,7 +86,8 @@ public class Monitor.Resources : Object { swap_total = swap.total, network_up = network.bytes_out, network_down = network.bytes_in, - gpu_percentage = gpu != null ? gpu.percentage : 0 + gpu_percentage = gpu != null ? gpu.percentage : 0, + gpu_temperature = gpu.temperature }; } } diff --git a/src/Resources/ResourcesSerialized.vala b/src/Resources/ResourcesSerialized.vala index 33a6456b..b389793c 100644 --- a/src/Resources/ResourcesSerialized.vala +++ b/src/Resources/ResourcesSerialized.vala @@ -11,4 +11,5 @@ public struct ResourcesSerialized { public int network_up; public int network_down; public int gpu_percentage; + public double gpu_temperature; } diff --git a/src/Services/DBusServer.vala b/src/Services/DBusServer.vala index 705e4748..f19f0840 100644 --- a/src/Services/DBusServer.vala +++ b/src/Services/DBusServer.vala @@ -17,6 +17,7 @@ public class Monitor.DBusServer : Object { public signal void indicator_network_up_state (bool state); public signal void indicator_network_down_state (bool state); public signal void indicator_gpu_state (bool state); + public signal void indicator_gpu_temperature_state (bool state); public signal void quit (); public signal void show (); diff --git a/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala b/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala index 6d378c9f..bff68aa9 100644 --- a/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala +++ b/src/Views/ContainerView/ContainerInfoView/ContainerInfoHeader.vala @@ -99,42 +99,4 @@ public class Monitor.ContainerInfoHeader : Gtk.Grid { // num_threads.set_text (process.stat.num_threads.to_string ()); // set_icon (process); } - - private void set_icon (Process process) { - // this construction should be somewhere else - var icon_name = process.icon.to_string (); - - if (!regex.match (icon_name)) { - icon.set_from_icon_name (icon_name, Gtk.IconSize.DIALOG); - } else { - try { - var pixbuf = new Gdk.Pixbuf.from_file_at_size (icon_name, 64, -1); - icon.set_from_pixbuf (pixbuf); - } catch (Error e) { - warning (e.message); - } - } - } - - private string set_state_tooltip () { - switch (state.label) { - case "D": - return _("The app is waiting in an uninterruptible disk sleep"); - case "I": - return _("Idle kernel thread"); - case "R": - return _("The process is running or runnable (on run queue)"); - case "S": - return _("The process is in an interruptible sleep; waiting for an event to complete"); - case "T": - return _("The process is stopped by a job control signal"); - case "t": - return _("The process is stopped stopped by a debugger during the tracing"); - case "Z": - return _("The app is terminated but not reaped by its parent"); - default: - return ""; - } - } - } diff --git a/src/Views/PreferencesView/PreferencesIndicatorPage.vala b/src/Views/PreferencesView/PreferencesIndicatorPage.vala index a3b7cdb4..57af79ba 100644 --- a/src/Views/PreferencesView/PreferencesIndicatorPage.vala +++ b/src/Views/PreferencesView/PreferencesIndicatorPage.vala @@ -94,6 +94,18 @@ dbusserver.indicator_gpu_state (gpu_percentage_switch.state); }); + var gpu_temperature_label = new Gtk.Label (_("Display GPU temperature")); + gpu_label.halign = Gtk.Align.START; + gpu_label.xalign = 1; + + var gpu_temperature_switch = new Gtk.Switch (); + gpu_temperature_switch.halign = Gtk.Align.END; + gpu_temperature_switch.state = MonitorApp.settings.get_boolean ("indicator-gpu-temperature-state"); + gpu_temperature_switch.notify["active"].connect (() => { + MonitorApp.settings.set_boolean ("indicator-gpu-temperature-state", gpu_temperature_switch.state); + dbusserver.indicator_gpu_temperature_state (gpu_temperature_switch.state); + }); + content_area.attach (cpu_label, 0, 0, 1, 1); content_area.attach (cpu_percentage_switch, 1, 0, 1, 1); @@ -103,14 +115,17 @@ content_area.attach (gpu_label, 0, 2, 1, 1); content_area.attach (gpu_percentage_switch, 1, 2, 1, 1); - content_area.attach (temperature_label, 0, 3, 1, 1); - content_area.attach (temperature_switch, 1, 3, 1, 1); + content_area.attach (gpu_temperature_label, 0, 3, 1, 1); + content_area.attach (gpu_temperature_switch, 1, 3, 1, 1); + + content_area.attach (temperature_label, 0, 4, 1, 1); + content_area.attach (temperature_switch, 1, 4, 1, 1); - content_area.attach (network_upload_label, 0, 4, 1, 1); - content_area.attach (network_upload_switch, 1, 4, 1, 1); + content_area.attach (network_upload_label, 0, 5, 1, 1); + content_area.attach (network_upload_switch, 1, 5, 1, 1); - content_area.attach (network_download_label, 0, 5, 1, 1); - content_area.attach (network_download_switch, 1, 5, 1, 1); + content_area.attach (network_download_label, 0, 6, 1, 1); + content_area.attach (network_download_switch, 1, 6, 1, 1); update_status (); diff --git a/src/Views/SystemView/SystemCPUView.vala b/src/Views/SystemView/SystemCPUView.vala index f48ef60c..efbd2435 100644 --- a/src/Views/SystemView/SystemCPUView.vala +++ b/src/Views/SystemView/SystemCPUView.vala @@ -4,7 +4,6 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { private Chart cpu_temperature_chart; private CPU cpu; - private LabelVertical cpu_percentage_label; private LabelRoundy cpu_frequency_label; private LabelRoundy cpu_temperature_label; @@ -15,10 +14,6 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { construct { core_label_list = new Gee.ArrayList (); - cpu_percentage_label = new LabelVertical (_("Utilization")); - cpu_percentage_label.has_tooltip = true; - cpu_percentage_label.tooltip_text = (_("Show detailed info")); - cpu_frequency_label = new LabelRoundy (_("Frequency")); cpu_frequency_label.margin = 6; cpu_frequency_label.margin_top = 2; @@ -32,9 +27,6 @@ public class Monitor.SystemCPUView : Monitor.WidgetResource { cpu_frequency_chart.height_request = -1; cpu_frequency_chart.config.y_axis.fixed_max = 5.0; - - - var grid_frequency_info = new Gtk.Grid (); grid_frequency_info.attach (cpu_frequency_label, 0, 0, 1, 1); grid_frequency_info.attach (cpu_frequency_chart, 0, 0, 1, 1); diff --git a/src/Widgets/Headerbar/Search.vala b/src/Widgets/Headerbar/Search.vala index 65656f08..922f00f6 100644 --- a/src/Widgets/Headerbar/Search.vala +++ b/src/Widgets/Headerbar/Search.vala @@ -43,6 +43,7 @@ public class Monitor.Search : Gtk.SearchEntry { private bool filter_func (Gtk.TreeModel model, Gtk.TreeIter iter) { string name_haystack; int pid_haystack; + string cmd_haystack; bool found = false; var needle = this.text; @@ -55,12 +56,14 @@ public class Monitor.Search : Gtk.SearchEntry { model.get (iter, Column.NAME, out name_haystack, -1); model.get (iter, Column.PID, out pid_haystack, -1); + model.get (iter, Column.CMD, out cmd_haystack, -1); // sometimes name_haystack is null if (name_haystack != null) { bool name_found = name_haystack.casefold ().contains (needle.casefold ()) || false; bool pid_found = pid_haystack.to_string ().casefold ().contains (needle.casefold ()) || false; - found = name_found || pid_found; + bool cmd_found = cmd_haystack.casefold ().contains (needle.casefold ()) || false; + found = name_found || pid_found || cmd_found; } diff --git a/src/Widgets/Labels/LabelRoundy.vala b/src/Widgets/Labels/LabelRoundy.vala index dd585114..2687af84 100644 --- a/src/Widgets/Labels/LabelRoundy.vala +++ b/src/Widgets/Labels/LabelRoundy.vala @@ -3,7 +3,9 @@ public class Monitor.LabelRoundy : Gtk.Fixed { public Gtk.Label desc; public LabelRoundy (string description) { - val = new Gtk.Label (Utils.NO_DATA); + val = new Gtk.Label (Utils.NO_DATA) { + selectable = true + }; val.get_style_context ().add_class ("roundy-label"); desc = new Gtk.Label (description.up ()); diff --git a/src/Widgets/Statusbar/Statusbar.vala b/src/Widgets/Statusbar/Statusbar.vala index 9b167b71..ed45634c 100644 --- a/src/Widgets/Statusbar/Statusbar.vala +++ b/src/Widgets/Statusbar/Statusbar.vala @@ -4,14 +4,17 @@ public class Monitor.Statusbar : Gtk.ActionBar { Gtk.Label swap_usage_label; construct { - var cpu_icon = new Gtk.Image.from_icon_name ("cpu-symbolic", Gtk.IconSize.SMALL_TOOLBAR); - cpu_icon.tooltip_text = _("CPU"); + var cpu_icon = new Gtk.Image.from_icon_name ("cpu-symbolic", Gtk.IconSize.SMALL_TOOLBAR) { + tooltip_text = _("CPU") + }; - var ram_icon = new Gtk.Image.from_icon_name ("ram-symbolic", Gtk.IconSize.SMALL_TOOLBAR); - ram_icon.tooltip_text = _("Memory"); + var ram_icon = new Gtk.Image.from_icon_name ("ram-symbolic", Gtk.IconSize.SMALL_TOOLBAR) { + tooltip_text = _("Memory") + }; - var swap_icon = new Gtk.Image.from_icon_name ("swap-symbolic", Gtk.IconSize.SMALL_TOOLBAR); - swap_icon.tooltip_text = _("Swap"); + var swap_icon = new Gtk.Image.from_icon_name ("swap-symbolic", Gtk.IconSize.SMALL_TOOLBAR) { + tooltip_text = _("Swap") + }; cpu_usage_label = new Gtk.Label (_("Calculating…")); cpu_usage_label.set_width_chars (4); @@ -33,25 +36,20 @@ public class Monitor.Statusbar : Gtk.ActionBar { pack_start (swap_icon); pack_start (swap_usage_label); - var peace_label = new Gtk.Label ("🕊️"); - peace_label.tooltip_text = (_("Peace")); - + var support_ua_label = new Gtk.LinkButton.with_label ("http://stand-with-ukraine.pp.ua/", _("🇺🇦")); var github_label = new Gtk.LinkButton.with_label ("https://github.com/stsdc/monitor", _("Check on Github")); - var donate_label = new Gtk.LinkButton.with_label ("https://ko-fi.com/stsdc", _("Donate 💸")); - var version_label = new Gtk.Label ("%s".printf (VCS_TAG)) { selectable = true }; version_label.get_style_context ().add_class ("dim-label"); - pack_end (donate_label); - pack_end (build_separator_middot ()); + // pack_end (build_separator_middot ()); pack_end (github_label); pack_end (build_separator_middot ()); pack_end (version_label); pack_end (build_separator_middot ()); - pack_end (peace_label); + pack_end (support_ua_label); } diff --git a/vapi/flatpak.vapi b/vapi/flatpak.vapi new file mode 100644 index 00000000..cdd73020 --- /dev/null +++ b/vapi/flatpak.vapi @@ -0,0 +1,583 @@ +/* flatpak.vapi generated by vapigen, do not modify. */ + +[CCode (cprefix = "Flatpak", gir_namespace = "Flatpak", gir_version = "1.0", lower_case_cprefix = "flatpak_")] +namespace Flatpak { + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_bundle_ref_get_type ()")] + public class BundleRef : Flatpak.Ref { + [CCode (has_construct_function = false)] + public BundleRef (GLib.File file) throws GLib.Error; + public GLib.Bytes get_appstream (); + public GLib.File get_file (); + public GLib.Bytes get_icon (int size); + public uint64 get_installed_size (); + public GLib.Bytes get_metadata (); + public string get_origin (); + [Version (since = "0.8.0")] + public string get_runtime_repo_url (); + public GLib.File file { owned get; construct; } + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_installation_get_type ()")] + public class Installation : GLib.Object { + [CCode (has_construct_function = false)] + protected Installation (); + [Version (since = "1.3.4")] + public bool add_remote (Flatpak.Remote remote, bool if_needed, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "0.10.0")] + public bool cleanup_local_refs_sync (GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.FileMonitor create_monitor (GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool drop_caches (GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.Bytes fetch_remote_metadata_sync (string remote_name, Flatpak.Ref @ref, GLib.Cancellable? cancellable = null) throws GLib.Error; + public Flatpak.RemoteRef fetch_remote_ref_sync (string remote_name, Flatpak.RefKind kind, string name, string? arch, string? branch, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "1.3.3")] + public Flatpak.RemoteRef fetch_remote_ref_sync_full (string remote_name, Flatpak.RefKind kind, string name, string? arch, string? branch, Flatpak.QueryFlags flags, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool fetch_remote_size_sync (string remote_name, Flatpak.Ref @ref, out uint64 download_size, out uint64 installed_size, GLib.Cancellable? cancellable = null) throws GLib.Error; + [CCode (has_construct_function = false)] + public Installation.for_path (GLib.File path, bool user, GLib.Cancellable? cancellable = null) throws GLib.Error; + public string get_config (string key, GLib.Cancellable? cancellable = null) throws GLib.Error; + public Flatpak.InstalledRef get_current_installed_app (string name, GLib.Cancellable? cancellable = null) throws GLib.Error; + [CCode (array_length = false, array_null_terminated = true)] + [Version (since = "1.5.0")] + public string[] get_default_languages () throws GLib.Error; + [CCode (array_length = false, array_null_terminated = true)] + [Version (since = "1.5.1")] + public string[] get_default_locales () throws GLib.Error; + [Version (since = "0.8")] + public unowned string get_display_name (); + [Version (since = "0.8")] + public unowned string get_id (); + public Flatpak.InstalledRef get_installed_ref (Flatpak.RefKind kind, string name, string? arch, string? branch, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool get_is_user (); + [Version (since = "1.1")] + public bool get_min_free_space_bytes (out uint64 out_bytes) throws GLib.Error; + [Version (since = "1.1.1")] + public bool get_no_interaction (); + public GLib.File get_path (); + [Version (since = "0.8")] + public int get_priority (); + public Flatpak.Remote get_remote_by_name (string name, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "0.8")] + public Flatpak.StorageType get_storage_type (); + [Version (deprecated = true, deprecated_since = "1.7.0")] + public Flatpak.InstalledRef install (string remote_name, Flatpak.RefKind kind, string name, string? arch, string? branch, [CCode (delegate_target_pos = 6.5)] Flatpak.ProgressCallback? progress, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (deprecated = true, deprecated_since = "1.7.0")] + public Flatpak.InstalledRef install_bundle (GLib.File file, [CCode (delegate_target_pos = 2.5)] Flatpak.ProgressCallback? progress, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (deprecated = true, deprecated_since = "1.7.0")] + public Flatpak.InstalledRef install_full (Flatpak.InstallFlags flags, string remote_name, Flatpak.RefKind kind, string name, string? arch, string? branch, [CCode (array_length = false, array_null_terminated = true)] string[]? subpaths, [CCode (delegate_target_pos = 8.5)] Flatpak.ProgressCallback? progress, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (deprecated = true, deprecated_since = "1.7.0", since = "0.6.10")] + public Flatpak.RemoteRef install_ref_file (GLib.Bytes ref_file_data, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool launch (string name, string? arch, string? branch, string? commit, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "1.1")] + public bool launch_full (Flatpak.LaunchFlags flags, string name, string? arch, string? branch, string? commit, Flatpak.Instance? instance_out, GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.GenericArray list_installed_refs (GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.GenericArray list_installed_refs_by_kind (Flatpak.RefKind kind, GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.GenericArray list_installed_refs_for_update (GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "0.6.7")] + public GLib.GenericArray list_installed_related_refs_sync (string remote_name, string @ref, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "1.9.1")] + public GLib.GenericArray list_pinned_refs (string? arch, GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.GenericArray list_remote_refs_sync (string remote_or_uri, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "1.3.3")] + public GLib.GenericArray list_remote_refs_sync_full (string remote_or_uri, Flatpak.QueryFlags flags, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "1.11.1")] + public GLib.GenericArray list_remote_related_refs_for_installed_sync (string remote_name, string @ref, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "0.6.7")] + public GLib.GenericArray list_remote_related_refs_sync (string remote_name, string @ref, GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.GenericArray list_remotes (GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.GenericArray list_remotes_by_type ([CCode (array_length_cname = "num_types", array_length_pos = 1.5, array_length_type = "gsize")] Flatpak.RemoteType[] types, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "1.1.2")] + public GLib.GenericArray list_unused_refs (string? arch, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "1.9.1")] + public GLib.GenericArray list_unused_refs_with_options (string? arch, GLib.HashTable? metadata_injection, GLib.Variant? options, GLib.Cancellable? cancellable = null) throws GLib.Error; + public string load_app_overrides (string app_id, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool modify_remote (Flatpak.Remote remote, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "0.10.0")] + public bool prune_local_repo (GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "0.10.0")] + public bool remove_local_ref_sync (string remote_name, string @ref, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool remove_remote (string name, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "1.0.3")] + public bool run_triggers (GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool set_config_sync (string key, string value, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "1.1.1")] + public void set_no_interaction (bool no_interaction); + [CCode (has_construct_function = false)] + public Installation.system (GLib.Cancellable? cancellable = null) throws GLib.Error; + [CCode (has_construct_function = false)] + [Version (since = "0.8")] + public Installation.system_with_id (string? id, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (deprecated = true, deprecated_since = "1.7.0")] + public bool uninstall (Flatpak.RefKind kind, string name, string? arch, string? branch, [CCode (delegate_target_pos = 5.5)] Flatpak.ProgressCallback? progress, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (deprecated = true, deprecated_since = "1.7.0", since = "0.11.8")] + public bool uninstall_full (Flatpak.UninstallFlags flags, Flatpak.RefKind kind, string name, string? arch, string? branch, [CCode (delegate_target_pos = 6.5)] Flatpak.ProgressCallback? progress, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (deprecated = true, deprecated_since = "1.7.0")] + public Flatpak.InstalledRef update (Flatpak.UpdateFlags flags, Flatpak.RefKind kind, string name, string? arch, string? branch, [CCode (delegate_target_pos = 6.5)] Flatpak.ProgressCallback? progress, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool update_appstream_full_sync (string remote_name, string? arch, [CCode (delegate_target_pos = 3.5)] Flatpak.ProgressCallback? progress, bool? out_changed, GLib.Cancellable? cancellable = null) throws GLib.Error; + public bool update_appstream_sync (string remote_name, string? arch, bool? out_changed, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (deprecated = true, deprecated_since = "1.7.0")] + public Flatpak.InstalledRef update_full (Flatpak.UpdateFlags flags, Flatpak.RefKind kind, string name, string? arch, string? branch, [CCode (array_length = false, array_null_terminated = true)] string[]? subpaths, [CCode (delegate_target_pos = 7.5)] Flatpak.ProgressCallback? progress, GLib.Cancellable? cancellable = null) throws GLib.Error; + [Version (since = "0.6.13")] + public bool update_remote_sync (string name, GLib.Cancellable? cancellable = null) throws GLib.Error; + [CCode (has_construct_function = false)] + public Installation.user (GLib.Cancellable? cancellable = null) throws GLib.Error; + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_installed_ref_get_type ()")] + public class InstalledRef : Flatpak.Ref { + [CCode (has_construct_function = false)] + protected InstalledRef (); + [Version (since = "1.4.2")] + public unowned GLib.HashTable? get_appdata_content_rating (); + [Version (since = "1.4.2")] + public unowned string? get_appdata_content_rating_type (); + [Version (since = "1.1.2")] + public unowned string get_appdata_license (); + [Version (since = "1.1.2")] + public unowned string get_appdata_name (); + [Version (since = "1.1.2")] + public unowned string get_appdata_summary (); + [Version (since = "1.1.2")] + public unowned string get_appdata_version (); + public unowned string get_deploy_dir (); + public unowned string get_eol (); + public unowned string get_eol_rebase (); + public uint64 get_installed_size (); + public bool get_is_current (); + public unowned string? get_latest_commit (); + public unowned string get_origin (); + [CCode (array_length = false, array_null_terminated = true)] + public unowned string[] get_subpaths (); + [Version (since = "1.1.2")] + public GLib.Bytes load_appdata (GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.Bytes load_metadata (GLib.Cancellable? cancellable = null) throws GLib.Error; + public GLib.HashTable appdata_content_rating { get; construct; } + public string appdata_content_rating_type { get; construct; } + public string appdata_license { get; construct; } + public string appdata_name { get; construct; } + public string appdata_summary { get; construct; } + public string appdata_version { get; construct; } + [NoAccessorMethod] + public string deploy_dir { owned get; set; } + [NoAccessorMethod] + public string end_of_life { owned get; construct; } + [NoAccessorMethod] + public string end_of_life_rebase { owned get; construct; } + [NoAccessorMethod] + public uint64 installed_size { get; set; } + [NoAccessorMethod] + public bool is_current { get; set; } + [NoAccessorMethod] + public string latest_commit { owned get; set; } + [NoAccessorMethod] + public string origin { owned get; set; } + [CCode (array_length = false, array_null_terminated = true)] + [NoAccessorMethod] + public string[] subpaths { owned get; set; } + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_instance_get_type ()")] + public class Instance : GLib.Object { + [CCode (has_construct_function = false)] + protected Instance (); + [Version (since = "1.1")] + public static GLib.GenericArray get_all (); + [Version (since = "1.1")] + public unowned string? get_app (); + [Version (since = "1.1")] + public unowned string get_arch (); + [Version (since = "1.1")] + public unowned string get_branch (); + [Version (since = "1.1")] + public int get_child_pid (); + [Version (since = "1.1")] + public unowned string get_commit (); + [Version (since = "1.1")] + public unowned string get_id (); + [Version (since = "1.1")] + public GLib.KeyFile get_info (); + [Version (since = "1.1")] + public int get_pid (); + [Version (since = "1.1")] + public unowned string get_runtime (); + [Version (since = "1.1")] + public unowned string get_runtime_commit (); + public bool is_running (); + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_ref_get_type ()")] + public class Ref : GLib.Object { + [CCode (has_construct_function = false)] + protected Ref (); + public string format_ref (); + [Version (since = "1.9.1")] + public unowned string format_ref_cached (); + public unowned string get_arch (); + public unowned string get_branch (); + public unowned string get_collection_id (); + public unowned string get_commit (); + public Flatpak.RefKind get_kind (); + public unowned string get_name (); + public static Flatpak.Ref parse (string @ref) throws GLib.Error; + public string arch { get; construct; } + public string branch { get; construct; } + public string collection_id { get; construct; } + public string commit { get; construct; } + public Flatpak.RefKind kind { get; construct; } + public string name { get; construct; } + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_related_ref_get_type ()")] + public class RelatedRef : Flatpak.Ref { + [CCode (has_construct_function = false)] + protected RelatedRef (); + [CCode (array_length = false, array_null_terminated = true)] + [Version (since = "0.6.7")] + public unowned string[] get_subpaths (); + [NoAccessorMethod] + public bool should_autoprune { get; construct; } + [NoAccessorMethod] + public bool should_delete { get; construct; } + [NoAccessorMethod] + public bool should_download { get; construct; } + [CCode (array_length = false, array_null_terminated = true)] + public string[] subpaths { get; construct; } + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_remote_get_type ()")] + public class Remote : GLib.Object { + [CCode (has_construct_function = false)] + public Remote (string name); + [CCode (has_construct_function = false)] + [Version (since = "1.3.4")] + public Remote.from_file (string name, GLib.Bytes data) throws GLib.Error; + public GLib.File get_appstream_dir (string? arch); + public GLib.File get_appstream_timestamp (string? arch); + public string? get_collection_id (); + [Version (since = "1.4")] + public string get_comment (); + [Version (since = "0.6.12")] + public string get_default_branch (); + [Version (since = "1.4")] + public string get_description (); + public bool get_disabled (); + [Version (since = "1.4")] + public string get_filter (); + public bool get_gpg_verify (); + [Version (since = "1.4")] + public string get_homepage (); + [Version (since = "1.4")] + public string get_icon (); + [Version (since = "1.1.1")] + public string get_main_ref (); + public unowned string get_name (); + public bool get_nodeps (); + public bool get_noenumerate (); + public int get_prio (); + [Version (since = "0.9.8")] + public Flatpak.RemoteType get_remote_type (); + public string get_title (); + public string get_url (); + public void set_collection_id (string? collection_id); + [Version (since = "1.4")] + public void set_comment (string comment); + [Version (since = "0.6.12")] + public void set_default_branch (string default_branch); + [Version (since = "1.4")] + public void set_description (string description); + public void set_disabled (bool disabled); + [Version (since = "1.4")] + public void set_filter (string filter_path); + public void set_gpg_key (GLib.Bytes gpg_key); + public void set_gpg_verify (bool gpg_verify); + [Version (since = "1.4")] + public void set_homepage (string homepage); + [Version (since = "1.4")] + public void set_icon (string icon); + [Version (since = "1.1.1")] + public void set_main_ref (string main_ref); + public void set_nodeps (bool nodeps); + public void set_noenumerate (bool noenumerate); + public void set_prio (int prio); + public void set_title (string title); + public void set_url (string url); + [NoAccessorMethod] + public string name { owned get; set; } + [NoAccessorMethod] + [Version (since = "0.9.8")] + public Flatpak.RemoteType type { get; construct; } + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_remote_ref_get_type ()")] + public class RemoteRef : Flatpak.Ref { + [CCode (has_construct_function = false)] + protected RemoteRef (); + public uint64 get_download_size (); + public unowned string get_eol (); + public unowned string get_eol_rebase (); + public uint64 get_installed_size (); + public unowned GLib.Bytes? get_metadata (); + public unowned string get_remote_name (); + public uint64 download_size { get; construct; } + [NoAccessorMethod] + public string end_of_life { owned get; construct; } + [NoAccessorMethod] + public string end_of_life_rebase { owned get; construct; } + public uint64 installed_size { get; construct; } + public GLib.Bytes metadata { get; construct; } + public string remote_name { get; construct; } + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_transaction_get_type ()")] + public class Transaction : GLib.Object, GLib.Initable { + [CCode (has_construct_function = false)] + protected Transaction (); + [Version (since = "1.5.1")] + public void abort_webflow (uint id); + public void add_default_dependency_sources (); + public void add_dependency_source (Flatpak.Installation installation); + public bool add_install (string remote, string @ref, [CCode (array_length = false, array_null_terminated = true)] string[]? subpaths) throws GLib.Error; + public bool add_install_bundle (GLib.File file, GLib.Bytes? gpg_data) throws GLib.Error; + public bool add_install_flatpakref (GLib.Bytes flatpakref_data) throws GLib.Error; + [Version (since = "1.3.3.")] + public bool add_rebase (string remote, string @ref, string? subpaths, [CCode (array_length = false, array_null_terminated = true)] string[]? previous_ids) throws GLib.Error; + [Version (since = "1.7.1")] + public void add_sideload_repo (string path); + public bool add_uninstall (string @ref) throws GLib.Error; + public bool add_update (string @ref, [CCode (array_length = false, array_null_terminated = true)] string[]? subpaths, string? commit) throws GLib.Error; + [Version (since = "1.5.2")] + public void complete_basic_auth (uint id, string user, string password, GLib.Variant options); + [CCode (has_construct_function = false)] + public Transaction.for_installation (Flatpak.Installation installation, GLib.Cancellable? cancellable = null) throws GLib.Error; + public Flatpak.TransactionOperation get_current_operation (); + [Version (since = "1.9.1")] + public bool get_include_unused_uninstall_ops (); + public Flatpak.Installation get_installation (); + [Version (since = "1.5.1")] + public bool get_no_deploy (); + [Version (since = "1.5.1")] + public bool get_no_pull (); + public GLib.List get_operations (); + [Version (since = "1.5.1")] + public unowned string get_parent_window (); + public bool is_empty (); + public virtual bool run (GLib.Cancellable? cancellable = null) throws GLib.Error; + public void set_default_arch (string arch); + [Version (since = "1.9.1")] + public void set_disable_auto_pin (bool disable_pin); + public void set_disable_dependencies (bool disable_dependencies); + public void set_disable_prune (bool disable_prune); + public void set_disable_related (bool disable_related); + public void set_disable_static_deltas (bool disable_static_deltas); + public void set_force_uninstall (bool force_uninstall); + [Version (since = "1.9.1")] + public void set_include_unused_uninstall_ops (bool include_unused_uninstall_ops); + public void set_no_deploy (bool no_deploy); + [Version (since = "1.7.3")] + public void set_no_interaction (bool no_interaction); + public void set_no_pull (bool no_pull); + [Version (since = "1.5.1")] + public void set_parent_window (string parent_window); + public void set_reinstall (bool reinstall); + public Flatpak.Installation installation { owned get; construct; } + public virtual signal bool add_new_remote (Flatpak.TransactionRemoteReason reason, string from_id, string remote_name, string url); + [Version (since = "1.5.2")] + public virtual signal bool basic_auth_start (string remote, string realm, GLib.Variant options, int id); + public virtual signal int choose_remote_for_ref (string for_ref, string runtime_ref, [CCode (array_length = false, array_null_terminated = true)] string[] remotes); + public virtual signal void end_of_lifed (string @ref, string reason, string rebase); + [Version (since = "1.3.2")] + public virtual signal bool end_of_lifed_with_rebase (string remote, string @ref, string reason, string rebased_to_ref, [CCode (array_length = false, array_null_terminated = true)] string[] previous_ids); + [Version (since = "1.8.0")] + public virtual signal void install_authenticator (string remote, string authenticator_ref); + public virtual signal void new_operation (Flatpak.TransactionOperation operation, Flatpak.TransactionProgress progress); + public virtual signal void operation_done (Flatpak.TransactionOperation operation, string? commit, Flatpak.TransactionResult details); + public virtual signal bool operation_error (Flatpak.TransactionOperation operation, GLib.Error error, Flatpak.TransactionErrorDetails detail); + public virtual signal bool ready (); + [Version (since = "1.9.1")] + public virtual signal bool ready_pre_auth (); + [Version (since = "1.5.1")] + public virtual signal void webflow_done (GLib.Variant options, int id); + [Version (since = "1.5.1")] + public virtual signal bool webflow_start (string remote, string url, GLib.Variant options, int id); + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_transaction_operation_get_type ()")] + public class TransactionOperation : GLib.Object { + [CCode (has_construct_function = false)] + protected TransactionOperation (); + public unowned GLib.File get_bundle_path (); + public unowned string get_commit (); + [Version (since = "1.1.2")] + public uint64 get_download_size (); + [Version (since = "1.1.2")] + public uint64 get_installed_size (); + [Version (since = "1.7.3")] + public bool get_is_skipped (); + public unowned GLib.KeyFile get_metadata (); + public unowned GLib.KeyFile get_old_metadata (); + public Flatpak.TransactionOperationType get_operation_type (); + public unowned string get_ref (); + [Version (since = "1.7.3")] + public unowned GLib.GenericArray? get_related_to_ops (); + public unowned string get_remote (); + [Version (since = "1.9.1")] + public bool get_requires_authentication (); + [CCode (array_length = false, array_null_terminated = true)] + [Version (since = "1.9.1")] + public unowned string[] get_subpaths (); + } + [CCode (cheader_filename = "flatpak.h", type_id = "flatpak_transaction_progress_get_type ()")] + public class TransactionProgress : GLib.Object { + [CCode (has_construct_function = false)] + protected TransactionProgress (); + [Version (since = "1.1.2")] + public uint64 get_bytes_transferred (); + public bool get_is_estimating (); + public int get_progress (); + [Version (since = "1.1.2")] + public uint64 get_start_time (); + public string get_status (); + public void set_update_frequency (uint update_interval); + public signal void changed (); + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_INSTALL_FLAGS_", type_id = "flatpak_install_flags_get_type ()")] + [Flags] + public enum InstallFlags { + NONE, + NO_STATIC_DELTAS, + NO_DEPLOY, + NO_PULL, + NO_TRIGGERS + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_LAUNCH_FLAGS_", type_id = "flatpak_launch_flags_get_type ()")] + [Flags] + public enum LaunchFlags { + NONE, + DO_NOT_REAP + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_QUERY_FLAGS_", type_id = "flatpak_query_flags_get_type ()")] + [Flags] + [Version (since = "1.3.3")] + public enum QueryFlags { + NONE, + ONLY_CACHED, + ONLY_SIDELOADED, + ALL_ARCHES + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_REF_KIND_", type_id = "flatpak_ref_kind_get_type ()")] + public enum RefKind { + APP, + RUNTIME + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_REMOTE_TYPE_", type_id = "flatpak_remote_type_get_type ()")] + public enum RemoteType { + STATIC, + USB, + LAN + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_STORAGE_TYPE_", type_id = "flatpak_storage_type_get_type ()")] + [Version (since = "0.6.15")] + public enum StorageType { + DEFAULT, + HARD_DISK, + SDCARD, + MMC, + NETWORK + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_TRANSACTION_ERROR_DETAILS_", type_id = "flatpak_transaction_error_details_get_type ()")] + [Flags] + public enum TransactionErrorDetails { + NON_FATAL + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_TRANSACTION_OPERATION_", type_id = "flatpak_transaction_operation_type_get_type ()")] + public enum TransactionOperationType { + INSTALL, + UPDATE, + INSTALL_BUNDLE, + UNINSTALL, + LAST_TYPE; + public unowned string to_string (); + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_TRANSACTION_REMOTE_", type_id = "flatpak_transaction_remote_reason_get_type ()")] + public enum TransactionRemoteReason { + GENERIC_REPO, + RUNTIME_DEPS + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_TRANSACTION_RESULT_NO_", type_id = "flatpak_transaction_result_get_type ()")] + [Flags] + public enum TransactionResult { + CHANGE + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_UNINSTALL_FLAGS_", type_id = "flatpak_uninstall_flags_get_type ()")] + [Flags] + [Version (since = "0.11.8")] + public enum UninstallFlags { + NONE, + NO_PRUNE, + NO_TRIGGERS + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_UPDATE_FLAGS_", type_id = "flatpak_update_flags_get_type ()")] + [Flags] + public enum UpdateFlags { + NONE, + NO_DEPLOY, + NO_PULL, + NO_STATIC_DELTAS, + NO_PRUNE, + NO_TRIGGERS + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_ERROR_", type_id = "flatpak_error_get_type ()")] + public errordomain Error { + ALREADY_INSTALLED, + NOT_INSTALLED, + ONLY_PULLED, + DIFFERENT_REMOTE, + ABORTED, + SKIPPED, + NEED_NEW_FLATPAK, + REMOTE_NOT_FOUND, + RUNTIME_NOT_FOUND, + DOWNGRADE, + INVALID_REF, + INVALID_DATA, + UNTRUSTED, + SETUP_FAILED, + EXPORT_FAILED, + REMOTE_USED, + RUNTIME_USED, + INVALID_NAME, + OUT_OF_SPACE, + WRONG_USER, + NOT_CACHED, + REF_NOT_FOUND, + PERMISSION_DENIED, + AUTHENTICATION_FAILED, + NOT_AUTHORIZED; + public static GLib.Quark quark (); + } + [CCode (cheader_filename = "flatpak.h", cprefix = "FLATPAK_PORTAL_ERROR_", type_id = "flatpak_portal_error_get_type ()")] + public errordomain PortalError { + FAILED, + INVALID_ARGUMENT, + NOT_FOUND, + EXISTS, + NOT_ALLOWED, + CANCELLED, + WINDOW_DESTROYED; + public static GLib.Quark quark (); + } + [CCode (cheader_filename = "flatpak.h", instance_pos = 3.9)] + public delegate void ProgressCallback (string status, uint progress, bool estimating); + [CCode (cheader_filename = "flatpak.h", cname = "FLATPAK_MAJOR_VERSION")] + public const int MAJOR_VERSION; + [CCode (cheader_filename = "flatpak.h", cname = "FLATPAK_MICRO_VERSION")] + public const int MICRO_VERSION; + [CCode (cheader_filename = "flatpak.h", cname = "FLATPAK_MINOR_VERSION")] + public const int MINOR_VERSION; + [CCode (cheader_filename = "flatpak.h")] + [Version (replacement = "Error.quark")] + public static GLib.Quark error_quark (); + [CCode (cheader_filename = "flatpak.h")] + public static unowned string get_default_arch (); + [CCode (array_length = false, array_null_terminated = true, cheader_filename = "flatpak.h")] + public static unowned string[] get_supported_arches (); + [CCode (cheader_filename = "flatpak.h")] + [Version (since = "0.8")] + public static GLib.GenericArray get_system_installations (GLib.Cancellable? cancellable = null) throws GLib.Error; + [CCode (cheader_filename = "flatpak.h")] + [Version (replacement = "PortalError.quark")] + public static GLib.Quark portal_error_quark (); + [CCode (cheader_filename = "flatpak.h")] + [Version (replacement = "TransactionOperationType.to_string")] + public static unowned string transaction_operation_type_to_string (Flatpak.TransactionOperationType kind); +}