Files
DankMaterialShell/quickshell/Modules/ControlCenter/Components/HeaderPane.qml
T
bbedward 014c69b09a settings: tile color restyle and re-org, use materials own shift for
them towards theme
controlCenter: make a real grid, add numerous more tile varieties, add
icon size option
surfaces: fix elevation levels in general, and shift them down
settings: restyles and re-org
sliders: scale down universally
2026-09-18 14:32:55 -04:00

140 lines
4.6 KiB
QML

import QtQuick
import qs.Common
import qs.Modules.ControlCenter
import qs.Services
import qs.Widgets
Item {
id: root
LayoutMirroring.enabled: I18n.isRtl
LayoutMirroring.childrenInherit: true
property bool editMode: false
property bool tapToClose: false
property bool live: true
signal powerButtonClicked
signal lockRequested
signal editModeToggled
signal settingsButtonClicked
signal headerTapped
Ref {
service: DgopService
modules: "system"
active: root.live && root.visible && (root.Window.window?.visible ?? false)
}
implicitHeight: CcMetrics.headerHeight
height: implicitHeight
MouseArea {
anchors.fill: parent
enabled: root.tapToClose
acceptedButtons: Qt.LeftButton
onClicked: root.headerTapped()
}
Item {
anchors.left: parent.left
anchors.right: actionButtonsRow.left
anchors.rightMargin: Theme.spacingM
anchors.verticalCenter: parent.verticalCenter
anchors.leftMargin: Theme.spacingS
height: CcMetrics.headerAvatarSize
DankCircularImage {
id: avatar
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
width: CcMetrics.headerAvatarSize
height: CcMetrics.headerAvatarSize
imageSource: {
if (PortalService.profileImage === "")
return "";
if (PortalService.profileImage.startsWith("/"))
return "file://" + PortalService.profileImage;
return PortalService.profileImage;
}
fallbackIcon: "person"
}
Item {
anchors.left: avatar.right
anchors.leftMargin: Theme.spacingM
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
implicitHeight: userLabel.implicitHeight + Theme.spacingXXS + uptimeLabel.implicitHeight
StyledText {
id: userLabel
width: parent.width
text: UserInfoService.fullName || UserInfoService.username || I18n.tr("User")
font.pixelSize: Theme.fontSizeLarge
font.weight: Theme.fontWeightMedium
color: Theme.surfaceText
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
}
StyledText {
id: uptimeLabel
y: userLabel.implicitHeight + Theme.spacingXXS
width: parent.width
text: DgopService.uptime ? I18n.tr("up", "uptime prefix, e.g. 'up 4h 2m'") + " " + DgopService.uptime.slice(3) : I18n.tr("Unknown")
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceVariantText
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
}
}
}
Row {
id: actionButtonsRow
width: CcMetrics.headerActionSize * 4 + spacing * 3
height: CcMetrics.headerActionSize
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: Theme.spacingXS
DankActionButton {
buttonSize: CcMetrics.headerActionSize
iconSize: CcMetrics.headerActionIconSize
iconName: "lock"
iconColor: Theme.surfaceText
Accessible.name: I18n.tr("Lock")
onClicked: root.lockRequested()
}
DankActionButton {
buttonSize: CcMetrics.headerActionSize
iconSize: CcMetrics.headerActionIconSize
iconName: "power_settings_new"
iconColor: Theme.surfaceText
Accessible.name: I18n.tr("Power")
onClicked: root.powerButtonClicked()
}
DankActionButton {
buttonSize: CcMetrics.headerActionSize
iconSize: CcMetrics.headerActionIconSize
iconName: "settings"
iconColor: Theme.surfaceText
Accessible.name: I18n.tr("Settings")
onClicked: root.settingsButtonClicked()
}
DankActionButton {
buttonSize: CcMetrics.headerActionSize
iconSize: CcMetrics.headerActionIconSize
iconName: root.editMode ? "done" : "edit"
iconColor: root.editMode ? Theme.onSecondaryContainer : Theme.surfaceText
backgroundColor: root.editMode ? Theme.secondaryContainer : "transparent"
Accessible.name: root.editMode ? I18n.tr("Finish") : I18n.tr("Edit")
onClicked: root.editModeToggled()
}
}
}