Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Vitals
====================================

Vitals is a GNOME Shell extension for displaying your computer's temperature, voltage, fan speed, memory usage, processor load, system resources, network speed and storage stats in your GNOME Shell's top menu bar. This is a one stop shop to monitor all of your vital sensors. Vitals uses asynchronous polling to provide a smooth user experience.
Vitals is a GNOME Shell extension for displaying your computer's temperature, voltage, fan speed, power draw, memory usage, processor load, system resources, network speed and storage stats in your GNOME Shell's top menu bar. This is a one stop shop to monitor all of your vital sensors. Vitals uses asynchronous polling to provide a smooth user experience.

![How it works](https://raw.githubusercontent.com/corecoding/Vitals/main/howtouse.gif)

Expand Down Expand Up @@ -98,13 +98,15 @@ Vitals was originally forked from [gnome-shell-extension-freon](https://github.c
* 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).
* power-symbolic.svg - drawn for Vitals.
* 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* | swap | 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).
* power-symbolic.svg - drawn for Vitals.

## 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
1 change: 1 addition & 0 deletions helpers/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export const sensorCatalog = {
'temperature' : { 'icon': 'temperature-symbolic.svg', colorFormats: ['temp'] },
'voltage' : { 'icon': 'voltage-symbolic.svg' },
'fan' : { 'icon': 'fan-symbolic.svg', colorFormats: ['fan'] },
'power' : { 'icon': 'power-symbolic.svg' },
'memory' : { 'icon': 'memory-symbolic.svg', 'icon-swap': 'swap-symbolic.svg', colorFormats: ['percent'] },
'processor' : { 'icon': 'cpu-symbolic.svg', colorFormats: ['percent'] },
'system' : { 'icon': 'system-symbolic.svg', colorFormats: ['load'] },
Expand Down
1 change: 1 addition & 0 deletions icons/gnome/power-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/original/power-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class Settings {
'temperature': { toggle: 'show-temperature', widgets: ['unit'] },
'voltage': { toggle: 'show-voltage', widgets: [] },
'fan': { toggle: 'show-fan', widgets: [] },
'power': { toggle: 'show-power', widgets: [] },
'memory': { toggle: 'show-memory', widgets: ['memory-measurement'] },
'processor': { toggle: 'show-processor', widgets: ['include-static-info', 'include-processor-cores', 'use-processor-cpufreq'] },
'system': { toggle: 'show-system', widgets: ['monitor-cmd'] },
Expand Down Expand Up @@ -302,7 +303,7 @@ class Settings {
let widget;

// process sensor toggles
let sensors = [ 'show-temperature', 'show-voltage', 'show-fan',
let sensors = [ 'show-temperature', 'show-voltage', 'show-fan', 'show-power',
'show-memory', 'show-processor', 'show-system',
'show-network', 'show-storage', 'use-higher-precision',
'alphabetize', 'hide-zeros', 'include-public-ip',
Expand Down
52 changes: 52 additions & 0 deletions prefs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,34 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="name">power</property>
<child>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="spacing">12</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-top">4</property>
<property name="margin-bottom">4</property>
<child>
<object class="GtkImage" id="sidebar-icon-power">
<property name="icon-name">power-symbolic</property>
<property name="pixel-size">16</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label" translatable="yes">Power</property>
<property name="xalign">0</property>
<property name="hexpand">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="name">memory</property>
Expand Down Expand Up @@ -637,6 +665,30 @@
</child>
</object>

<!-- Power -->
<object class="AdwPreferencesPage" id="power-page">
<property name="name">power</property>
<property name="title" translatable="yes">Power</property>
<property name="icon-name">power-symbolic</property>
<child>
<object class="AdwPreferencesGroup">
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<child>
<object class="AdwActionRow">
<property name="title" translatable="yes">Monitor power</property>
<property name="activatable-widget">show-power</property>
<child type="suffix">
<object class="GtkSwitch" id="show-power">
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>

<!-- Memory -->
<object class="AdwPreferencesPage" id="memory-page">
<property name="name">memory</property>
Expand Down
5 changes: 5 additions & 0 deletions schemas/org.gnome.shell.extensions.vitals.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@
<summary>Monitor fan</summary>
<description>Display fan rotation per minute</description>
</key>
<key type="b" name="show-power">
<default>true</default>
<summary>Monitor power</summary>
<description>Display power draw of various components</description>
</key>
<key type="b" name="show-memory">
<default>true</default>
<summary>Monitor memory</summary>
Expand Down
9 changes: 6 additions & 3 deletions sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const Sensors = GObject.registerClass({
continue;
}

if (sensor == 'temperature' || sensor == 'voltage' || sensor == 'fan') {
if (sensor == 'temperature' || sensor == 'voltage' || sensor == 'fan' || sensor == 'power') {
// wantedKeys filters individual hwmon files when the menu is closed
this._queryTempVoltFan(callback, sensor, wantedKeys);
} else {
Expand Down Expand Up @@ -862,7 +862,7 @@ export const Sensors = GObject.registerClass({
}

_discoverHardwareMonitors(callback) {
this._tempVoltFanSensors = { 'temperature': {}, 'voltage': {}, 'fan': {} };
this._tempVoltFanSensors = { 'temperature': {}, 'voltage': {}, 'fan': {}, 'power': {} };

let hwbase = '/sys/class/hwmon/';

Expand All @@ -878,6 +878,9 @@ export const Sensors = GObject.registerClass({
if (this._settings.get_boolean('show-fan'))
sensor_types['fan'] = 'fan';

if (this._settings.get_boolean('show-power'))
sensor_types['power'] = 'power';

// a little informal, but this code has zero I/O block
new FileModule.File(hwbase).list().then(files => {
for (let file of files) {
Expand Down Expand Up @@ -1173,7 +1176,7 @@ export const Sensors = GObject.registerClass({
if (label == 'Package id 1') label = 'Processor 1';
label = label.replace('Package id', 'CPU');

let types = [ 'temperature', 'voltage', 'fan' ];
let types = [ 'temperature', 'voltage', 'fan', 'power' ];
for (let type of types) {
// check if this label already exists
if (label in this._tempVoltFanSensors[type]) {
Expand Down
2 changes: 2 additions & 0 deletions stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
.vitals-panel-icon-gnome.vitals-panel-icon-network-rx { margin-right: 3px; } /* right inset: 3px */
.vitals-panel-icon-gnome.vitals-panel-icon-network { margin-right: 5px; } /* right inset: 1px */
.vitals-panel-icon-gnome.vitals-panel-icon-network-tx { margin-right: 3px; } /* right inset: 3px */
.vitals-panel-icon-gnome.vitals-panel-icon-power { margin-right: 6px; } /* right inset: 0px */
.vitals-panel-icon-gnome.vitals-panel-icon-storage { margin-right: 5px; } /* right inset: 1px */
.vitals-panel-icon-gnome.vitals-panel-icon-system { margin-right: 6px; } /* right inset: 0px */
.vitals-panel-icon-gnome.vitals-panel-icon-temperature { margin-right: 2px; } /* right inset: 4px */
Expand All @@ -23,6 +24,7 @@
.vitals-panel-icon-original.vitals-panel-icon-network-rx { margin-right: 6px; } /* right inset: 0px */
.vitals-panel-icon-original.vitals-panel-icon-network { margin-right: 6px; } /* right inset: 0px */
.vitals-panel-icon-original.vitals-panel-icon-network-tx { margin-right: 6px; } /* right inset: 0px */
.vitals-panel-icon-original.vitals-panel-icon-power { margin-right: 6px; } /* right inset: 0px */
.vitals-panel-icon-original.vitals-panel-icon-storage { margin-right: 4px; } /* right inset: 2px */
.vitals-panel-icon-original.vitals-panel-icon-system { margin-right: 6px; } /* right inset: 0px */
.vitals-panel-icon-original.vitals-panel-icon-temperature { margin-right: 3px; } /* right inset: 3px */
Expand Down
7 changes: 6 additions & 1 deletion values.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ export const Values = GObject.registerClass({
format = ((value >= 0) ? '+' : '-') + ((use_higher_precision)?'%.2f %s':'%.1f %s');
ending = 'V';
break;
case 'power': // hwmon reports microwatts
value = value / 1000000;
format = (use_higher_precision)?'%.2f %s':'%.1f %s';
ending = 'W';
break;
case 'hertz':
if (value > 0) {
exp = Math.max(0, Math.floor(Math.log(value) / Math.log(unit)));
Expand Down Expand Up @@ -277,7 +282,7 @@ export const Values = GObject.registerClass({
this._history[historyType][key] = [legible.text, value];

// process average, min and max values
if (type == 'temperature' || type == 'voltage' || type == 'fan') {
if (type == 'temperature' || type == 'voltage' || type == 'fan' || type == 'power') {
let vals = Object.values(this._history[type]).map(x => parseFloat(x[1]));

// show value in group even if there is one value present
Expand Down