From 98ce9ae936ce6c0225dc67936edb3652a80eebbb Mon Sep 17 00:00:00 2001 From: "edo.husakovic" Date: Tue, 14 Jan 2025 01:32:31 +0100 Subject: [PATCH] Array boundary Check for Overview This prevents the application overview from throwing an error when multiple monitors are plugged in but only one is enabled. --- .config/ags/modules/overview/overview_hyprland.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/ags/modules/overview/overview_hyprland.js b/.config/ags/modules/overview/overview_hyprland.js index e9eab4269..b7a2fb411 100644 --- a/.config/ags/modules/overview/overview_hyprland.js +++ b/.config/ags/modules/overview/overview_hyprland.js @@ -60,6 +60,9 @@ export default (overviewMonitor = 0) => { else if (x < 0) { w = x + w; x = 0; } if (y + h <= 0) x += (Math.floor(y / monitors[monitor].height) * monitors[monitor].height); else if (y < 0) { h = y + h; y = 0; } + if (monitors.length - 1 < monitor) { + monitor = monitors.length - 1; + } // Truncate if offscreen if (x + w > monitors[monitor].width) w = monitors[monitor].width - x; if (y + h > monitors[monitor].height) h = monitors[monitor].height - y;