diff --git a/README.md b/README.md index 1432307..47a267c 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ It fixes at least this known issue: https://gitlab.gnome.org/GNOME/mutter/issues 41 42 43 +44 +45 ## Installation 1. `git clone https://github.com/bdaase/remove-alt-tab-delay ~/.local/share/gnome-shell/extensions/remove-alt-tab-delay@daase.net` diff --git a/extension.js b/extension.js index e33aca5..97a5b7e 100644 --- a/extension.js +++ b/extension.js @@ -1,12 +1,36 @@ -const SwitcherPopup = imports.ui.switcherPopup; +import * as SwitcherPopup from 'resource:///org/gnome/shell/ui/switcherPopup.js'; -function init() { -} +import { Extension } from 'resource:///org/gnome/shell/extensions/extension.js'; -function enable() { - SwitcherPopup.POPUP_DELAY_TIMEOUT = 0; -} +export default class RemoveAltTabDelay extends Extension { + + constructor(metadata) { + super(metadata); + + this._metadata = metadata; + this._switcherPopup = SwitcherPopup || null; + } + + enable() { + let SwitcherPopupProto = this._switcherPopup.SwitcherPopup.prototype; -function disable() { - SwitcherPopup.POPUP_DELAY_TIMEOUT = 150; -} \ No newline at end of file + SwitcherPopupProto.showOld = SwitcherPopupProto.show; + + SwitcherPopupProto.show = function (...args) { + let res = this.showOld(...args); + if (res) { + this._showImmediately(); + } + return res; + }; + } + + disable() { + let SwitcherPopupProto = this._switcherPopup.SwitcherPopup.prototype; + + if (SwitcherPopupProto.showOld) { + SwitcherPopupProto.show = SwitcherPopupProto.showOld; + delete(SwitcherPopupProto.showOld); + } + } +} diff --git a/metadata.json b/metadata.json index 795a3c3..7077551 100644 --- a/metadata.json +++ b/metadata.json @@ -12,7 +12,9 @@ "40", "41", "42", - "43" + "43", + "44", + "45" ], "url": "https://github.com/BjoernDaase/remove-alt-tab-delay", "uuid": "remove-alt-tab-delay@daase.net",