Files
Nebula-OS/shells/desktop/shell/qml/surfaces/WindowChromeSurface.qml
T
andrew 4d70014242 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.
2026-08-26 22:45:50 +12:00

41 lines
1.4 KiB
QML

import QtQuick
import QtQuick.Window
import org.kde.layershell 1.0 as LayerShell
import Nebula.UI
import Nebula.Windows
Window {
id: root
readonly property bool active: WindowService.hasFocusedWindow
&& !WindowService.focusedWindowFullscreen
&& !ShellState.launcherOpen
readonly property int chromeX: WindowService.focusedWindowX + Theme.windowChromeInset
readonly property int chromeY: {
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")
color: "transparent"
flags: Qt.FramelessWindowHint | Qt.WindowDoesNotAcceptFocus
visible: root.active
width: Math.max(1, controls.implicitWidth)
height: Math.max(1, controls.implicitHeight)
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, chromeX)
LayerShell.Window.margins.top: Math.max(0, chromeY)
LayerShell.Window.exclusionZone: 0
LayerShell.Window.keyboardInteractivity: LayerShell.Window.KeyboardInteractivityNone
WindowControls {
id: controls
anchors.centerIn: parent
}
}