Skip to content

Commit

Permalink
locatePointer: Only grab the keybinding if the feature is enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwebster committed Aug 18, 2022
1 parent 2bf2942 commit aab79cc
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions js/ui/locatePointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const LOCATE_POINTER_SCHEMA = "org.cinnamon.muffin"
var locatePointer = class {
constructor() {
this._enabledSettings = new Gio.Settings({schema_id: LOCATE_POINTER_ENABLED_SCHEMA});
this._enabledSettings.connect('changed::locate-pointer', this._updateKey.bind(this));
this._keySettings = new Gio.Settings({schema_id: LOCATE_POINTER_SCHEMA});
this._keySettings.connect('changed::locate-pointer-key', this._updateKey.bind(this));
this._updateKey();
Expand All @@ -19,14 +20,15 @@ var locatePointer = class {
}

_updateKey() {
let modifierKey = this._keySettings.get_string('locate-pointer-key');
Main.keybindingManager.addHotKey('locate-pointer', modifierKey, () => { this.show() });
if (this._enabledSettings.get_boolean("locate-pointer")) {
let modifierKey = this._keySettings.get_string('locate-pointer-key');
Main.keybindingManager.addHotKey('locate-pointer', modifierKey, () => { this.show() });
} else {
Main.keybindingManager.removeHotKey('locate-pointer');
}
}

show() {
if (!this._enabledSettings.get_boolean("locate-pointer"))
return;

let [x, y, mods] = global.get_pointer();
this._ripples.playAnimation(x, y);
}
Expand Down

0 comments on commit aab79cc

Please sign in to comment.