diff --git a/README.md b/README.md
index fbc66bfc..f7fb128e 100644
--- a/README.md
+++ b/README.md
@@ -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.

@@ -98,6 +98,7 @@ 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
@@ -105,6 +106,7 @@ Vitals was originally forked from [gnome-shell-extension-freon](https://github.c
* (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.
diff --git a/helpers/catalog.js b/helpers/catalog.js
index af558a5f..f06d41dc 100644
--- a/helpers/catalog.js
+++ b/helpers/catalog.js
@@ -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'] },
diff --git a/icons/gnome/power-symbolic.svg b/icons/gnome/power-symbolic.svg
new file mode 100644
index 00000000..e322a405
--- /dev/null
+++ b/icons/gnome/power-symbolic.svg
@@ -0,0 +1 @@
+
diff --git a/icons/original/power-symbolic.svg b/icons/original/power-symbolic.svg
new file mode 100644
index 00000000..e322a405
--- /dev/null
+++ b/icons/original/power-symbolic.svg
@@ -0,0 +1 @@
+
diff --git a/prefs.js b/prefs.js
index 0cbf6759..0068e868 100644
--- a/prefs.js
+++ b/prefs.js
@@ -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'] },
@@ -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',
diff --git a/prefs.ui b/prefs.ui
index d9b70482..7c4a1c16 100644
--- a/prefs.ui
+++ b/prefs.ui
@@ -164,6 +164,34 @@
+
+
+
memory
@@ -637,6 +665,30 @@
+
+
+ power
+ Power
+ power-symbolic
+
+
+ 10
+ 10
+
+
+ Monitor power
+ show-power
+
+
+ center
+
+
+
+
+
+
+
+
memory
diff --git a/schemas/org.gnome.shell.extensions.vitals.gschema.xml b/schemas/org.gnome.shell.extensions.vitals.gschema.xml
index 75a1733e..cd8e13ee 100644
--- a/schemas/org.gnome.shell.extensions.vitals.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.vitals.gschema.xml
@@ -51,6 +51,11 @@
Monitor fan
Display fan rotation per minute
+
+ true
+ Monitor power
+ Display power draw of various components
+
true
Monitor memory
diff --git a/sensors.js b/sensors.js
index dd36ed3e..ab07f981 100644
--- a/sensors.js
+++ b/sensors.js
@@ -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 {
@@ -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/';
@@ -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) {
@@ -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]) {
diff --git a/stylesheet.css b/stylesheet.css
index 1a751cdc..1c5a1247 100644
--- a/stylesheet.css
+++ b/stylesheet.css
@@ -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 */
@@ -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 */
diff --git a/values.js b/values.js
index c6401080..e217198b 100644
--- a/values.js
+++ b/values.js
@@ -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)));
@@ -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