mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-08 04:09:15 -04:00
Fix Hyprland scrolling overview geometry (#2442)
This commit is contained in:
@@ -107,6 +107,24 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
function getWorkspaceViewportBounds(workspaceId) {
|
||||
const workspace = allWorkspaces?.find(ws => ws?.id === workspaceId);
|
||||
const mon = workspace?.monitor?.lastIpcObject || monitor?.lastIpcObject || {};
|
||||
const reserved = mon.reserved || [0, 0, 0, 0];
|
||||
|
||||
const x = (mon.x ?? 0) + (reserved[0] ?? 0);
|
||||
const y = (mon.y ?? 0) + (reserved[1] ?? 0);
|
||||
const width = Math.max((mon.width ?? monitorPhysicalWidth) - (reserved[0] ?? 0) - (reserved[2] ?? 0), 1);
|
||||
const height = Math.max((mon.height ?? monitorPhysicalHeight) - (reserved[1] ?? 0) - (reserved[3] ?? 0), 1);
|
||||
const scale = Math.min(root.workspaceImplicitWidth / width, root.workspaceImplicitHeight / height);
|
||||
|
||||
return {
|
||||
"x": x,
|
||||
"y": y,
|
||||
"scale": scale
|
||||
};
|
||||
}
|
||||
|
||||
property bool monitorIsFocused: monitor?.focused ?? false
|
||||
property real scale: SettingsData.overviewScale
|
||||
property color activeBorderColor: Theme.primary
|
||||
@@ -223,7 +241,7 @@ Item {
|
||||
onClicked: {
|
||||
if (root.draggingTargetWorkspace === -1) {
|
||||
root.overviewOpen = false;
|
||||
HyplandService.focusWorkspace(workspaceValue);
|
||||
HyprlandService.focusWorkspace(workspaceValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,12 +327,16 @@ Item {
|
||||
readonly property int workspaceIndex: getWorkspaceIndex()
|
||||
readonly property int workspaceColIndex: workspaceIndex % root.effectiveColumns
|
||||
readonly property int workspaceRowIndex: Math.floor(workspaceIndex / root.effectiveColumns)
|
||||
readonly property var workspaceBounds: root.getWorkspaceViewportBounds(windowWorkspaceId)
|
||||
|
||||
toplevel: modelData
|
||||
scale: root.scale
|
||||
monitorDpr: root.dpr
|
||||
availableWorkspaceWidth: root.workspaceImplicitWidth
|
||||
availableWorkspaceHeight: root.workspaceImplicitHeight
|
||||
contentOriginX: workspaceBounds.x
|
||||
contentOriginY: workspaceBounds.y
|
||||
contentScale: workspaceBounds.scale
|
||||
widgetMonitorId: root.monitor.id
|
||||
|
||||
xOffset: (root.workspaceImplicitWidth + workspaceSpacing) * workspaceColIndex
|
||||
|
||||
Reference in New Issue
Block a user