Skip to content

Commit c2348f1

Browse files
authored
Merge pull request #413 from corecoding/develop
Develop
2 parents 1224212 + 29ebca7 commit c2348f1

31 files changed

Lines changed: 192 additions & 37 deletions

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,22 @@ Vitals is a GNOME Shell extension for displaying your computer's temperature, vo
8686
## Credits
8787
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.
8888

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

99+
### GNOME Theme
100+
* (battery | storage)-symbolic.svg - from [Adwaita Icon Theme](https://gitlab.gnome.org/GNOME/adwaita-icon-theme).
101+
* (memory | network* | system | voltage)-symbolic.svg - from [Icon Development Kit](https://gitlab.gnome.org/Teams/Design/icon-development-kit).
102+
* fan-symbolic.svg - inherited from [Freon](https://github.com/UshakovVasilii/gnome-shell-extension-freon) project, with mild modifications.
103+
* (temperature | cpu)-symbolic.svg - designed by [daudix](https://github.com/daudix).
104+
97105
## Disclaimer
98106
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.
99107

extension.js

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ var VitalsMenuButton = GObject.registerClass({
4444
'gpu' : { 'icon': 'gpu-symbolic.svg' }
4545
}
4646

47+
// list with the prefixes for the according themes, the index of each
48+
// item must match the index on the combo box
49+
this._sensorsIconPathPrefix = ['/icons/original/', '/icons/gnome/'];
50+
4751
this._warnings = [];
4852
this._sensorMenuItems = {};
4953
this._hotLabels = {};
@@ -75,6 +79,7 @@ var VitalsMenuButton = GObject.registerClass({
7579
this._addSettingChangedSignal('update-time', this._updateTimeChanged.bind(this));
7680
this._addSettingChangedSignal('position-in-panel', this._positionInPanelChanged.bind(this));
7781
this._addSettingChangedSignal('menu-centered', this._positionInPanelChanged.bind(this));
82+
this._addSettingChangedSignal('icon-style', this._iconStyleChanged.bind(this));
7883

7984
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' ];
8085
for (let setting of Object.values(settings))
@@ -291,7 +296,7 @@ var VitalsMenuButton = GObject.registerClass({
291296
}
292297

293298
_positionInPanelChanged() {
294-
this.container.get_parent().remove_actor(this.container);
299+
this.container.get_parent().remove_child(this.container);
295300
let position = this._positionInPanel();
296301

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

313+
_redrawDetailsMenuIcons() {
314+
// updates the icons on the 'details' menu, the one
315+
// you have to click to appear
316+
this._sensors.resetHistory();
317+
for (const sensor in this._sensorIcons) {
318+
if (sensor == "gpu") continue;
319+
this._groups[sensor].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath(sensor));
320+
}
321+
322+
// gpu's are indexed differently, handle them here
323+
const gpuKeys = Object.keys(this._groups).filter(key => key.startsWith("gpu#"));
324+
gpuKeys.forEach((gpuKey) => {
325+
this._groups[gpuKey].icon.gicon = Gio.icon_new_for_string(this._sensorIconPath("gpu"));
326+
});
327+
}
328+
329+
_iconStyleChanged() {
330+
this._redrawDetailsMenuIcons();
331+
this._redrawMenu();
332+
}
333+
308334
_removeHotLabel(key) {
309335
if (key in this._hotLabels) {
310336
let label = this._hotLabels[key];
@@ -498,7 +524,8 @@ var VitalsMenuButton = GObject.registerClass({
498524
let sensorKey = sensor;
499525
if(sensor.startsWith('gpu')) sensorKey = 'gpu';
500526

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

504531
_ucFirst(string) {

icons/gnome/cpu-symbolic.svg

Lines changed: 1 addition & 0 deletions
Loading

icons/gnome/fan-symbolic.svg

Lines changed: 1 addition & 0 deletions
Loading

icons/gnome/memory-symbolic.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

icons/gnome/network-symbolic.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)