Refactor Topbar and ActiveWindow layouts: enhance flexibility by removing width constraints and centering items appropriately

This commit is contained in:
ferreo 2024-11-23 01:34:31 +00:00
parent 60025be0c9
commit 29f1ce6b3d
2 changed files with 6 additions and 20 deletions

View File

@ -66,13 +66,10 @@ PanelWindow {
Layout.fillHeight: true
RowLayout {
anchors.centerIn: parent
width: parent.width
anchors.fill: parent
Widgets.ActiveWindow {
Layout.fillWidth: true
maxWidth: panel.width / 3
Layout.maximumWidth: parent.width
}
}
}

View File

@ -7,8 +7,6 @@ import "root:/"
BarWidget {
id: wrapper
property int maxWidth: 100
Layout.fillWidth: true
function getIcon() {
var icon = Quickshell.iconPath(ToplevelManager.activeToplevel.appId.toLowerCase(), true);
@ -26,26 +24,22 @@ BarWidget {
}
RowLayout {
width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
width: Math.min(implicitWidth, parent.width)
height: parent.height
spacing: 4
Item {
Layout.fillWidth: true
Layout.preferredWidth: parent.width / 2
}
IconImage {
id: icon
implicitHeight: 20
implicitWidth: 20
source: ToplevelManager.activeToplevel ? getIcon() : ""
source: ToplevelManager.activeToplevel ? getIcon() : ""
}
Text {
id: text
Layout.fillWidth: false
Layout.maximumWidth: wrapper.maxWidth - icon.implicitWidth - 32
Layout.fillWidth: true
Layout.maximumWidth: implicitWidth + 1
horizontalAlignment: Text.AlignLeft
text: ToplevelManager.activeToplevel?.title ?? ""
color: Globals.commonStyles.textColor
@ -55,10 +49,5 @@ BarWidget {
elide: Text.ElideRight
maximumLineCount: 1
}
Item {
Layout.fillWidth: true
Layout.preferredWidth: parent.width / 2
}
}
}