From 0edfb2abc4e7b9f4e606a6e99e8acdafe3a93de3 Mon Sep 17 00:00:00 2001 From: joevnpro Date: Wed, 25 Feb 2026 22:23:46 +0900 Subject: [PATCH 1/5] Prevent dock display in fullscreen from overview // The dock will show back when coming into Overview (from a state of an opened app with fullcreen status --- autohide.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autohide.js b/autohide.js index d47d6a7..4e69ebd 100644 --- a/autohide.js +++ b/autohide.js @@ -142,8 +142,9 @@ export let AutoHide = class { this._debounceCheckHide(); } + // The dock will show back in Overview (if open Overview from a state of an opened app with fullcreen status show() { - if (!this.dock._monitor || this.dock._monitor.inFullscreen) { + if (!this.dock._monitor || (this.dock._monitor.inFullscreen && !this.extension._inOverview)) { return; } this._dwell = 0; From 60c09c08fe520d82ee401326f7400128b0856fef Mon Sep 17 00:00:00 2001 From: joevnpro Date: Wed, 25 Feb 2026 22:35:56 +0900 Subject: [PATCH 2/5] The option to change icon From Smaller to bigger //Icon size from smaller to bigger. --- dock.js | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/dock.js b/dock.js index fc06c8c..57b6c36 100644 --- a/dock.js +++ b/dock.js @@ -463,36 +463,39 @@ export let Dock = GObject.registerClass( ); } + //Icon size from smaller to bigger. _preferredIconSize() { - let preferredIconSizes = this._preferredIconSizes; - let iconSize = 64; - if (!preferredIconSizes) { - preferredIconSizes = [32]; - for (let i = 16; i <= 128; i += 4) { - preferredIconSizes.push(i); - } - this._preferredIconSizes = preferredIconSizes; - } + let defaultSize=32; //if there is an error in caculaton, use this value. + this._iconSize=defaultSize; + + //To ensure the extension object and _config object exist (prevent crash system in case the Dock.js is load but the _config.jon hasnot been load because + // _loadConfig() is an async function + const extExtention = this.extension || {}; + const extConfig = extExtention._config || {};//This is this.extension._config - //! why the need for upscaling - let upscale = 1 + (2 - this._scaleFactor) || 1; - if (upscale < 1) { - upscale = 1; // does scaleFactor go beyond 2x? + // 1. Prioritize manual input from config + if (extConfig.icon_size) { //this.extension._config.icon_size + return this._iconSize = extConfig.icon_size; } - // console.log(`scaleFactor:${this._scaleFactor} upscale:${upscale}`); - iconSize = - upscale * - (preferredIconSizes[ - Math.floor(this.extension.icon_size * preferredIconSizes.length) - ] || 64); - iconSize *= this.extension.scale; - if (this.extension._config.icon_size) { - iconSize = this.extension._config.icon_size; - } + // 2. Get value from UI slider (assuming range 0.0 to 1.0) + let sliderVal = extExtention.icon_size; + + // 3. Define the size range you want (e.g., from 16px to 128px) + let min = 8; + let max = 128; + + // Calculate base size based on slider position (Linear - prevents sudden jumps) + let baseSize = min + (sliderVal * (max - min)); + + // 4. Multiply by screen scale factor (upscale) and extension-specific ratio + let scaleFactor = this._scaleFactor || 1; + let upscale = Math.max(1, 1 + (2 - scaleFactor))||1; + let extExtentionScale = extExtention.scale || 1; + + this._iconSize = baseSize * upscale * extExtentionScale; - this._iconSize = iconSize; - return iconSize; + return this._iconSize||defaultSize; } // Structure for dash icon container widgets - g42,g43,g44,g45,g46 From 233637ada2c3592f8f66e622c6dbbd94cf1a0ec3 Mon Sep 17 00:00:00 2001 From: joevnpro Date: Wed, 25 Feb 2026 23:58:54 +0900 Subject: [PATCH 3/5] Able to hide the dock if only it is the active windows Able to hide the dock if only it is the active windows overlaps the dock. (still keep the original logic to switch/change in code) Added support for MENU and DROPDOWN_MENU window types to improve dock hiding functionality based on window overlap. --- autohide.js | 170 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 139 insertions(+), 31 deletions(-) diff --git a/autohide.js b/autohide.js index 4e69ebd..39b857e 100644 --- a/autohide.js +++ b/autohide.js @@ -20,7 +20,8 @@ const handledWindowTypes = [ Meta.WindowType.DIALOG, Meta.WindowType.MODAL_DIALOG, // Meta.WindowType.TOOLBAR, - // Meta.WindowType.MENU, + Meta.WindowType.MENU, + Meta.WindowType.DROPDOWN_MENU, // to hide the dock in case the right mouse menu and Dropdown menu overlap the dock. Meta.WindowType.UTILITY, // Meta.WindowType.SPLASHSCREEN ]; @@ -192,6 +193,11 @@ export let AutoHide = class { } _checkOverlap() { + // Declare mode of autohide + let mode_allWindows = 1; + let mode_onlyActiveWindows = 2; + let mode_selected = mode_onlyActiveWindows; + // console.log("checking overlap..."); if (this.extension._inOverview) { return false; @@ -239,44 +245,146 @@ export let AutoHide = class { let monitor = this.dock._monitor; let actors = global.get_window_actors(); - let windows = actors.map((a) => { + let popupMenus = actors + .map(a => a.get_meta_window()) + .filter(w => + w && + (w.get_window_type() === Meta.WindowType.DROPDOWN_MENU || + w.get_window_type() === Meta.WindowType.POPUP_MENU || + w.get_window_type() === Meta.WindowType.MENU) + ); + + let checkWindows = []; + + /* + I don't know why _checkOverlap2 can hide the dock when Windows/Right-click menu/Dropdown menu is active and overlaps the dock, + but if the desktop is empty (no windows), the dock inexplicably hides. + + So I had to combine _checkOverlap1 (author's code) to hide the dock with any window overlapping the dock - but it appears when the desktop is empty). + + Therefore, I combined _checkOverlap1 and _checkOverlap2. The result is that I can hide the dock only when Windows is active and overlaps the dock, while ensuring the desktop is empty (no windows) for the dock to appear. _checkOverlap2 can also hide the dock if the application's right-click menu or dropdown menu accidentally overlaps the dock - convenient for you when using a browser where, for some reason, the right-click menu opens downwards and overlaps the dock. + */ + + // Hide the dock if any windows overlaps the dock. + const _checkOverlap1 = () => { + let windows = actors.map((a) => { let w = a.get_meta_window(); w._parent = a; return w; - }); - windows = windows.filter((w) => w.can_close()); - windows = windows.filter((w) => w.get_monitor() == monitor.index); - // windows = windows.filter((w) => !w.is_override_redirect()); - let workspace = global.workspace_manager.get_active_workspace_index(); - windows = windows.filter( - (w) => - workspace == w.get_workspace().index() && w.showing_on_its_workspace() - ); - windows = windows.filter((w) => w.get_window_type() in handledWindowTypes); - - let isOverlapped = false; - let dockRect = this.dock.struts.get_transformed_position(); - dockRect.push(this.dock.struts.width); - dockRect.push(this.dock.struts.height); + }); + + windows = windows.filter((w) => w.can_close()); + windows = windows.filter((w) => w.get_monitor() == monitor.index); + // windows = windows.filter((w) => !w.is_override_redirect()); + let workspace = global.workspace_manager.get_active_workspace_index(); + windows = windows.filter( + (w) => + workspace == w.get_workspace().index() && w.showing_on_its_workspace() + ); + windows = windows.filter((w) => w.get_window_type() in handledWindowTypes); + + + // Add popup and right mouse menu to check + popupMenus.forEach(m => { + if (m && m.get_monitor() === monitor.index) { + windows.push(m); + } + }); + + + let isOverlapped = false; + let dockRect = this.dock.struts.get_transformed_position(); + dockRect.push(this.dock.struts.width); + dockRect.push(this.dock.struts.height); + + windows.forEach((w) => { + this._track(w); + if (isOverlapped) return; + + let frame = w.get_frame_rect(); + let win = [frame.x, frame.y, frame.width, frame.height]; + + if (isOverlapRect(dockRect, win)) { + isOverlapped = true; + } + }); - windows.forEach((w) => { - this._track(w); - if (isOverlapped) return; + this.windows = windows; - let frame = w.get_frame_rect(); - let win = [frame.x, frame.y, frame.width, frame.height]; + // console.log(isOverlapped); + return isOverlapped; + } - if (isOverlapRect(dockRect, win)) { - isOverlapped = true; + // Hide the dock if only there is an overlap of active windows on the dock, however the dock is hidden if the desktop is empty (no windows) + const _checkOverlap2 = () => { + if (focused && focused.get_monitor() === monitor.index) { + checkWindows.push(focused); } - }); - - this.windows = windows; - - // console.log(isOverlapped); - return isOverlapped; + + popupMenus.forEach(w => { + if (w.get_monitor() === monitor.index) { + checkWindows.push(w); + } + }); + + // Lưu lại để _checkHide() biết desktop trống + this.windows = checkWindows; + + // Không có cửa sổ nào → không overlap + if (checkWindows.length === 0) { + return false; + } + + let dockRect = this.dock.struts.get_transformed_position(); + dockRect.push(this.dock.struts.width); + dockRect.push(this.dock.struts.height); + + let isOverlapped = false; + + checkWindows.forEach(w => { + this._track(w); + if (isOverlapped) return; + + let frame = w.get_frame_rect(); + let win = [frame.x, frame.y, frame.width, frame.height]; + + if (isOverlapRect(dockRect, win)) { + isOverlapped = true; + } + }); + + return isOverlapped; + } + + let overlap; + let overlap1 = _checkOverlap1(); + if(mode_selected === mode_allWindows) { + overlap = overlap1; + return overlap; + } + + let overlap2 = _checkOverlap2(); + if(overlap1 === true && overlap2 === true) { + overlap = true; + return overlap; + } + if(overlap1 === false && overlap2 === true) { + overlap = false; + return overlap; + } + if(overlap1 === false && overlap2 === false) { + overlap = false; + return overlap; + } + if(overlap1 === true && overlap2 === false) { + overlap = false; + return overlap; + } + + return overlap; } - + + _debounceCheckHide() { if (this.extension._loTimer) { if (!this._debounceCheckSeq) { From 2734c1ecb5a0cefc75a73ee09b54d2cf730964ce Mon Sep 17 00:00:00 2001 From: joevnpro Date: Thu, 26 Feb 2026 23:20:00 +0900 Subject: [PATCH 4/5] Refactor autohide mode handling and overlap logic Refactor autohide modes and clean up overlap checks. --- autohide.js | 69 +++++++++++++++++++++++++---------------------------- 1 file changed, 32 insertions(+), 37 deletions(-) diff --git a/autohide.js b/autohide.js index 39b857e..20e2221 100644 --- a/autohide.js +++ b/autohide.js @@ -194,9 +194,9 @@ export let AutoHide = class { _checkOverlap() { // Declare mode of autohide - let mode_allWindows = 1; - let mode_onlyActiveWindows = 2; - let mode_selected = mode_onlyActiveWindows; + let mode1_allWindows = 1; + let mode2_onlyActiveWindows = 2; + let mode_selected = mode2_onlyActiveWindows; // console.log("checking overlap..."); if (this.extension._inOverview) { @@ -245,6 +245,8 @@ export let AutoHide = class { let monitor = this.dock._monitor; let actors = global.get_window_actors(); + + // Add popumMenu to hide the dock if the right mouse menu overlap the doc (becasuse this dock is design to be always over everything) let popupMenus = actors .map(a => a.get_meta_window()) .filter(w => @@ -254,18 +256,7 @@ export let AutoHide = class { w.get_window_type() === Meta.WindowType.MENU) ); - let checkWindows = []; - - /* - I don't know why _checkOverlap2 can hide the dock when Windows/Right-click menu/Dropdown menu is active and overlaps the dock, - but if the desktop is empty (no windows), the dock inexplicably hides. - - So I had to combine _checkOverlap1 (author's code) to hide the dock with any window overlapping the dock - but it appears when the desktop is empty). - - Therefore, I combined _checkOverlap1 and _checkOverlap2. The result is that I can hide the dock only when Windows is active and overlaps the dock, while ensuring the desktop is empty (no windows) for the dock to appear. _checkOverlap2 can also hide the dock if the application's right-click menu or dropdown menu accidentally overlaps the dock - convenient for you when using a browser where, for some reason, the right-click menu opens downwards and overlaps the dock. - */ - - // Hide the dock if any windows overlaps the dock. + // Hide the dock if any windows overlaps the dock. const _checkOverlap1 = () => { let windows = actors.map((a) => { let w = a.get_meta_window(); @@ -316,10 +307,26 @@ export let AutoHide = class { } // Hide the dock if only there is an overlap of active windows on the dock, however the dock is hidden if the desktop is empty (no windows) + let focused = global.display.get_focus_window(); + let checkWindows = []; + const _checkOverlap2 = () => { if (focused && focused.get_monitor() === monitor.index) { - checkWindows.push(focused); - } + let winType = focused.get_window_type(); + let isValidAppWindows = false; + for (let i = 0; i < actors.length; i++) { + let win = actors[i].get_meta_window(); + + // So sánh đối tượng cửa sổ + if (win === focused) { + isValidAppWindows = true; + break; + } + } + if (isValidAppWindows && winType !== Meta.WindowType.DESKTOP && focused.can_close()) { + checkWindows.push(focused); + } + } popupMenus.forEach(w => { if (w.get_monitor() === monitor.index) { @@ -329,7 +336,7 @@ export let AutoHide = class { // Lưu lại để _checkHide() biết desktop trống this.windows = checkWindows; - + // Không có cửa sổ nào → không overlap if (checkWindows.length === 0) { return false; @@ -356,30 +363,18 @@ export let AutoHide = class { return isOverlapped; } - let overlap; - let overlap1 = _checkOverlap1(); - if(mode_selected === mode_allWindows) { - overlap = overlap1; - return overlap; - } + // Choose autohide mode + let overlap = false; - let overlap2 = _checkOverlap2(); - if(overlap1 === true && overlap2 === true) { - overlap = true; - return overlap; - } - if(overlap1 === false && overlap2 === true) { - overlap = false; + if(mode_selected === mode1_allWindows) { + overlap = _checkOverlap1(); return overlap; } - if(overlap1 === false && overlap2 === false) { - overlap = false; + + if(mode_selected === mode2_onlyActiveWindows) { + overlap = _checkOverlap2(); return overlap; } - if(overlap1 === true && overlap2 === false) { - overlap = false; - return overlap; - } return overlap; } From 80828ea37a2875b177c7dd36526a3f342abf3490 Mon Sep 17 00:00:00 2001 From: joevnpro Date: Fri, 27 Feb 2026 14:16:34 +0900 Subject: [PATCH 5/5] Improve comments in autohide.js Refactor comments for clarity and remove unnecessary lines. --- autohide.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/autohide.js b/autohide.js index 20e2221..ec992ec 100644 --- a/autohide.js +++ b/autohide.js @@ -306,7 +306,7 @@ export let AutoHide = class { return isOverlapped; } - // Hide the dock if only there is an overlap of active windows on the dock, however the dock is hidden if the desktop is empty (no windows) + // Hide the dock if only there is an overlap of active windows on the dock, let focused = global.display.get_focus_window(); let checkWindows = []; @@ -334,10 +334,7 @@ export let AutoHide = class { } }); - // Lưu lại để _checkHide() biết desktop trống this.windows = checkWindows; - - // Không có cửa sổ nào → không overlap if (checkWindows.length === 0) { return false; } @@ -363,7 +360,6 @@ export let AutoHide = class { return isOverlapped; } - // Choose autohide mode let overlap = false; if(mode_selected === mode1_allWindows) {