Skip to content

Commit

Permalink
Correctly track changes to the focus-mode property
Browse files Browse the repository at this point in the history
  • Loading branch information
Rmano committed Dec 30, 2023
1 parent f13d6a1 commit ad21613
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions [email protected]/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ function _switch() {
Main.notify("Switch Focus Mode",
"Setting Focus-Follow-Mouse(" + _ffm_variant(p_sloppy) + ")");
}
button.set_child(icon_f);
// no need: taking care by the changed signal!
// button.set_child(icon_f);
wm_prefs.set_string('focus-mode', _ffm_variant(p_sloppy));
} else { // sloppy or mouse
if (pNotify) {
Main.notify("Switch Focus Mode", "Setting Click-to-focus");
}
button.set_child(icon_c);
// no need: taking care by the changed signal!
// button.set_child(icon_c);
wm_prefs.set_string('focus-mode', 'click');
}
}
Expand Down Expand Up @@ -67,12 +69,14 @@ export default class SwitchFocusType extends Extension {
// get settings
my_prefs= this.getSettings();
this._connectionId = button.connect('button-press-event', _switch);
this._setconnectionId = wm_prefs.connect('changed::focus-mode', (s, k) => { _sync() });
// start with the current mode --- sync icon
_sync();
Main.panel._rightBox.insert_child_at_index(button, 0);
}
disable() {
button.disconnect(this._connectionId);
wm_prefs.disconnect(this._setconnectionId);
Main.panel._rightBox.remove_child(button);
button?.destroy();
button = null;
Expand Down
2 changes: 1 addition & 1 deletion [email protected]/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"url": "https://github.com/Rmano/gse-switch-focus-mode",
"uuid": "[email protected]",
"settings-schema": "org.gnome.shell.extensions.switchfocustype",
"version": 14
"version": 15
}

0 comments on commit ad21613

Please sign in to comment.