-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restored unintendedly reverted support for Gnome 45
- Loading branch information
Showing
2 changed files
with
36 additions
and
31 deletions.
There are no files selected for viewing
63 changes: 34 additions & 29 deletions
63
extra/share/gnome-shell/extensions/[email protected]/extension.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters