[gnome] Update extensions for version 48

This commit is contained in:
2025-03-29 17:52:56 -04:00
parent e01589e836
commit a84b79ca08
153 changed files with 3479 additions and 2189 deletions

View File

@ -25,10 +25,10 @@ var VitalsMenuButton = GObject.registerClass({
}, class VitalsMenuButton extends PanelMenu.Button {
_init(extensionObject) {
super._init(Clutter.ActorAlign.FILL);
this._extensionObject = extensionObject;
this._settings = extensionObject.getSettings();
this._sensorIcons = {
'temperature' : { 'icon': 'temperature-symbolic.svg' },
'voltage' : { 'icon': 'voltage-symbolic.svg' },
@ -67,8 +67,7 @@ var VitalsMenuButton = GObject.registerClass({
x_align: Clutter.ActorAlign.START,
y_align: Clutter.ActorAlign.CENTER,
reactive: true,
x_expand: true,
pack_start: false
x_expand: true
});
this._drawMenu();
@ -109,7 +108,7 @@ var VitalsMenuButton = GObject.registerClass({
this._initializeMenuGroup(sensor, sensor);
}
for (let i = 1; i <= this._numGpus; i++)
this._initializeMenuGroup('gpu#' + i, 'gpu', (this._numGpus > 1 ? ' ' + i : ''));
@ -128,8 +127,7 @@ var VitalsMenuButton = GObject.registerClass({
x_align: Clutter.ActorAlign.CENTER,
y_align: Clutter.ActorAlign.CENTER,
reactive: true,
x_expand: true,
pack_start: false
x_expand: true
});
// custom round refresh button
@ -255,7 +253,7 @@ var VitalsMenuButton = GObject.registerClass({
}
);
}
_createHotItem(key, value) {
let icon = this._defaultIcon(key);
this._hotIcons[key] = icon;
@ -291,7 +289,7 @@ var VitalsMenuButton = GObject.registerClass({
if(sensorName === 'gpu') {
for(let i = 1; i <= this._numGpus; i++)
this._groups[sensorName + '#' + i].visible = this._settings.get_boolean(sensor);
} else
} else
this._groups[sensorName].visible = this._settings.get_boolean(sensor);
}
@ -417,8 +415,7 @@ var VitalsMenuButton = GObject.registerClass({
}
}
}
if(key === "_gpu#1_domain_number_")
console.error('UPDATING: ', key);
// have we added this sensor before?
let item = this._sensorMenuItems[key];
if (item) {
@ -565,9 +562,8 @@ var VitalsMenuButton = GObject.registerClass({
arrow_pos = 0;
break;
}
let centered = this._settings.get_boolean('menu-centered')
if (centered) arrow_pos = 0.5;
// set arrow position when initializing and moving vitals
@ -605,7 +601,7 @@ var VitalsMenuButton = GObject.registerClass({
this._newGpuDetected = true;
return;
}
this._numGpus = parseInt(split[1]);
this._newGpuDetectedCount = 0;
this._newGpuDetected = false;

View File

@ -1 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#222"><path fill-opacity=".349" d="M12 1a1 1 0 0 1 .707.293l3 3a1 1 0 0 1 0 1.414l-3 3a1 1 0 1 1-1.414-1.414L12.586 6H5c-.55 0-1-.45-1-1s.45-1 1-1h7.586l-1.293-1.293A1 1 0 0 1 12 1m0 0"/><path d="M4 15a1 1 0 0 1-.707-.293l-3-3a1 1 0 0 1 0-1.414l3-3a1 1 0 1 1 1.414 1.414L3.414 10H11c.55 0 1 .45 1 1s-.45 1-1 1H3.414l1.293 1.293A1 1 0 0 1 4 15m0 0"/></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222" fill-rule="evenodd"><path d="m 1 3.914062 c 0.003906 -0.257812 0.105469 -0.511718 0.304688 -0.703124 l 3 -2.917969 c 0.386718 -0.3789065 1.003906 -0.3789065 1.394531 0 l 3 2.917969 c 0.394531 0.382812 0.402343 1.015624 0.019531 1.414062 c -0.386719 0.394531 -1.019531 0.402344 -1.417969 0.015625 l -1.300781 -1.265625 v 6.550781 c 0 1.332031 -2 1.332031 -2 0 v -6.550781 l -1.300781 1.269531 c -0.398438 0.382813 -1.03125 0.375 -1.414063 -0.019531 c -0.195312 -0.199219 -0.289062 -0.457031 -0.285156 -0.710938 z m 0 0" fill-opacity="0.34902"/><path d="m 7 11.941406 c 0.003906 0.253906 0.105469 0.507813 0.304688 0.703125 l 3 2.917969 c 0.386718 0.375 1.003906 0.375 1.394531 0 l 3 -2.917969 c 0.394531 -0.386719 0.402343 -1.019531 0.019531 -1.414062 c -0.386719 -0.398438 -1.019531 -0.40625 -1.417969 -0.019531 l -1.300781 1.265624 v -6.550781 c 0 -1.332031 -2 -1.332031 -2 0 v 6.550781 l -1.300781 -1.265624 c -0.398438 -0.386719 -1.03125 -0.378907 -1.414063 0.015624 c -0.195312 0.199219 -0.289062 0.457032 -0.285156 0.710938 z m 0 0"/></g></svg>

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path fill="#222" d="M12 1a1 1 0 0 0-.707 1.707L12.586 4H5c-.55 0-1 .45-1 1s.45 1 1 1h7.586l-1.293 1.293a1 1 0 1 0 1.414 1.414l3-3a1 1 0 0 0 0-1.414l-3-3A1 1 0 0 0 12 1M4 7a1 1 0 0 0-.707.293l-3 3a1 1 0 0 0 0 1.414l3 3a1 1 0 1 0 1.414-1.414L3.414 12H11c.55 0 1-.45 1-1s-.45-1-1-1H3.414l1.293-1.293A1 1 0 0 0 4 7m0 0"/></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222" fill-rule="evenodd"><path d="m 1 3.914062 c 0.003906 -0.257812 0.105469 -0.511718 0.304688 -0.703124 l 3 -2.917969 c 0.386718 -0.3789065 1.003906 -0.3789065 1.394531 0 l 3 2.917969 c 0.394531 0.382812 0.402343 1.015624 0.019531 1.414062 c -0.386719 0.394531 -1.019531 0.402344 -1.417969 0.015625 l -1.300781 -1.265625 v 6.550781 c 0 1.332031 -2 1.332031 -2 0 v -6.550781 l -1.300781 1.269531 c -0.398438 0.382813 -1.03125 0.375 -1.414063 -0.019531 c -0.195312 -0.199219 -0.289062 -0.457031 -0.285156 -0.710938 z m 0 0"/><path d="m 7 11.941406 c 0.003906 0.253906 0.105469 0.507813 0.304688 0.703125 l 3 2.917969 c 0.386718 0.375 1.003906 0.375 1.394531 0 l 3 -2.917969 c 0.394531 -0.386719 0.402343 -1.019531 0.019531 -1.414062 c -0.386719 -0.398438 -1.019531 -0.40625 -1.417969 -0.019531 l -1.300781 1.265624 v -6.550781 c 0 -1.332031 -2 -1.332031 -2 0 v 6.550781 l -1.300781 -1.265624 c -0.398438 -0.386719 -1.03125 -0.378907 -1.414063 0.015624 c -0.195312 0.199219 -0.289062 0.457032 -0.285156 0.710938 z m 0 0"/></g></svg>

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><g fill="#222"><path d="M12 1a1 1 0 0 1 .707.293l3 3a1 1 0 0 1 0 1.414l-3 3a1 1 0 1 1-1.414-1.414L12.586 6H5c-.55 0-1-.45-1-1s.45-1 1-1h7.586l-1.293-1.293A1 1 0 0 1 12 1m0 0"/><path fill-opacity=".349" d="M4 15a1 1 0 0 1-.707-.293l-3-3a1 1 0 0 1 0-1.414l3-3a1 1 0 1 1 1.414 1.414L3.414 10H11c.55 0 1 .45 1 1s-.45 1-1 1H3.414l1.293 1.293A1 1 0 0 1 4 15m0 0"/></g></svg>
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" height="16px" viewBox="0 0 16 16" width="16px"><g fill="#222222" fill-rule="evenodd"><path d="m 1 3.914062 c 0.003906 -0.257812 0.105469 -0.511718 0.304688 -0.703124 l 3 -2.917969 c 0.386718 -0.3789065 1.003906 -0.3789065 1.394531 0 l 3 2.917969 c 0.394531 0.382812 0.402343 1.015624 0.019531 1.414062 c -0.386719 0.394531 -1.019531 0.402344 -1.417969 0.015625 l -1.300781 -1.265625 v 6.550781 c 0 1.332031 -2 1.332031 -2 0 v -6.550781 l -1.300781 1.269531 c -0.398438 0.382813 -1.03125 0.375 -1.414063 -0.019531 c -0.195312 -0.199219 -0.289062 -0.457031 -0.285156 -0.710938 z m 0 0"/><path d="m 7 11.941406 c 0.003906 0.253906 0.105469 0.507813 0.304688 0.703125 l 3 2.917969 c 0.386718 0.375 1.003906 0.375 1.394531 0 l 3 -2.917969 c 0.394531 -0.386719 0.402343 -1.019531 0.019531 -1.414062 c -0.386719 -0.398438 -1.019531 -0.40625 -1.417969 -0.019531 l -1.300781 1.265624 v -6.550781 c 0 -1.332031 -2 -1.332031 -2 0 v 6.550781 l -1.300781 -1.265624 c -0.398438 -0.386719 -1.03125 -0.378907 -1.414063 0.015624 c -0.195312 0.199219 -0.289062 0.457032 -0.285156 0.710938 z m 0 0" fill-opacity="0.34902"/></g></svg>

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -10,9 +10,10 @@
"shell-version": [
"45",
"46",
"47"
"47",
"48"
],
"url": "https://github.com/corecoding/Vitals",
"uuid": "Vitals@CoreCoding.com",
"version": 69
"version": 71
}

View File

@ -898,7 +898,7 @@
<property name="halign">start</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="label" translatable="yes">Monitor gpu (beta; NVIDIA only)</property>
<property name="label" translatable="yes">Monitor GPU (beta)</property>
</object>
</child>
<child>
@ -1224,6 +1224,8 @@
<item translatable="yes">BAT2</item>
<item translatable="yes">BATT</item>
<item translatable="yes">CMB0</item>
<item translatable="yes">CMB1</item>
<item translatable="yes">CMB2</item>
<item translatable="yes">macsmc-battery</item>
</items>
</object>

View File

@ -54,6 +54,8 @@ export const Sensors = GObject.registerClass({
this._addSettingChangedSignal('update-time', this._reconfigureNvidiaSmiProcess.bind(this));
//this._addSettingChangedSignal('include-static-gpu-info', this._reconfigureNvidiaSmiProcess.bind(this));
this._gpu_drm_vendors = null;
this._gpu_drm_indices = null;
this._nvidia_smi_process = null;
this._nvidia_labels = [];
this._bad_split_count = 0;
@ -74,7 +76,7 @@ export const Sensors = GObject.registerClass({
_refreshIPAddress(callback) {
// check IP address
new FileModule.File('https://corecoding.com/vitals.php').read().then(contents => {
new FileModule.File('https://ipv4.corecoding.com').read().then(contents => {
let obj = JSON.parse(contents);
this._returnValue(callback, 'Public IP', obj['IPv4'], 'network', 'string');
}).catch(err => { });
@ -375,20 +377,20 @@ export const Sensors = GObject.registerClass({
_queryBattery(callback) {
let battery_slot = this._settings.get_int('battery-slot');
// addresses issue #161
let battery_key = 'BAT'; // BAT0, BAT1 and BAT2
if (battery_slot == 3) {
battery_slot = 'T';
} else if (battery_slot == 4) {
battery_key = 'CMB'; // CMB0
battery_slot = 0;
} else if (battery_slot == 5) {
battery_key = 'macsmc-battery'; // supports Asahi linux
battery_slot = '';
}
// create a mapping of indices to battery paths (from prefs.ui)
const BATTERY_PATHS = {
0: 'BAT0',
1: 'BAT1',
2: 'BAT2',
3: 'BATT',
4: 'CMB0',
5: 'CMB1',
6: 'CMB2',
7: 'macsmc-battery'
};
// uevent has all necessary fields, no need to read individual files
let battery_path = '/sys/class/power_supply/' + battery_key + battery_slot + '/uevent';
let battery_path = '/sys/class/power_supply/' + BATTERY_PATHS[battery_slot] + '/uevent';
new FileModule.File(battery_path).read("\n").then(lines => {
let output = {};
for (let line of lines) {
@ -496,10 +498,16 @@ export const Sensors = GObject.registerClass({
_queryGpu(callback) {
if (!this._nvidia_smi_process) {
this._disableGpuLabels(callback);
return;
// no nvidia-smi, so we use sysfs DRM if any cards was discovered
if (!this._gpu_drm_indices){
this._disableGpuLabels(callback);
return;
} else {
this._readGpuDrm(callback);
return;
}
}
this._nvidia_smi_process.read('\n').then(lines => {
/// for debugging multi-gpu on systems with only one gpu
/// duplicates the first gpu's data 3 times, for 4 total gpus
@ -510,10 +518,9 @@ export const Sensors = GObject.registerClass({
for (let i = 0; i < lines.length; i++) {
this._parseNvidiaSmiLine(callback, lines[i], i + 1, lines.length > 1);
}
// if we've already updated the static info during the last parse, then stop doing so.
// this is so the _parseNvidiaSmiLine function won't return static info anymore
// if we've already updated the static info during the last parse, then stop doing so.
// this is so the _parseNvidiaSmiLine function won't return static info anymore
// and the nvidia-smi commmand won't be queried for static info either
if(!this._nvidia_static_returned) {
this._nvidia_static_returned = true;
@ -544,13 +551,13 @@ export const Sensors = GObject.registerClass({
this._bad_split_count = 0;
let [
label,
label,
fan_speed_pct,
temp_gpu, temp_mem,
temp_gpu, temp_mem,
mem_total, mem_used, mem_reserved, mem_free,
util_gpu, util_mem, util_encoder, util_decoder,
clock_gpu, clock_mem, clock_encode_decode,
power, power_avg,
power, power_avg,
link_gen_current, link_width_current
] = csv_split;
@ -572,12 +579,9 @@ export const Sensors = GObject.registerClass({
}
}
const typeName = 'gpu#' + gpuNum;
const globalLabel = 'GPU' + (multiGpu ? ' ' + gpuNum : '');
const memTempValid = !isNaN(parseInt(temp_mem));
this._returnGpuValue(callback, 'Graphics', parseInt(util_gpu) * 0.01, typeName + '-group', 'percent');
@ -628,6 +632,50 @@ export const Sensors = GObject.registerClass({
this._returnStaticGpuValue(callback, 'Sub Device ID', staticInfo['sub_device_id'], typeName, 'string');
}
_readGpuDrm(callback){
const multiGpu = this._gpu_drm_indices.length > 1;
const unit = this._settings.get_int('memory-measurement') ? 1000 : 1024;
for (let z = 0; z < this._gpu_drm_indices.length; z++ ) {
let i = this._gpu_drm_indices[z];
const typeName = 'gpu#' + i;
const vendor = this._gpu_drm_vendors[z];
// AMD
if(vendor === "0x1002") {
// read GPU usage and create group lebel for card
new FileModule.File('/sys/class/drm/card'+i+'/device/gpu_busy_percent').read().then(value => {
// create group
this._returnGpuValue(callback, 'Graphics', parseInt(value) * 0.01, typeName + '-group', 'percent');
this._returnGpuValue(callback, 'Vendor', "AMD", typeName, 'string');
this._returnGpuValue(callback, 'Usage', parseInt(value) * 0.01, typeName, 'percent');
}).catch(err => {
// nothing to do, keep old value displayed
});
new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_vram_used').read().then(value => {
this._returnGpuValue(callback, 'Memory Used', parseInt(value) / unit, typeName, 'memory');
}).catch(err => {
// nothing to do, keep old value displayed
});
new FileModule.File('/sys/class/drm/card'+i+'/device/mem_info_vram_total').read().then(value => {
this._returnGpuValue(callback, 'Memory Total', parseInt(value) / unit, typeName, 'memory');
}).catch(err => {
// nothing to do, keep old value displayed
});
} else {
// for other vendors only show basic card info
let vendorName = null;
switch (vendor){
case '0x10DE': vendorName = 'NVIDIA'; break; // should be never used as nvidia-smi should be preferred
case '0x13B5': vendorName = 'ARM'; break;
case '0x5143': vendorName = 'Qualcomm'; break;
case '0x8086': vendorName = 'Intel'; break;
default: vendorName = "Unknown " + vendor;
}
this._returnGpuValue(callback, 'Graphics', vendorName, typeName + '-group', 'string');
}
}
}
_disableGpuLabels(callback) {
for (let labelObj of this._nvidia_labels)
this._returnValue(callback, labelObj.label, 'disabled', labelObj.type, labelObj.format);
@ -635,7 +683,7 @@ export const Sensors = GObject.registerClass({
_returnStaticGpuValue(callback, label, value, type, format) {
//if we've already tried to return existing static info before or if the option isn't enabled, then do nothing.
if (this._nvidia_static_returned || !this._settings.get_boolean('include-static-gpu-info'))
if (this._nvidia_static_returned || !this._settings.get_boolean('include-static-gpu-info'))
return;
//we don't need to disable static info labels, so just use ordinary returnValue function
@ -645,7 +693,7 @@ export const Sensors = GObject.registerClass({
_returnGpuValue(callback, label, value, type, format, display = true) {
if(!display) return;
if(value === 'N/A' || value === '[N/A]' || isNaN(value)) return;
if(format !== "string" && (value === 'N/A' || value === '[N/A]' || isNaN(value))) return;
let nvidiaLabel = {'label': label, 'type': type, 'format': format};
if (!this._nvidia_labels.includes(nvidiaLabel))
@ -748,6 +796,27 @@ export const Sensors = GObject.registerClass({
// Launch nvidia-smi subprocess if nvidia querying is enabled
this._reconfigureNvidiaSmiProcess();
this._discoverGpuDrm();
}
_discoverGpuDrm() {
// use DRM only if nvidia-smi is not used
if (this._settings.get_boolean('show-gpu') && this._nvidia_smi_process == null) {
// try to discover up to 10 cards starting from index 0
for(let i = 0; i < 10 ; i++){
new FileModule.File('/sys/class/drm/card'+i+'/device/vendor').read().then(value => {
if(!this._gpu_drm_indices){
this._gpu_drm_indices = [];
this._gpu_drm_vendors = [];
}
this._gpu_drm_indices.push(i);
this._gpu_drm_vendors.push(value);
}).catch(err => { });
}
} else {
this._gpu_drm_vendors = null;
this._gpu_drm_indices = null;
}
}
// The nvidia-smi subprocess will keep running and print new sensor data to stdout every
@ -772,7 +841,7 @@ export const Sensors = GObject.registerClass({
_reconfigureNvidiaSmiProcess() {
if (this._settings.get_boolean('show-gpu')) {
this._terminateNvidiaSmiProcess();
try {
let update_time = this._settings.get_int('update-time');
let query_interval = Math.max(update_time, 1);
@ -786,13 +855,13 @@ export const Sensors = GObject.registerClass({
'clocks.gr,clocks.mem,clocks.video,' +
'power.draw.instant,power.draw.average,' +
'pcie.link.gen.gpucurrent,pcie.link.width.current,' +
(!this._nvidia_static_returned && this._settings.get_boolean('include-static-gpu-info') ?
(!this._nvidia_static_returned && this._settings.get_boolean('include-static-gpu-info') ?
'temperature.gpu.tlimit,' +
'power.limit,' +
'pcie.link.gen.max,pcie.link.width.max,' +
'addressing_mode,'+
'driver_version,vbios_version,serial,' +
'pci.domain,pci.bus,pci.device,pci.device_id,pci.sub_device_id,'
'pci.domain,pci.bus,pci.device,pci.device_id,pci.sub_device_id,'
: ''),
'--format=csv,noheader,nounits',
'-l', query_interval.toString()