Skip to content

Commit 0fe6c10

Browse files
committed
🔧 Incorporate text scaling factor in pointer position
1 parent 8666b0d commit 0fe6c10

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

extension.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,15 @@ export default class KandoIntegration extends Extension {
5858

5959
// Exports the DBus interface.
6060
enable() {
61+
6162
// Do nothing on X11.
6263
if (!Meta.is_wayland_compositor()) {
6364
return;
6465
}
66+
67+
// This is used to get the desktop's text scaling factor.
68+
this._shellSettings = new Gio.Settings({schema: 'org.gnome.desktop.interface'});
69+
6570
this._dbus = Gio.DBusExportedObject.wrapJSObject(DBUS_INTERFACE, this);
6671
this._dbus.export(Gio.DBus.session, '/org/gnome/shell/extensions/KandoIntegration');
6772

@@ -87,6 +92,8 @@ export default class KandoIntegration extends Extension {
8792
return;
8893
}
8994

95+
this._shellSettings = null;
96+
9097
this._dbus.flush();
9198
this._dbus.unexport();
9299
this._dbus = null;
@@ -116,7 +123,12 @@ export default class KandoIntegration extends Extension {
116123

117124
const [x, y] = global.get_pointer();
118125

119-
return [windowName, windowClass, x, y];
126+
const scalingFactor = this._shellSettings.get_double('text-scaling-factor');
127+
128+
return [
129+
windowName, windowClass, Math.round(x / scalingFactor),
130+
Math.round(y / scalingFactor)
131+
];
120132
}
121133

122134
// Warps the mouse pointer by the given distance.

0 commit comments

Comments
 (0)