bar: add "hella shortened" form for even narrower screens

This commit is contained in:
end-4
2025-05-24 11:44:07 +02:00
parent 0e74fc78e5
commit c8a4da6d8b
4 changed files with 32 additions and 10 deletions
+18 -7
View File
@@ -29,9 +29,12 @@ Scope {
property ShellScreen modelData
property var brightnessMonitor: Brightness.getMonitorForScreen(modelData)
property bool useShortenedForm: Appearance.sizes.barShortenScreenWidth >= screen.width
readonly property int centerSideModuleWidth: useShortenedForm ?
Appearance.sizes.barCenterSideModuleWidthShortened : Appearance.sizes.barCenterSideModuleWidth
property real useShortenedForm: (Appearance.sizes.barHellaShortenScreenWidthThreshold >= screen.width) ? 2 :
(Appearance.sizes.barShortenScreenWidthThreshold >= screen.width) ? 1 : 0
readonly property int centerSideModuleWidth:
(useShortenedForm == 2) ? Appearance.sizes.barCenterSideModuleWidthHellaShortened :
(useShortenedForm == 1) ? Appearance.sizes.barCenterSideModuleWidthShortened :
Appearance.sizes.barCenterSideModuleWidth
WlrLayershell.namespace: "quickshell:bar"
implicitHeight: barHeight + Appearance.rounding.screenRounding
@@ -162,7 +165,7 @@ Scope {
}
ActiveWindow {
visible: !barRoot.useShortenedForm
visible: barRoot.useShortenedForm === 0
Layout.rightMargin: Appearance.rounding.screenRounding
Layout.fillWidth: true
bar: barRoot
@@ -177,21 +180,26 @@ Scope {
spacing: 8
RowLayout {
id: leftCenterGroup
Layout.preferredWidth: barRoot.centerSideModuleWidth
spacing: 4
Layout.fillHeight: true
implicitWidth: 350
Resources {
alwaysShowAllResources: barRoot.useShortenedForm === 2
Layout.fillWidth: barRoot.useShortenedForm === 2
}
Media {
visible: barRoot.useShortenedForm < 2
Layout.fillWidth: true
}
}
RowLayout {
id: middleCenterGroup
Layout.fillWidth: true
Layout.fillHeight: true
@@ -212,21 +220,24 @@ Scope {
}
RowLayout {
Layout.preferredWidth: barRoot.centerSideModuleWidth
id: rightCenterGroup
Layout.preferredWidth: leftCenterGroup.width
Layout.fillHeight: true
spacing: 4
ClockWidget {
showDate: barRoot.useShortenedForm < 2
Layout.alignment: Qt.AlignVCenter
Layout.fillWidth: true
}
UtilButtons {
visible: !barRoot.useShortenedForm
visible: barRoot.useShortenedForm === 0
Layout.alignment: Qt.AlignVCenter
}
Battery {
visible: barRoot.useShortenedForm < 2
Layout.alignment: Qt.AlignVCenter
}
@@ -397,7 +408,7 @@ Scope {
SysTray {
bar: barRoot
visible: !barRoot.useShortenedForm
visible: barRoot.useShortenedForm === 0
Layout.fillWidth: false
Layout.fillHeight: true
}