Bar: compact mode works pretty well but need some more testing.

This commit is contained in:
LemmyCook 2025-09-16 00:39:30 -04:00
parent 93c674f356
commit ac1902c76a
27 changed files with 169 additions and 88 deletions

View file

@ -13,14 +13,15 @@ Rectangle {
property ShellScreen screen
property real scaling: 1.0
readonly property real itemSize: Style.capsuleHeight * 0.8 * scaling
readonly property bool isVerticalBar: Settings.data.bar.position === "left" || Settings.data.bar.position === "right"
readonly property bool compact: (Settings.data.bar.density === "compact")
readonly property real itemSize: compact ? Style.capsuleHeight * 0.9 * scaling : Style.capsuleHeight * 0.8 * scaling
// Always visible when there are toplevels
implicitWidth: isVerticalBar ? Math.round(Style.capsuleHeight * scaling) : taskbarLayout.implicitWidth + Style.marginM * scaling * 2
implicitHeight: isVerticalBar ? taskbarLayout.implicitHeight + Style.marginM * scaling * 2 : Math.round(Style.capsuleHeight * scaling)
radius: Math.round(Style.radiusM * scaling)
color: Color.mSurfaceVariant
color: compact ? Color.transparent : Color.mSurfaceVariant
GridLayout {
id: taskbarLayout
@ -28,8 +29,8 @@ Rectangle {
anchors {
leftMargin: isVerticalBar ? undefined : Style.marginM * scaling
rightMargin: isVerticalBar ? undefined : Style.marginM * scaling
topMargin: isVerticalBar ? Style.marginM * scaling : undefined
bottomMargin: isVerticalBar ? Style.marginM * scaling : undefined
topMargin: compact ? 0 : isVerticalBar ? Style.marginM * scaling : undefined
bottomMargin: compact ? 0 : isVerticalBar ? Style.marginM * scaling : undefined
}
// Configure GridLayout to behave like RowLayout or ColumnLayout
@ -54,8 +55,8 @@ Rectangle {
Rectangle {
id: iconBackground
anchors.centerIn: parent
width: root.itemSize * 0.75
height: root.itemSize * 0.75
width: parent.width
height: parent.height
color: taskbarItem.isActive ? Color.mPrimary : root.color
border.width: 0
radius: Math.round(Style.radiusXS * root.scaling)
@ -65,8 +66,8 @@ Rectangle {
IconImage {
id: appIcon
anchors.centerIn: parent
width: Style.marginL * root.scaling
height: Style.marginL * root.scaling
width: parent.width
height: parent.height
source: AppIcons.iconForAppId(taskbarItem.modelData.appId)
smooth: true
asynchronous: true