Skip to content

Commit

Permalink
Merge pull request #413 from corecoding/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
corecoding authored Mar 8, 2024
2 parents 1224212 + 29ebca7 commit c2348f1
Show file tree
Hide file tree
Showing 31 changed files with 192 additions and 37 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,22 @@ Vitals is a GNOME Shell extension for displaying your computer's temperature, vo
## Credits
Vitals was originally forked from [gnome-shell-extension-freon](https://github.com/UshakovVasilii/gnome-shell-extension-freon). I was having trouble finding an up to date, resource friendly and fully featured system monitoring tool. My biggest pet peeve was random system delays because of I/O blocking polls, and thus, the idea for Vitals was born! It has been refactored several times over, so most of the code is new or different.

### Icons
## Icons

### Original Theme
* (voltage|fan)-symbolic.svg - inherited from Freon project.
* (system|storage)-symbolic.svg - from Pop! OS theme.
* temperature-symbolic.svg - [iconnice studio](https://www.iconfinder.com/iconnice).
* (cpu|memory)-symbolic.svg - [DinosoftLabs](https://www.iconfinder.com/dinosoftlabs).
* network\*.svg - [Yannick Lung](https://www.iconfinder.com/yanlu).
* Health icon - [Dod Cosmin](https://www.iconfinder.com/icons/458267/cross_doctor_drug_health_healthcare_hospital_icon).

### GNOME Theme
* (battery | storage)-symbolic.svg - from [Adwaita Icon Theme](https://gitlab.gnome.org/GNOME/adwaita-icon-theme).
* (memory | network* | system | voltage)-symbolic.svg - from [Icon Development Kit](https://gitlab.gnome.org/Teams/Design/icon-development-kit).
* fan-symbolic.svg - inherited from [Freon](https://github.com/UshakovVasilii/gnome-shell-extension-freon) project, with mild modifications.
* (temperature | cpu)-symbolic.svg - designed by [daudix](https://github.com/daudix).

## Disclaimer
Sensor data is obtained from the system using hwmon and GTop. Core Coding and the Vitals authors are not responsible for improperly represented data. No warranty expressed or implied.

Expand Down
31 changes: 29 additions & 2 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ var VitalsMenuButton = GObject.registerClass({
'gpu' : { 'icon': 'gpu-symbolic.svg' }
}

// list with the prefixes for the according themes, the index of each
// item must match the index on the combo box
this._sensorsIconPathPrefix = ['/icons/original/', '/icons/gnome/'];

this._warnings = [];
this._sensorMenuItems = {};
this._hotLabels = {};
Expand Down Expand Up @@ -75,6 +79,7 @@ var VitalsMenuButton = GObject.registerClass({
this._addSettingChangedSignal('update-time', this._updateTimeChanged.bind(this));
this._addSettingChangedSignal('position-in-panel', this._positionInPanelChanged.bind(this));
this._addSettingChangedSignal('menu-centered', this._positionInPanelChanged.bind(this));
this._addSettingChangedSignal('icon-style', this._iconStyleChanged.bind(this));

let settings = [ 'use-higher-precision', 'alphabetize', 'hide-zeros', 'fixed-widths', 'hide-icons', 'unit', 'memory-measurement', 'include-public-ip', 'network-speed-format', 'storage-measurement', 'include-static-info', 'include-static-gpu-info' ];
for (let setting of Object.values(settings))
Expand Down Expand Up @@ -291,7 +296,7 @@ var VitalsMenuButton = GObject.registerClass({
}

_positionInPanelChanged() {
this.container.get_parent().remove_actor(this.container);
this.container.get_parent().remove_child(this.container);
let position = this._positionInPanel();

// allows easily addressable boxes
Expand All @@ -305,6 +310,27 @@ var VitalsMenuButton = GObject.registerClass({
boxes[position[0]].insert_child_at_index(this.container, position[1]);
}

_redrawDetailsMenuIcons() {
// updates the icons on the 'details' menu, the one
// you have to click to appear
this._sensors.resetHistory();
for (const sensor in this._sensorIcons) {
if (sensor == "gpu") continue;
this._groups[sensor].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath(sensor));
}

// gpu's are indexed differently, handle them here
const gpuKeys = Object.keys(this._groups).filter(key => key.startsWith("gpu#"));
gpuKeys.forEach((gpuKey) => {
this._groups[gpuKey].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath("gpu"));
});
}

_iconStyleChanged() {
this._redrawDetailsMenuIcons();
this._redrawMenu();
}

_removeHotLabel(key) {
if (key in this._hotLabels) {
let label = this._hotLabels[key];
Expand Down Expand Up @@ -498,7 +524,8 @@ var VitalsMenuButton = GObject.registerClass({
let sensorKey = sensor;
if(sensor.startsWith('gpu')) sensorKey = 'gpu';

return this._extensionObject.path + '/icons/' + this._sensorIcons[sensorKey][icon];
const iconPathPrefixIndex = this._settings.get_int('icon-style');
return this._extensionObject.path + this._sensorsIconPathPrefix[iconPathPrefixIndex] + this._sensorIcons[sensorKey][icon];
}

_ucFirst(string) {
Expand Down
File renamed without changes
1 change: 1 addition & 0 deletions icons/gnome/cpu-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/gnome/fan-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
1 change: 1 addition & 0 deletions icons/gnome/memory-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/gnome/network-download-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/gnome/network-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/gnome/network-upload-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/gnome/storage-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/gnome/system-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/gnome/temperature-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions icons/gnome/voltage-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions icons/original/battery-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
15 changes: 15 additions & 0 deletions icons/original/gpu-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
6 changes: 4 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"_generated": "Generated by SweetTooth, do not edit",
"description": "A glimpse into your computer's temperature, voltage, fan speed, memory usage, processor load, system resources, network speed and storage stats. This is a one stop shop to monitor all of your vital sensors. Uses asynchronous polling to provide a smooth user experience. Feature requests or bugs? Please use GitHub.",
"gettext-domain": "vitals",
"name": "Vitals",
Expand All @@ -9,5 +8,8 @@
],
"url": "https://github.com/corecoding/Vitals",
"uuid": "[email protected]",
"version": 64
"version": 66,
"donations": {
"paypal": "corecoding"
}
}
2 changes: 1 addition & 1 deletion prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const Settings = new GObject.Class({
}

// process individual drop down sensor preferences
sensors = [ 'position-in-panel', 'unit', 'network-speed-format', 'memory-measurement', 'storage-measurement', 'battery-slot' ];
sensors = [ 'position-in-panel', 'unit', 'network-speed-format', 'memory-measurement', 'storage-measurement', 'battery-slot', 'icon-style' ];
for (let key in sensors) {
let sensor = sensors[key];

Expand Down
Loading

0 comments on commit c2348f1

Please sign in to comment.