Skip to content

Commit 63edb23

Browse files
committed
1 parent bc9f772 commit 63edb23

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

Resource_Monitor@Ory0n/prefs.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,7 @@ const ResourceMonitorPrefsWidget = GObject.registerClass(
678678
// Get current disks settings
679679
let gpuTempsArray = this._settings.get_strv(THERMAL_GPU_TEMPERATURE_DEVICES_LIST);
680680

681+
// NVIDIA
681682
this._executeCommand(['nvidia-smi', '-L']).then(output => {
682683
let lines = output.split('\n');
683684

@@ -713,6 +714,48 @@ const ResourceMonitorPrefsWidget = GObject.registerClass(
713714
});
714715
this._settings.set_strv(THERMAL_GPU_TEMPERATURE_DEVICES_LIST, gpuTempsArray);
715716
});
717+
718+
// AMD
719+
//this._executeCommand(['bash', '-c', 'if ls /sys/class/hwmon/hwmon*/temp*_input 1>/dev/null 2>&1; then echo "EXIST"; fi']).then(output => {
720+
// let result = output.split('\n')[0];
721+
// if (result === 'EXIST') {
722+
// this._executeCommand(['bash', '-c', 'for i in /sys/class/hwmon/hwmon*/temp*_input; do NAME="$(<$(dirname $i)/name)"; if [[ "$NAME" == "amdgpu" ]]; then echo "$NAME: $(cat ${i%_*}_label 2>/dev/null || echo $(basename ${i%_*}))-$i"; fi done']).then(output => {
723+
/* let lines = output.split('\n');
724+
725+
for (let i = 0; i < lines.length - 1; i++) {
726+
let line = lines[i];
727+
let entry = line.trim().split(/-/);
728+
729+
let device = entry[0];
730+
let path = entry[1];
731+
732+
let statusButton = false;
733+
734+
// Init gui
735+
for (let i = 0; i < cpuTempsArray.length; i++) {
736+
let element = cpuTempsArray[i];
737+
let it = element.split(THERMAL_CPU_TEMPERATURE_DEVICES_LIST_SEPARATOR);
738+
739+
if (device === it[0]) {
740+
statusButton = (it[1] === 'true');
741+
742+
break;
743+
}
744+
}
745+
746+
this._thermalGpuDevicesModel.set(this._thermalGpuDevicesModel.append(), [0, 1, 2], [uuid, device, statusButton]);
747+
}
748+
749+
// Save new cpuTempsArray with the list of new devices (to remove old devices)
750+
gpuTempsArray = [];
751+
this._thermalGpuDevicesModel.foreach((list, path, iter) => {
752+
gpuTempsArray.push(list.get_value(iter, 0) + GPU_DEVICES_LIST_SEPARATOR + list.get_value(iter, 1) + GPU_DEVICES_LIST_SEPARATOR + list.get_value(iter, 2));
753+
});
754+
this._settings.set_strv(THERMAL_GPU_TEMPERATURE_DEVICES_LIST, gpuTempsArray);
755+
});
756+
}
757+
});
758+
*/
716759
}
717760

718761
_buildGpu() {

0 commit comments

Comments
 (0)