diff options
| author | Donald Williams <129223418+dwilliam62@users.noreply.github.com> | 2025-10-05 11:18:33 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-05 11:18:33 -0400 |
| commit | 0c5e7e9de06cc7e786974a3ee5b8e7bda517d219 (patch) | |
| tree | a5d7357d669e0fc69c0e05bd2b431a51446f104b /config/quickshell | |
| parent | 613b232adb2f26b0bc89464a5003271a8559e6f0 (diff) | |
| parent | 8da32f1f6e8ec1d2b25a14efbf927af232323315 (diff) | |
Merge pull request #797 from SherLock707/qs_overview_fix_v2
Overview multimonitor fix Test with laptop and external display
Diffstat (limited to 'config/quickshell')
4 files changed, 61 insertions, 9 deletions
diff --git a/config/quickshell/modules/common/ConfigOptions.qml b/config/quickshell/modules/common/ConfigOptions.qml index 25f0de05..3a9fa194 100644 --- a/config/quickshell/modules/common/ConfigOptions.qml +++ b/config/quickshell/modules/common/ConfigOptions.qml @@ -17,6 +17,7 @@ Singleton { property real windowPadding: 6 property real position: 1 // 0: top | 1: middle | 2: bottom property real workspaceNumberSize: 120 // Set 0, dynamic calculation based on monitor size + property bool showAllMonitors: true // Show windows from all monitors } property QtObject resources: QtObject { diff --git a/config/quickshell/modules/overview/Overview.qml b/config/quickshell/modules/overview/Overview.qml index ef5a49c3..08a3b0d3 100644 --- a/config/quickshell/modules/overview/Overview.qml +++ b/config/quickshell/modules/overview/Overview.qml @@ -17,7 +17,7 @@ Scope { Variants { id: overviewVariants - model: Quickshell.screens + model: Quickshell.screens.filter(s => Hyprland.monitorFor(s).id === Hyprland.focusedMonitor?.id) PanelWindow { id: root required property var modelData diff --git a/config/quickshell/modules/overview/OverviewWidget.qml b/config/quickshell/modules/overview/OverviewWidget.qml index 93e90967..05a15e10 100644 --- a/config/quickshell/modules/overview/OverviewWidget.qml +++ b/config/quickshell/modules/overview/OverviewWidget.qml @@ -46,6 +46,33 @@ Item { property int draggingFromWorkspace: -1 property int draggingTargetWorkspace: -1 + // Debug logging function + function debugMultiMonitorInfo() { + console.log("=== Multi-Monitor Debug Info ===") + console.log("Current monitor ID:", root.monitor.id) + console.log("Current monitor name:", root.monitor.name) + console.log("Current monitor scale:", root.monitor.scale) + console.log("Current monitor position:", root.monitor.x, root.monitor.y) + console.log("Total monitors:", HyprlandData.monitors.length) + + HyprlandData.monitors.forEach((mon, idx) => { + console.log(`Monitor ${idx}: ID=${mon.id}, Name=${mon.name}, Scale=${mon.scale}, Pos=(${mon.x},${mon.y}), Size=${mon.width}x${mon.height}, Reserved=[${mon.reserved.join(",")}]`) + }) + + console.log("Total windows:", windowAddresses.length) + windowAddresses.forEach((address, idx) => { + const win = windowByAddress[address] + if (win) { + console.log(`Window ${idx}: ${win.class} on monitor ${win.monitor}, workspace ${win.workspace?.id}, pos=(${win.at[0]},${win.at[1]})`) + } + }) + console.log("=== End Debug Info ===") + } + + Component.onCompleted: { + debugMultiMonitorInfo() + } + implicitWidth: overviewBackground.implicitWidth + Appearance.sizes.elevationMargin * 2 implicitHeight: overviewBackground.implicitHeight + Appearance.sizes.elevationMargin * 2 @@ -233,14 +260,21 @@ Item { model: ScriptModel { values: windowAddresses.filter((address) => { var win = windowByAddress[address] - return (root.workspaceGroup * root.workspacesShown < win?.workspace?.id && win?.workspace?.id <= (root.workspaceGroup + 1) * root.workspacesShown) + if (!win) return false + + // Filter by workspace group AND monitor if configured + const inWorkspaceGroup = (root.workspaceGroup * root.workspacesShown < win?.workspace?.id && + win?.workspace?.id <= (root.workspaceGroup + 1) * root.workspacesShown) + const inMonitor = ConfigOptions.overview.showAllMonitors || win.monitor === root.monitor.id + + return inWorkspaceGroup && inMonitor }) } delegate: OverviewWindow { id: window windowData: windowByAddress[modelData] - monitorData: HyprlandData.monitors.find(m => m.id === windowData?.monitor) // use monitorData of the monitor the window is on - scale: root.scale * (monitorData?.scale / root.monitor?.scale) // adjust window scale to the monitor where the overview is displayed + monitorData: root.monitorData + scale: root.scale availableWorkspaceWidth: root.workspaceImplicitWidth availableWorkspaceHeight: root.workspaceImplicitHeight diff --git a/config/quickshell/modules/overview/OverviewWindow.qml b/config/quickshell/modules/overview/OverviewWindow.qml index 93ea06f9..b28a5bf6 100644 --- a/config/quickshell/modules/overview/OverviewWindow.qml +++ b/config/quickshell/modules/overview/OverviewWindow.qml @@ -17,14 +17,31 @@ Rectangle { // Window property var scale property var availableWorkspaceWidth property var availableWorkspaceHeight - property bool restrictToWorkspace: true - property real initX: Math.max((windowData?.at[0] - monitorData?.reserved[0] - monitorData?.x) * root.scale, 0) + xOffset - property real initY: Math.max((windowData?.at[1] - monitorData?.reserved[1] - monitorData?.y) * root.scale, 0) + yOffset + property bool restrictToWorkspace: true`` + property var sourceMonitor: HyprlandData.monitors.find(m => m.id === windowData?.monitor) || HyprlandData.monitors[0] || { scale: 1.0, x: 0, y: 0, reserved: [0,0,0,0] } + property real monitorScaleFactor: sourceMonitor?.scale || 1.0 + property real targetScaleFactor: monitorData?.scale || monitorScaleFactor || 1.0 + property var focusedMonitor: Hyprland.focusedMonitor + property real focusedMonitorScale: focusedMonitor?.scale || 1.0 + property real effectiveScale: root.scale * ( + ConfigOptions.overview.showAllMonitors + ? (focusedMonitorScale / monitorScaleFactor) // Scale relative to focused monitor when showing all + : (targetScaleFactor / monitorScaleFactor) // Scale relative to target monitor normally + ) + + // Calculate position relative to source monitor + property real relativeX: (windowData?.at[0] - sourceMonitor?.x - sourceMonitor?.reserved[0]) || 0 + property real relativeY: (windowData?.at[1] - sourceMonitor?.y - sourceMonitor?.reserved[1]) || 0 + + // Scale position based on monitor differences + property real initX: Math.max(relativeX * effectiveScale, 0) + xOffset + property real initY: Math.max(relativeY * effectiveScale, 0) + yOffset property real xOffset: 0 property real yOffset: 0 - property var targetWindowWidth: windowData?.size[0] * scale - property var targetWindowHeight: windowData?.size[1] * scale + // Scale window size based on monitor differences + property var targetWindowWidth: (windowData?.size[0] || 0) * effectiveScale + property var targetWindowHeight: (windowData?.size[1] || 0) * effectiveScale property bool hovered: false property bool pressed: false |
