Skip to content

Commit

Permalink
Makes system monitor command configurable. Solves corecoding#220
Browse files Browse the repository at this point in the history
  • Loading branch information
luixal committed Jul 26, 2022
1 parent 5f55d34 commit 5b3996b
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
4 changes: 2 additions & 2 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var VitalsMenuButton = GObject.registerClass({
this._addSettingChangedSignal('update-time', this._updateTimeChanged.bind(this));
this._addSettingChangedSignal('position-in-panel', this._positionInPanelChanged.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' ];
let settings = [ 'use-higher-precision', 'alphabetize', 'hide-zeros', 'fixed-widths', 'hide-icons', 'unit', 'memory-measurement', 'include-public-ip', 'network-speed-format', 'storage-measurement', 'monitor-cmd' ];
for (let setting of Object.values(settings))
this._addSettingChangedSignal(setting, this._redrawMenu.bind(this));

Expand Down Expand Up @@ -143,7 +143,7 @@ var VitalsMenuButton = GObject.registerClass({
let monitorButton = this._createRoundButton('org.gnome.SystemMonitor-symbolic', _('System Monitor'));
monitorButton.connect('clicked', (self) => {
this.menu._getTopMenu().close();
Util.spawn(['gnome-system-monitor']);
Util.spawn([this._settings.get_string('monitor-cmd')]);
});
customButtonBox.add_actor(monitorButton);

Expand Down
2 changes: 1 addition & 1 deletion prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const Settings = new GObject.Class({
this._settings.bind('update-time', this.builder.get_object('update-time'), 'value', Gio.SettingsBindFlags.DEFAULT);

// process individual text entry sensor preferences
sensors = [ 'storage-path' ];
sensors = [ 'storage-path', 'monitor-cmd' ];
for (let key in sensors) {
let sensor = sensors[key];

Expand Down
43 changes: 38 additions & 5 deletions prefs.ui
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
</object>
<object class="GtkBox" id="prefs-container">
<property name="visible">0</property>
<property name="can_focus">0</property>
<property name="can_focus">1</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin_top">6</property>
Expand All @@ -100,13 +100,13 @@
<property name="spacing">2</property>
<child>
<object class="GtkBox">
<property name="can_focus">0</property>
<property name="can_focus">1</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="homogeneous">1</property>
<child>
<object class="GtkBox">
<property name="can_focus">0</property>
<property name="can_focus">1</property>
<property name="margin-start">12</property>
<property name="margin-end">9</property>
<property name="margin_top">12</property>
Expand All @@ -126,10 +126,10 @@
</child>
<child>
<object class="GtkFrame">
<property name="can_focus">0</property>
<property name="can_focus">1</property>
<property name="child">
<object class="GtkListBox">
<property name="can_focus">0</property>
<property name="can_focus">1</property>
<property name="selection_mode">none</property>
<child>
<object class="GtkListBoxRow">
Expand Down Expand Up @@ -337,6 +337,39 @@
</property>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="width_request">100</property>
<property name="hexpand">1</property>
<property name="selectable">1</property>
<property name="child">
<object class="GtkBox">
<property name="can_focus">1</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel">
<property name="hexpand">1</property>
<property name="can_focus">1</property>
<property name="halign">start</property>
<property name="label" translatable="yes">System Monitor cmd</property>
</object>
</child>
<child>
<object class="GtkEntry" id="monitor-cmd">
<property name="placeholder_text" translatable="no"></property>
<property name="can_focus">1</property>
<property name="editable">1</property>
<property name="width_chars">24</property>
</object>
</child>
</object>
</property>
</object>
</child>
</object>
</property>
<child type="label_item">
Expand Down
Binary file modified schemas/gschemas.compiled
Binary file not shown.
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 @@ -121,5 +121,10 @@
<summary>Hide icons in top bar</summary>
<description>Keep top bar clean by only showing sensor values</description>
</key>
<key type="s" name="monitor-cmd">
<default>"my-gnome-monitor"</default>
<summary>System Monitor command</summary>
<description>The command run when system monitor button is clicked</description>
</key>
</schema>
</schemalist>

0 comments on commit 5b3996b

Please sign in to comment.