(key)
| 746 | } |
| 747 | |
| 748 | _defaultIcon(key) { |
| 749 | let split = key.replaceAll('_', ' ').trim().split(' ')[0].split('-'); |
| 750 | let type = split[0]; |
| 751 | |
| 752 | let icon = new St.Icon({ |
| 753 | style_class: 'system-status-icon vitals-panel-icon-' + type, |
| 754 | reactive: true |
| 755 | }); |
| 756 | |
| 757 | // second condition prevents crash due to issue #225, which started when _max_ was moved to the end |
| 758 | // don't use the default system icon if the type is a gpu; use the universal gpu icon instead |
| 759 | if (type == 'default' || (!(type in this._sensorIcons) && !type.startsWith('gpu'))) { |
| 760 | icon.gicon = Gio.icon_new_for_string(this._sensorIconPath('system')); |
| 761 | } else { // support for hide icons #80 |
| 762 | let iconObj = (split.length == 2)?'icon-' + split[1]:'icon'; |
| 763 | icon.gicon = Gio.icon_new_for_string(this._sensorIconPath(type, iconObj)); |
| 764 | } |
| 765 | |
| 766 | return icon; |
| 767 | } |
| 768 | |
| 769 | _sensorIconPath(sensor, icon = 'icon') { |
| 770 | // If the sensor is a numbered gpu, use the gpu icon. Otherwise use whatever icon associated with the sensor name. |
no test coverage detected