diff --git a/files/system-monitor-graph@rcassani/desklet.js b/files/system-monitor-graph@rcassani/desklet.js index 4b26329..4f4633c 100644 --- a/files/system-monitor-graph@rcassani/desklet.js +++ b/files/system-monitor-graph@rcassani/desklet.js @@ -827,49 +827,94 @@ SystemMonitorGraph.prototype = { }, get_nvidia_gpu_use: function() { - let subprocess try { - subprocess = Gio.Subprocess.new( + let [success, child_pid, std_in, std_out, std_err] = GLib.spawn_async_with_pipes( + null, ['/usr/bin/nvidia-smi', '--query-gpu=utilization.gpu', '--format=csv', '--id='+ this.gpu_id], - Gio.SubprocessFlags.STDOUT_PIPE|Gio.SubprocessFlags.STDERR_PIPE + null, + GLib.SpawnFlags.DO_NOT_REAP_CHILD | GLib.SpawnFlags.LEAVE_DESCRIPTORS_OPEN, + null ); - } catch (err) { + GLib.close(std_in); + GLib.close(std_err); + GLib.child_watch_add(GLib.PRIORITY_DEFAULT, child_pid, function(pid, wait_status, user_data) { + GLib.spawn_close_pid(child_pid); + }); + if(!success) { + throw new Error(_('Error executing nvidia-smi command.')); + } + let deskletInstance = this; + let ioChannelStdOut = GLib.IOChannel.unix_new(std_out); + let tagWatchStdOut = GLib.io_add_watch( + ioChannelStdOut, GLib.PRIORITY_DEFAULT, + GLib.IOCondition.IN | GLib.IOCondition.HUP, + function(channel, condition, data) { + if(condition != GLib.IOCondition.HUP) { + let [status, out] = channel.read_to_end(); + let out_string = out.toString(); + deskletInstance.gpu_use = parseInt(out_string.match(/[^\r\n]+/g)[1]); // parse integer in second line + } + GLib.source_remove(tagWatchStdOut); + channel.shutdown(true); + } + ); + } catch(error) { + this.gpu_use = 0; return; } - subprocess.communicate_utf8_async(null, null, (subprocess, result) => { - let [, stdout, stderr] = subprocess.communicate_utf8_finish(result); - this.gpu_use = parseInt(stdout.match(/[^\r\n]+/g)[1]); // parse integer in second line - }); }, get_nvidia_gpu_mem: function() { - let subprocess try { - subprocess = Gio.Subprocess.new( + let [success, child_pid, std_in, std_out, std_err] = GLib.spawn_async_with_pipes( + null, ['/usr/bin/nvidia-smi', '--query-gpu=memory.total,memory.used', '--format=csv', '--id='+ this.gpu_id], - Gio.SubprocessFlags.STDOUT_PIPE|Gio.SubprocessFlags.STDERR_PIPE + null, + GLib.SpawnFlags.DO_NOT_REAP_CHILD | GLib.SpawnFlags.LEAVE_DESCRIPTORS_OPEN, + null ); - } catch { + GLib.close(std_in); + GLib.close(std_err); + GLib.child_watch_add(GLib.PRIORITY_DEFAULT, child_pid, function(pid, wait_status, user_data) { + GLib.spawn_close_pid(child_pid); + }); + if(!success) { + throw new Error(_('Error executing nvidia-smi command.')); + } + let deskletInstance = this; + let ioChannelStdOut = GLib.IOChannel.unix_new(std_out); + let tagWatchStdOut = GLib.io_add_watch( + ioChannelStdOut, GLib.PRIORITY_DEFAULT, + GLib.IOCondition.IN | GLib.IOCondition.HUP, + function(channel, condition, data) { + if(condition != GLib.IOCondition.HUP) { + let [status, out] = channel.read_to_end(); + let out_string = out.toString(); + let fslines = out_string.split(/\r?\n/); // Line0:Headers Line1:Values + let items = fslines[1].split(','); // Values are comma-separated + let mem_tot + let mem_usd + if (deskletInstance.data_prefix_gpumem == 1) { + // decimal prefix + mem_tot = parseInt(items[0]) * 1024 * 1024 / GB_TO_B; + mem_usd = parseInt(items[1]) * 1024 * 1024 / GB_TO_B; + } else { + // binary prefix + mem_tot = parseInt(items[0]) / GIB_TO_MIB; + mem_usd = parseInt(items[1]) / GIB_TO_MIB; + } + deskletInstance.gpu_mem[0] = mem_tot; + deskletInstance.gpu_mem[1] = mem_usd; + } + GLib.source_remove(tagWatchStdOut); + channel.shutdown(true); + } + ); + } catch(error) { + this.gpu_mem[0] = 0; + this.gpu_mem[1] = 0; return; } - subprocess.communicate_utf8_async(null, null, (subprocess, result) => { - let [, stdout, stderr] = subprocess.communicate_utf8_finish(result); - let fslines = stdout.split(/\r?\n/); // Line0:Headers Line1:Values - let items = fslines[1].split(','); // Values are comma-separated - let mem_tot - let mem_usd - if (this.data_prefix_gpumem == 1) { - // decimal prefix - mem_tot = parseInt(items[0]) * 1024 * 1024 / GB_TO_B; - mem_usd = parseInt(items[1]) * 1024 * 1024 / GB_TO_B; - } else { - // binary prefix - mem_tot = parseInt(items[0]) / GIB_TO_MIB; - mem_usd = parseInt(items[1]) / GIB_TO_MIB; - } - this.gpu_mem[0] = mem_tot; - this.gpu_mem[1] = mem_usd; - }); }, get_amdgpu_gpu_use: function() { diff --git a/files/system-monitor-graph@rcassani/po/ca.po b/files/system-monitor-graph@rcassani/po/ca.po index 4aa683d..27211b5 100644 --- a/files/system-monitor-graph@rcassani/po/ca.po +++ b/files/system-monitor-graph@rcassani/po/ca.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2023-08-04 22:51+0200\n" "Last-Translator: Daniel \n" "Language-Team: \n" @@ -98,6 +98,10 @@ msgstr "GiB" msgid "KiB" msgstr "GiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "Monitor gràfic del sistema" diff --git a/files/system-monitor-graph@rcassani/po/da.po b/files/system-monitor-graph@rcassani/po/da.po index fde28ab..e16a333 100644 --- a/files/system-monitor-graph@rcassani/po/da.po +++ b/files/system-monitor-graph@rcassani/po/da.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2023-12-08 07:51+0100\n" "Last-Translator: Alan Mortensen \n" "Language-Team: \n" @@ -98,6 +98,10 @@ msgstr "GiB" msgid "KiB" msgstr "GiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "Systemovervågningsgraf" diff --git a/files/system-monitor-graph@rcassani/po/de.po b/files/system-monitor-graph@rcassani/po/de.po index e9aa3b0..38d01b2 100644 --- a/files/system-monitor-graph@rcassani/po/de.po +++ b/files/system-monitor-graph@rcassani/po/de.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2022-04-17 18:13+0100\n" "Last-Translator: Georg Sieber\n" "Language-Team: \n" @@ -96,6 +96,10 @@ msgstr "GiB" msgid "KiB" msgstr "GiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "Systemauslastungs-Graph" diff --git a/files/system-monitor-graph@rcassani/po/es.po b/files/system-monitor-graph@rcassani/po/es.po index 22484a7..4653dd0 100644 --- a/files/system-monitor-graph@rcassani/po/es.po +++ b/files/system-monitor-graph@rcassani/po/es.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2025-08-04 19:01-0400\n" "Last-Translator: Daniel \n" "Language-Team: \n" @@ -95,6 +95,10 @@ msgstr "MiB" msgid "KiB" msgstr "KiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "Error al ejecutar el comando nvidia-smi." + #. metadata.json->name msgid "System monitor graph" msgstr "Gráfico del monitor de sistema" diff --git a/files/system-monitor-graph@rcassani/po/fi.po b/files/system-monitor-graph@rcassani/po/fi.po index 0256278..9992bc4 100644 --- a/files/system-monitor-graph@rcassani/po/fi.po +++ b/files/system-monitor-graph@rcassani/po/fi.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2024-11-09 13:32+0200\n" "Last-Translator: Kimmo Kujansuu \n" "Language-Team: \n" @@ -98,6 +98,10 @@ msgstr "GiB" msgid "KiB" msgstr "GiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "System monitor graph" diff --git a/files/system-monitor-graph@rcassani/po/hu.po b/files/system-monitor-graph@rcassani/po/hu.po index 024be15..1a89902 100644 --- a/files/system-monitor-graph@rcassani/po/hu.po +++ b/files/system-monitor-graph@rcassani/po/hu.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2025-08-04 10:54+0200\n" "Last-Translator: \n" "Language-Team: \n" @@ -95,6 +95,10 @@ msgstr "MiB" msgid "KiB" msgstr "KiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "Rendszerfigyelő grafikonnal" diff --git a/files/system-monitor-graph@rcassani/po/it.po b/files/system-monitor-graph@rcassani/po/it.po index 35bd5c6..14d734d 100644 --- a/files/system-monitor-graph@rcassani/po/it.po +++ b/files/system-monitor-graph@rcassani/po/it.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2025-08-26 19:59+0200\n" "Last-Translator: Dragone2 \n" "Language-Team: \n" @@ -95,6 +95,10 @@ msgstr "MiB" msgid "KiB" msgstr "KiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "Grafico di Monitoraggio del Sistema" diff --git a/files/system-monitor-graph@rcassani/po/nl.po b/files/system-monitor-graph@rcassani/po/nl.po index 30c5100..7628234 100644 --- a/files/system-monitor-graph@rcassani/po/nl.po +++ b/files/system-monitor-graph@rcassani/po/nl.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2025-08-25 16:25+0200\n" "Last-Translator: qadzek\n" "Language-Team: \n" @@ -93,6 +93,10 @@ msgstr "MiB" msgid "KiB" msgstr "KiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "Systeemmonitor grafiek" diff --git a/files/system-monitor-graph@rcassani/po/pt_BR.po b/files/system-monitor-graph@rcassani/po/pt_BR.po index dc8a197..1fbfaa9 100644 --- a/files/system-monitor-graph@rcassani/po/pt_BR.po +++ b/files/system-monitor-graph@rcassani/po/pt_BR.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2021-11-29 15:20-0300\n" "Last-Translator: Marcelo Aof\n" "Language-Team: \n" @@ -98,6 +98,10 @@ msgstr "GiB" msgid "KiB" msgstr "GiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "Gráficos do monitor do sistema" diff --git a/files/system-monitor-graph@rcassani/po/ro.po b/files/system-monitor-graph@rcassani/po/ro.po index f15c4d0..c7007be 100644 --- a/files/system-monitor-graph@rcassani/po/ro.po +++ b/files/system-monitor-graph@rcassani/po/ro.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: 2022-04-17 23:21+0200\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -98,6 +98,10 @@ msgstr "GiB" msgid "KiB" msgstr "GiB" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "Graficul monitorului de sistem" diff --git a/files/system-monitor-graph@rcassani/po/ru.po b/files/system-monitor-graph@rcassani/po/ru.po index d6a959b..4c2f078 100644 --- a/files/system-monitor-graph@rcassani/po/ru.po +++ b/files/system-monitor-graph@rcassani/po/ru.po @@ -4,7 +4,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: \n" "Last-Translator: blogdron\n" "Language-Team: \n" @@ -90,6 +90,10 @@ msgstr "" msgid "KiB" msgstr "" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr "Системный монитор с графиками (System monitor graph)" diff --git a/files/system-monitor-graph@rcassani/po/system-monitor-graph@rcassani.pot b/files/system-monitor-graph@rcassani/po/system-monitor-graph@rcassani.pot index 858fcec..821f884 100644 --- a/files/system-monitor-graph@rcassani/po/system-monitor-graph@rcassani.pot +++ b/files/system-monitor-graph@rcassani/po/system-monitor-graph@rcassani.pot @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: system-monitor-graph@rcassani 2.0\n" "Report-Msgid-Bugs-To: https://github.com/linuxmint/cinnamon-spices-desklets/" "issues\n" -"POT-Creation-Date: 2025-08-01 22:18-0400\n" +"POT-Creation-Date: 2025-08-27 21:38-0400\n" "PO-Revision-Date: \n" "Last-Translator: \n" "Language-Team: \n" @@ -93,6 +93,10 @@ msgstr "" msgid "KiB" msgstr "" +#. desklet.js:844 desklet.js:882 +msgid "Error executing nvidia-smi command." +msgstr "" + #. metadata.json->name msgid "System monitor graph" msgstr ""