Fix window chrome positioning on Sway
Improves focused-window geometry so chrome placement stays stable across workspaces and floating containers. WindowService now exposes focused workspace X/Y, resolves workspace by name, and publishes those offsets with focused geometry. The Sway backend now tracks the active floating frame through recursion and consistently derives frame/deco/content rects from that frame. QML chrome placement was updated to use workspace-relative coordinates and simpler direct margins (removing interpolation behaviors), with safer title-bar height handling for vertical centering.
This commit is contained in:
@@ -10,14 +10,15 @@ Window {
|
||||
readonly property bool active: WindowService.hasFocusedWindow
|
||||
&& !WindowService.focusedWindowFullscreen
|
||||
&& !ShellState.launcherOpen
|
||||
readonly property int chromeX: WindowService.focusedWindowX + Theme.windowChromeInset
|
||||
readonly property int chromeX: WindowService.focusedWindowX
|
||||
+ Theme.windowChromeInset
|
||||
- WindowService.focusedWorkspaceX
|
||||
readonly property int chromeY: {
|
||||
const barY = WindowService.focusedWindowTitleBarY
|
||||
const barH = Math.max(WindowService.focusedWindowTitleBarHeight, height)
|
||||
return barY + Math.round((barH - height) / 2)
|
||||
const barH = WindowService.focusedWindowTitleBarHeight
|
||||
const centered = WindowService.focusedWindowTitleBarY
|
||||
+ Math.max(0, Math.round((barH - height) / 2))
|
||||
return centered - WindowService.focusedWorkspaceY
|
||||
}
|
||||
property real renderedChromeX: chromeX
|
||||
property real renderedChromeY: chromeY
|
||||
|
||||
title: qsTr("Nebula Window Chrome")
|
||||
color: "transparent"
|
||||
@@ -29,25 +30,11 @@ Window {
|
||||
LayerShell.Window.scope: "nebula-window-chrome"
|
||||
LayerShell.Window.layer: LayerShell.Window.LayerTop
|
||||
LayerShell.Window.anchors: LayerShell.Window.AnchorLeft | LayerShell.Window.AnchorTop
|
||||
LayerShell.Window.margins.left: Math.max(0, Math.round(renderedChromeX))
|
||||
LayerShell.Window.margins.top: Math.max(0, Math.round(renderedChromeY))
|
||||
LayerShell.Window.margins.left: Math.max(0, chromeX)
|
||||
LayerShell.Window.margins.top: Math.max(0, chromeY)
|
||||
LayerShell.Window.exclusionZone: 0
|
||||
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityNone
|
||||
|
||||
Behavior on renderedChromeX {
|
||||
NumberAnimation {
|
||||
duration: 34
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on renderedChromeY {
|
||||
NumberAnimation {
|
||||
duration: 34
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
|
||||
WindowControls {
|
||||
id: controls
|
||||
anchors.centerIn: parent
|
||||
|
||||
Reference in New Issue
Block a user