Skip to content

Commit aab79cc

Browse files
committed
locatePointer: Only grab the keybinding if the feature is enabled.
1 parent 2bf2942 commit aab79cc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

js/ui/locatePointer.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const LOCATE_POINTER_SCHEMA = "org.cinnamon.muffin"
1010
var locatePointer = class {
1111
constructor() {
1212
this._enabledSettings = new Gio.Settings({schema_id: LOCATE_POINTER_ENABLED_SCHEMA});
13+
this._enabledSettings.connect('changed::locate-pointer', this._updateKey.bind(this));
1314
this._keySettings = new Gio.Settings({schema_id: LOCATE_POINTER_SCHEMA});
1415
this._keySettings.connect('changed::locate-pointer-key', this._updateKey.bind(this));
1516
this._updateKey();
@@ -19,14 +20,15 @@ var locatePointer = class {
1920
}
2021

2122
_updateKey() {
22-
let modifierKey = this._keySettings.get_string('locate-pointer-key');
23-
Main.keybindingManager.addHotKey('locate-pointer', modifierKey, () => { this.show() });
23+
if (this._enabledSettings.get_boolean("locate-pointer")) {
24+
let modifierKey = this._keySettings.get_string('locate-pointer-key');
25+
Main.keybindingManager.addHotKey('locate-pointer', modifierKey, () => { this.show() });
26+
} else {
27+
Main.keybindingManager.removeHotKey('locate-pointer');
28+
}
2429
}
2530

2631
show() {
27-
if (!this._enabledSettings.get_boolean("locate-pointer"))
28-
return;
29-
3032
let [x, y, mods] = global.get_pointer();
3133
this._ripples.playAnimation(x, y);
3234
}

0 commit comments

Comments
 (0)