Skip to content

Commit 021c931

Browse files
ids1024jackpot51
authored andcommitted
fix: Only set default_* globals if it not already set
Should prevent "too much recursion" errors.
1 parent f4894c8 commit 021c931

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/extension.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,8 @@ function _show_skip_taskbar_windows(ext: Ext) {
25772577
// So it has to be skipped being overriden for now.
25782578

25792579
// Handle the overview
2580-
default_isoverviewwindow_ws = Workspace.prototype._isOverviewWindow;
2580+
if (!default_isoverviewwindow_ws)
2581+
default_isoverviewwindow_ws = Workspace.prototype._isOverviewWindow;
25812582
Workspace.prototype._isOverviewWindow = function(window: any) {
25822583
// wm_class Gjs needs to be skipped to prevent the ghost window in
25832584
// workspace and overview
@@ -2591,7 +2592,8 @@ function _show_skip_taskbar_windows(ext: Ext) {
25912592
if (GNOME_VERSION?.startsWith("3.36")) {
25922593
// imports.ui.windowPreview is not in 3.36,
25932594
// _getCaption() is still in workspace.js
2594-
default_getcaption_workspace = Workspace.prototype._getCaption;
2595+
if (!default_getcaption_workspace)
2596+
default_getcaption_workspace = Workspace.prototype._getCaption;
25952597
Workspace.prototype._getCaption = function() {
25962598
if (this.metaWindow.title)
25972599
return this.metaWindow.title;
@@ -2602,7 +2604,8 @@ function _show_skip_taskbar_windows(ext: Ext) {
26022604
}
26032605
} else {
26042606
const { WindowPreview } = imports.ui.windowPreview;
2605-
default_getcaption_windowpreview = WindowPreview.prototype._getCaption;
2607+
if (!default_getcaption_windowpreview)
2608+
default_getcaption_windowpreview = WindowPreview.prototype._getCaption;
26062609
WindowPreview.prototype._getCaption = function() {
26072610
if (this.metaWindow.title)
26082611
return this.metaWindow.title;
@@ -2614,8 +2617,9 @@ function _show_skip_taskbar_windows(ext: Ext) {
26142617
}
26152618

26162619
// Handle the workspace thumbnail
2617-
default_isoverviewwindow_ws_thumbnail =
2618-
WorkspaceThumbnail.prototype._isOverviewWindow;
2620+
if (!default_isoverviewwindow_ws_thumbnail)
2621+
default_isoverviewwindow_ws_thumbnail =
2622+
WorkspaceThumbnail.prototype._isOverviewWindow;
26192623
WorkspaceThumbnail.prototype._isOverviewWindow = function (win: any) {
26202624
let meta_win = win.get_meta_window();
26212625
// wm_class Gjs needs to be skipped to prevent the ghost window in
@@ -2626,7 +2630,8 @@ function _show_skip_taskbar_windows(ext: Ext) {
26262630
};
26272631

26282632
// Handle switch-applications
2629-
default_init_appswitcher = AppSwitcher.prototype._init;
2633+
if (!default_init_appswitcher)
2634+
default_init_appswitcher = AppSwitcher.prototype._init;
26302635
// Do not use the Shell.AppSystem apps
26312636
AppSwitcher.prototype._init = function(_apps: any, altTabPopup: any) {
26322637
// Simulate super._init(true);
@@ -2677,7 +2682,8 @@ function _show_skip_taskbar_windows(ext: Ext) {
26772682
}
26782683

26792684
// Handle switch-windows
2680-
default_getwindowlist_windowswitcher = WindowSwitcherPopup.prototype._getWindowList;
2685+
if (!default_getwindowlist_windowswitcher)
2686+
default_getwindowlist_windowswitcher = WindowSwitcherPopup.prototype._getWindowList;
26812687
WindowSwitcherPopup.prototype._getWindowList = function() {
26822688
let workspace = null;
26832689

0 commit comments

Comments
 (0)