Align window chrome with Sway title bars

Adds focused title-bar geometry to the window service and updates the Sway backend to derive frame data more reliably (including parent node fallback and content rect tracking for wrapped/floating views). Window chrome positioning now centers against the actual title bar instead of deco offsets, improving alignment. Also refreshes visual sizing/padding for traffic-light controls and Sway titlebar spacing to match the new chrome metrics.
This commit is contained in:
2026-08-26 22:45:50 +12:00
parent 4321209e92
commit 4d70014242
9 changed files with 100 additions and 33 deletions
@@ -13,8 +13,8 @@ Item {
signal clicked()
implicitWidth: Theme.trafficLightSize + 2
implicitHeight: Theme.trafficLightSize + 2
implicitWidth: Theme.trafficLightSize + 6
implicitHeight: Theme.trafficLightSize + 6
Accessible.role: Accessible.Button
Accessible.name: root.label
Accessible.onPressAction: root.clicked()
@@ -50,17 +50,20 @@ Item {
Canvas {
id: glyph
anchors.centerIn: parent
width: 8
height: 8
width: Math.round(Theme.trafficLightSize * 0.58)
height: width
antialiasing: true
opacity: root.showGlyph ? 1 : 0
visible: opacity > 0.01
onWidthChanged: requestPaint()
onHeightChanged: requestPaint()
onPaint: {
const ctx = getContext("2d")
ctx.reset()
ctx.scale(width / 8, height / 8)
ctx.strokeStyle = Qt.rgba(0.18, 0.12, 0.1, 0.78)
ctx.fillStyle = ctx.strokeStyle
ctx.lineWidth = 1.15
ctx.lineWidth = 1.35
ctx.lineCap = "round"
ctx.lineJoin = "round"
@@ -10,15 +10,12 @@ Window {
readonly property bool active: WindowService.hasFocusedWindow
&& !WindowService.focusedWindowFullscreen
&& !ShellState.launcherOpen
readonly property int chromeX: WindowService.focusedWindowX
+ WindowService.focusedWindowDecoX
+ Theme.windowChromeInset
readonly property int chromeX: WindowService.focusedWindowX + Theme.windowChromeInset
readonly property int chromeY: {
const top = WindowService.focusedWindowY + WindowService.focusedWindowDecoY
const decoHeight = WindowService.focusedWindowDecoHeight
if (decoHeight <= 0)
return top + 6
return top + Math.max(0, Math.round((decoHeight - height) / 2))
const barY = WindowService.focusedWindowTitleBarY
const barH = Math.max(WindowService.focusedWindowTitleBarHeight, height)
const centered = barY + Math.round((barH - height) / 2)
return centered - Theme.topBarHeight
}
title: qsTr("Nebula Window Chrome")