Skip to content

Commit

Permalink
Restored unintendedly reverted support for Gnome 45
Browse files Browse the repository at this point in the history
  • Loading branch information
houmain committed Dec 22, 2023
1 parent 42ef638 commit e5937b7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 31 deletions.
63 changes: 34 additions & 29 deletions extra/share/gnome-shell/extensions/[email protected]/extension.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,40 @@
const Shell = imports.gi.Shell;
const Gio = imports.gi.Gio;
import Shell from 'gi://Shell';
import Gio from 'gi://Gio';

const KeymapperInterface = '<node>\
<interface name="com.github.houmain.Keymapper"> \
<method name="WindowFocus"> \
<arg name="title" type="s" direction="in"/> \
<arg name="class" type="s" direction="in"/> \
</method> \
</interface> \
</node>';
export default class KeymapperExtension {
constructor() {
const KeymapperInterface = '<node>\
<interface name="com.github.houmain.Keymapper"> \
<method name="WindowFocus"> \
<arg name="title" type="s" direction="in"/> \
<arg name="class" type="s" direction="in"/> \
</method> \
</interface> \
</node>';

const KeymapperProxy = Gio.DBusProxy.makeProxyWrapper(KeymapperInterface);
const KeymapperProxy = Gio.DBusProxy.makeProxyWrapper(KeymapperInterface);

const keymapper = new KeymapperProxy(
Gio.DBus.session,
"com.github.houmain.Keymapper",
"/com/github/houmain/Keymapper"
);
this._keymapper = new KeymapperProxy(
Gio.DBus.session,
"com.github.houmain.Keymapper",
"/com/github/houmain/Keymapper"
);

let enabled = false;
Shell.WindowTracker.get_default().connect('notify::focus-app', () => {
const window = global.display.focus_window;
if (this._enabled)
this._keymapper.WindowFocusSync(
(window ? window.get_title() : ''),
(window ? window.get_wm_class() : "root"));
});
}

function init() {
Shell.WindowTracker.get_default().connect('notify::focus-app', () => {
const window = global.display.focus_window;
if (enabled)
keymapper.WindowFocusSync(
(window ? window.get_title() : ''),
(window ? window.get_wm_class() : "root"));
});
return {
enable: ()=>{ enabled = true; },
disable: ()=>{ enabled = false; }
};
enable() {
this._enabled = true;
}

disable() {
this._enabled = false;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"name": "Keymapper",
"description": "Informs keymapper about the currently focused window.",
"url": "https://github.com/houmain/keymapper",
"version": 1,
"version": 2,
"shell-version": [
"40", "41", "42", "43", "44", "45", "46", "47", "48", "49"
"45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55"
]
}

0 comments on commit e5937b7

Please sign in to comment.