1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

scalable topbar

This commit is contained in:
bbedward
2025-08-23 15:15:07 -04:00
parent 9d7b617cd6
commit 3f6d330f5f
21 changed files with 162 additions and 110 deletions

View File

@@ -23,9 +23,11 @@ PanelWindow {
readonly property int notificationCount: NotificationService.notifications.length
property bool autoHide: SettingsData.topBarAutoHide
property bool reveal: !autoHide || topBarMouseArea.containsMouse
readonly property real effectiveBarHeight: Math.max(root.widgetHeight + SettingsData.topBarInnerPadding + 4, Theme.barHeight - 4 - (8 - SettingsData.topBarInnerPadding))
readonly property real widgetHeight: Math.max(20, 26 + SettingsData.topBarInnerPadding * 0.6)
screen: modelData
implicitHeight: Theme.barHeight - 4 + SettingsData.topBarSpacing
implicitHeight: effectiveBarHeight + SettingsData.topBarSpacing
color: "transparent"
Component.onCompleted: {
let fonts = Qt.fontFamilies()
@@ -153,7 +155,7 @@ PanelWindow {
right: true
}
exclusiveZone: autoHide ? -1 : Theme.barHeight - 4 + SettingsData.topBarSpacing
exclusiveZone: autoHide ? -1 : root.effectiveBarHeight + SettingsData.topBarSpacing - 2
mask: Region {
item: topBarMouseArea
@@ -161,7 +163,7 @@ PanelWindow {
MouseArea {
id: topBarMouseArea
height: root.reveal ? Theme.barHeight - 4 + SettingsData.topBarSpacing : 4
height: root.reveal ? effectiveBarHeight + SettingsData.topBarSpacing : 4
anchors {
top: parent.top
left: parent.left
@@ -182,7 +184,7 @@ PanelWindow {
transform: Translate {
id: topBarSlide
y: root.reveal ? 0 : -(Theme.barHeight - 8)
y: root.reveal ? 0 : -(effectiveBarHeight - 4)
Behavior on y {
NumberAnimation {
@@ -386,10 +388,10 @@ PanelWindow {
}
anchors.fill: parent
anchors.leftMargin: Theme.spacingM
anchors.rightMargin: Theme.spacingM
anchors.topMargin: Theme.spacingXS
anchors.bottomMargin: Theme.spacingXS
anchors.leftMargin: Math.max(Theme.spacingXS, SettingsData.topBarInnerPadding * 0.8)
anchors.rightMargin: Math.max(Theme.spacingXS, SettingsData.topBarInnerPadding * 0.8)
anchors.topMargin: SettingsData.topBarInnerPadding / 2
anchors.bottomMargin: SettingsData.topBarInnerPadding / 2
clip: true
Row {
@@ -604,7 +606,7 @@ PanelWindow {
Rectangle {
width: 40
height: 30
height: root.widgetHeight
radius: Theme.cornerRadius
color: {
const baseColor = clipboardArea.containsMouse ? Theme.primaryHover : Theme.secondaryHover
@@ -646,6 +648,8 @@ PanelWindow {
LauncherButton {
isActive: false
widgetHeight: root.widgetHeight
barHeight: root.effectiveBarHeight
section: {
if (parent && parent.parent) {
if (parent.parent === leftSection)
@@ -672,6 +676,7 @@ PanelWindow {
WorkspaceSwitcher {
screenName: root.screenName
widgetHeight: root.widgetHeight
}
}
@@ -680,6 +685,7 @@ PanelWindow {
FocusedApp {
availableWidth: topBarContent.leftToMediaGap
widgetHeight: root.widgetHeight
}
}
@@ -687,6 +693,7 @@ PanelWindow {
id: runningAppsComponent
RunningApps {
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -706,6 +713,8 @@ PanelWindow {
Clock {
compactMode: topBarContent.overlapping
barHeight: root.effectiveBarHeight
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -736,6 +745,8 @@ PanelWindow {
Media {
compactMode: topBarContent.spacingTight
|| topBarContent.overlapping
barHeight: root.effectiveBarHeight
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -764,6 +775,8 @@ PanelWindow {
id: weatherComponent
Weather {
barHeight: root.effectiveBarHeight
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -794,6 +807,7 @@ PanelWindow {
SystemTrayBar {
parentWindow: root
parentScreen: root.screen
widgetHeight: root.widgetHeight
}
}
@@ -801,6 +815,7 @@ PanelWindow {
id: privacyIndicatorComponent
PrivacyIndicator {
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -818,6 +833,8 @@ PanelWindow {
id: cpuUsageComponent
CpuMonitor {
barHeight: root.effectiveBarHeight
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -844,6 +861,8 @@ PanelWindow {
id: memUsageComponent
RamMonitor {
barHeight: root.effectiveBarHeight
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -870,6 +889,8 @@ PanelWindow {
id: cpuTempComponent
CpuTemperature {
barHeight: root.effectiveBarHeight
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -896,6 +917,8 @@ PanelWindow {
id: gpuTempComponent
GpuTemperature {
barHeight: root.effectiveBarHeight
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -925,6 +948,8 @@ PanelWindow {
NotificationCenterButton {
hasUnread: root.notificationCount > 0
isActive: notificationCenterLoader.item ? notificationCenterLoader.item.shouldBeVisible : false
widgetHeight: root.widgetHeight
barHeight: root.effectiveBarHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -953,6 +978,8 @@ PanelWindow {
Battery {
batteryPopupVisible: batteryPopoutLoader.item ? batteryPopoutLoader.item.shouldBeVisible : false
widgetHeight: root.widgetHeight
barHeight: root.effectiveBarHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -981,6 +1008,8 @@ PanelWindow {
ControlCenterButton {
isActive: controlCenterLoader.item ? controlCenterLoader.item.shouldBeVisible : false
widgetHeight: root.widgetHeight
barHeight: root.effectiveBarHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -1023,6 +1052,7 @@ PanelWindow {
id: idleInhibitorComponent
IdleInhibitor {
widgetHeight: root.widgetHeight
section: {
if (parent && parent.parent === leftSection)
return "left"
@@ -1041,7 +1071,7 @@ PanelWindow {
Item {
width: parent.spacerSize || 20
height: 30
height: root.widgetHeight
Rectangle {
anchors.fill: parent
@@ -1068,7 +1098,7 @@ PanelWindow {
Rectangle {
width: 1
height: 20
height: root.widgetHeight * 0.67
color: Theme.outline
opacity: 0.3
}