mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-18 09:14:01 -04:00
dankbar: set tnum: 1 in Numerictext for CPU/GPU/Ram/Battery widgets
related #3161
This commit is contained in:
+1
-1
Submodule dank-qml-common updated: 13b7f2e99a...8b448932de
Generated
+3
-3
@@ -3,11 +3,11 @@
|
||||
"dank-qml-common": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1787413952,
|
||||
"narHash": "sha256-jRqu1xKyWZkFdBlR8sP5qJMFrs+kWjs3Gt6BaNO92Ko=",
|
||||
"lastModified": 1787589656,
|
||||
"narHash": "sha256-RIia8PIMeQGjOK/zrRWDlGLYyfrnqZhwyAnD3ou6l5g=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"rev": "13b7f2e99a08438a94c37b474b355aff3a5c1db8",
|
||||
"rev": "8b448932de27dad60a92ea31c8055e46b293346a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -51,7 +51,8 @@ BasePill {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
NumericText {
|
||||
isMonospace: false
|
||||
text: {
|
||||
if (DgopService.cpuUsage === undefined || DgopService.cpuUsage === null || DgopService.cpuUsage === 0) {
|
||||
return "--";
|
||||
@@ -89,45 +90,21 @@ BasePill {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
id: textBox
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
implicitWidth: root.minimumWidth ? Math.max(cpuBaseline.width, cpuCurrent.width) : cpuCurrent.width
|
||||
implicitHeight: cpuText.implicitHeight
|
||||
|
||||
width: implicitWidth
|
||||
height: implicitHeight
|
||||
|
||||
StyledTextMetrics {
|
||||
id: cpuBaseline
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
text: "100%"
|
||||
}
|
||||
|
||||
StyledTextMetrics {
|
||||
id: cpuCurrent
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
text: cpuText.text
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: cpuText
|
||||
text: {
|
||||
const v = DgopService.cpuUsage;
|
||||
if (v === undefined || v === null || v === 0) {
|
||||
return "--%";
|
||||
}
|
||||
return v.toFixed(0) + "%";
|
||||
NumericText {
|
||||
isMonospace: false
|
||||
text: {
|
||||
const v = DgopService.cpuUsage;
|
||||
if (v === undefined || v === null || v === 0) {
|
||||
return "--%";
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
|
||||
anchors.fill: parent
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideNone
|
||||
return v.toFixed(0) + "%";
|
||||
}
|
||||
reserveText: root.minimumWidth ? "100%" : ""
|
||||
width: Math.ceil(Math.max(implicitWidth, reservedWidth))
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ BasePill {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
NumericText {
|
||||
isMonospace: false
|
||||
text: {
|
||||
if (DgopService.cpuTemperature === undefined || DgopService.cpuTemperature === null || DgopService.cpuTemperature < 0) {
|
||||
return "--";
|
||||
@@ -89,39 +90,21 @@ BasePill {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
id: textBox
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
implicitWidth: root.minimumWidth ? Math.max(tempBaseline.width, cpuTempText.paintedWidth) : cpuTempText.paintedWidth
|
||||
implicitHeight: cpuTempText.implicitHeight
|
||||
|
||||
width: implicitWidth
|
||||
height: implicitHeight
|
||||
|
||||
StyledTextMetrics {
|
||||
id: tempBaseline
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
text: "88°"
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: cpuTempText
|
||||
text: {
|
||||
if (DgopService.cpuTemperature === undefined || DgopService.cpuTemperature === null || DgopService.cpuTemperature < 0) {
|
||||
return "--°";
|
||||
}
|
||||
|
||||
return Math.round(DgopService.cpuTemperature) + "°";
|
||||
NumericText {
|
||||
isMonospace: false
|
||||
text: {
|
||||
if (DgopService.cpuTemperature === undefined || DgopService.cpuTemperature === null || DgopService.cpuTemperature < 0) {
|
||||
return "--°";
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
|
||||
anchors.fill: parent
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideNone
|
||||
return Math.round(DgopService.cpuTemperature) + "°";
|
||||
}
|
||||
reserveText: root.minimumWidth ? "88°" : ""
|
||||
width: Math.ceil(Math.max(implicitWidth, reservedWidth))
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,8 @@ BasePill {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
NumericText {
|
||||
isMonospace: false
|
||||
text: {
|
||||
if (root.displayTemp === undefined || root.displayTemp === null || root.displayTemp === 0) {
|
||||
return "--";
|
||||
@@ -157,39 +158,21 @@ BasePill {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
id: textBox
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
implicitWidth: root.minimumWidth ? Math.max(gpuTempBaseline.width, gpuTempText.paintedWidth) : gpuTempText.paintedWidth
|
||||
implicitHeight: gpuTempText.implicitHeight
|
||||
|
||||
width: implicitWidth
|
||||
height: implicitHeight
|
||||
|
||||
StyledTextMetrics {
|
||||
id: gpuTempBaseline
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
text: "88°"
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: gpuTempText
|
||||
text: {
|
||||
if (root.displayTemp === undefined || root.displayTemp === null || root.displayTemp === 0) {
|
||||
return "--°";
|
||||
}
|
||||
|
||||
return Math.round(root.displayTemp) + "°";
|
||||
NumericText {
|
||||
isMonospace: false
|
||||
text: {
|
||||
if (root.displayTemp === undefined || root.displayTemp === null || root.displayTemp === 0) {
|
||||
return "--°";
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
|
||||
anchors.fill: parent
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideNone
|
||||
return Math.round(root.displayTemp) + "°";
|
||||
}
|
||||
reserveText: root.minimumWidth ? "88°" : ""
|
||||
width: Math.ceil(Math.max(implicitWidth, reservedWidth))
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,8 @@ BasePill {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
NumericText {
|
||||
isMonospace: false
|
||||
text: {
|
||||
if (DgopService.memoryUsage === undefined || DgopService.memoryUsage === null || DgopService.memoryUsage === 0) {
|
||||
return "--";
|
||||
@@ -71,7 +72,8 @@ BasePill {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
StyledText {
|
||||
NumericText {
|
||||
isMonospace: false
|
||||
visible: root.showSwap && DgopService.totalSwapKB > 0
|
||||
text: root.swapUsage.toFixed(0)
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
@@ -104,59 +106,40 @@ BasePill {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
id: textBox
|
||||
NumericText {
|
||||
isMonospace: false
|
||||
text: {
|
||||
if (DgopService.memoryUsage === undefined || DgopService.memoryUsage === null || DgopService.memoryUsage === 0) {
|
||||
return root.showInGb ? "-- GB" : "--%";
|
||||
}
|
||||
|
||||
let ramText = "";
|
||||
if (root.showInGb) {
|
||||
ramText = (DgopService.usedMemoryMB / 1024).toFixed(1) + " GB";
|
||||
} else {
|
||||
ramText = DgopService.memoryUsage.toFixed(0) + "%";
|
||||
}
|
||||
|
||||
if (root.showSwap && DgopService.totalSwapKB > 0) {
|
||||
return ramText + " · " + root.swapUsage.toFixed(0) + "%";
|
||||
}
|
||||
return ramText;
|
||||
}
|
||||
reserveText: {
|
||||
if (!root.minimumWidth) {
|
||||
return "";
|
||||
}
|
||||
const baseText = root.showInGb ? "88.8 GB" : "88%";
|
||||
if (!root.showSwap) {
|
||||
return baseText;
|
||||
}
|
||||
return root.swapUsage < 10 ? baseText + " · 0%" : baseText + " · 88%";
|
||||
}
|
||||
width: Math.ceil(Math.max(implicitWidth, reservedWidth))
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
implicitWidth: root.minimumWidth ? Math.max(ramBaseline.width, ramText.paintedWidth) : ramText.paintedWidth
|
||||
implicitHeight: ramText.implicitHeight
|
||||
|
||||
width: implicitWidth
|
||||
height: implicitHeight
|
||||
|
||||
StyledTextMetrics {
|
||||
id: ramBaseline
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
text: {
|
||||
let baseText = root.showInGb ? "88.8 GB" : "88%";
|
||||
if (!root.showSwap) {
|
||||
return baseText;
|
||||
}
|
||||
if (root.swapUsage < 10) {
|
||||
return baseText + " · 0%";
|
||||
}
|
||||
return baseText + " · 88%";
|
||||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: ramText
|
||||
text: {
|
||||
if (DgopService.memoryUsage === undefined || DgopService.memoryUsage === null || DgopService.memoryUsage === 0) {
|
||||
return root.showInGb ? "-- GB" : "--%";
|
||||
}
|
||||
|
||||
let ramText = "";
|
||||
if (root.showInGb) {
|
||||
ramText = (DgopService.usedMemoryMB / 1024).toFixed(1) + " GB";
|
||||
} else {
|
||||
ramText = DgopService.memoryUsage.toFixed(0) + "%";
|
||||
}
|
||||
|
||||
if (root.showSwap && DgopService.totalSwapKB > 0) {
|
||||
return ramText + " · " + root.swapUsage.toFixed(0) + "%";
|
||||
}
|
||||
return ramText;
|
||||
}
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
|
||||
color: Theme.widgetTextColor
|
||||
|
||||
anchors.fill: parent
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
elide: Text.ElideNone
|
||||
wrapMode: Text.NoWrap
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,9 @@ Item {
|
||||
|
||||
font.weight: root.glyphWeight
|
||||
font.pixelSize: Math.max(1, root.baseTextSize)
|
||||
font.features: {
|
||||
"tnum": 1
|
||||
}
|
||||
text: root.numberText
|
||||
}
|
||||
|
||||
@@ -207,9 +210,10 @@ Item {
|
||||
width: root.width
|
||||
height: root.height
|
||||
|
||||
StyledText {
|
||||
NumericText {
|
||||
id: numberGlyph
|
||||
|
||||
isMonospace: false
|
||||
visible: root.numberInside
|
||||
x: root.textCanvasLeft + (root.textCanvasWidth - implicitWidth - signGlyph.implicitWidth) / 2
|
||||
y: root.textBaseline - baselineOffset
|
||||
|
||||
Reference in New Issue
Block a user