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:
2026-08-26 23:10:22 +12:00
parent e4ea19cd09
commit ba7945a1d6
7 changed files with 75 additions and 66 deletions
+6
View File
@@ -39,6 +39,8 @@ class WindowService : public QObject
Q_PROPERTY(int focusedWindowDecoHeight READ focusedWindowDecoHeight NOTIFY focusedWindowGeometryChanged)
Q_PROPERTY(int focusedWindowTitleBarY READ focusedWindowTitleBarY NOTIFY focusedWindowGeometryChanged)
Q_PROPERTY(int focusedWindowTitleBarHeight READ focusedWindowTitleBarHeight NOTIFY focusedWindowGeometryChanged)
Q_PROPERTY(int focusedWorkspaceX READ focusedWorkspaceX NOTIFY focusedWindowGeometryChanged)
Q_PROPERTY(int focusedWorkspaceY READ focusedWorkspaceY NOTIFY focusedWindowGeometryChanged)
public:
enum SnapEdge {
@@ -73,6 +75,8 @@ public:
int focusedWindowDecoHeight() const;
int focusedWindowTitleBarY() const;
int focusedWindowTitleBarHeight() const;
int focusedWorkspaceX() const;
int focusedWorkspaceY() const;
Q_INVOKABLE bool focusWindow(const QString &windowId);
Q_INVOKABLE bool closeWindow(const QString &windowId);
@@ -124,5 +128,7 @@ private:
int m_focusedWindowDecoHeight = 0;
int m_focusedWindowTitleBarY = 0;
int m_focusedWindowTitleBarHeight = 0;
int m_focusedWorkspaceX = 0;
int m_focusedWorkspaceY = 0;
QTimer *m_geometryTimer = nullptr;
};