mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
SysMon-bar: support for mPrimary or mOnSurface text via widget settings.
This commit is contained in:
@@ -32,6 +32,7 @@ Rectangle {
|
||||
readonly property bool isVertical: barPosition === "left" || barPosition === "right"
|
||||
readonly property bool density: Settings.data.bar.density
|
||||
|
||||
readonly property bool usePrimaryColor: widgetSettings.usePrimaryColor !== undefined ? widgetSettings.usePrimaryColor : widgetMetadata.usePrimaryColor
|
||||
readonly property bool showCpuUsage: (widgetSettings.showCpuUsage !== undefined) ? widgetSettings.showCpuUsage : widgetMetadata.showCpuUsage
|
||||
readonly property bool showCpuTemp: (widgetSettings.showCpuTemp !== undefined) ? widgetSettings.showCpuTemp : widgetMetadata.showCpuTemp
|
||||
readonly property bool showMemoryUsage: (widgetSettings.showMemoryUsage !== undefined) ? widgetSettings.showMemoryUsage : widgetMetadata.showMemoryUsage
|
||||
@@ -48,6 +49,7 @@ Rectangle {
|
||||
readonly property int percentTextWidth: Math.ceil(percentMetrics.boundingRect.width + 3)
|
||||
readonly property int tempTextWidth: Math.ceil(tempMetrics.boundingRect.width + 3)
|
||||
readonly property int memTextWidth: Math.ceil(memMetrics.boundingRect.width + 3)
|
||||
readonly property color textColor: usePrimaryColor ? Color.mPrimary : Color.mOnSurface
|
||||
|
||||
TextMetrics {
|
||||
id: percentMetrics
|
||||
@@ -130,7 +132,7 @@ Rectangle {
|
||||
Layout.preferredWidth: isVertical ? -1 : percentTextWidth
|
||||
horizontalAlignment: isVertical ? Text.AlignHCenter : Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: Color.mPrimary
|
||||
color: textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
scale: isVertical ? Math.min(1.0, root.width / implicitWidth) : 1.0
|
||||
@@ -173,7 +175,7 @@ Rectangle {
|
||||
Layout.preferredWidth: isVertical ? -1 : tempTextWidth
|
||||
horizontalAlignment: isVertical ? Text.AlignHCenter : Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: Color.mPrimary
|
||||
color: textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
scale: isVertical ? Math.min(1.0, root.width / implicitWidth) : 1.0
|
||||
@@ -216,7 +218,7 @@ Rectangle {
|
||||
Layout.preferredWidth: isVertical ? -1 : (showMemoryAsPercent ? percentTextWidth : memTextWidth)
|
||||
horizontalAlignment: isVertical ? Text.AlignHCenter : Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: Color.mPrimary
|
||||
color: textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
scale: isVertical ? Math.min(1.0, root.width / implicitWidth) : 1.0
|
||||
@@ -259,7 +261,7 @@ Rectangle {
|
||||
Layout.preferredWidth: isVertical ? -1 : memTextWidth
|
||||
horizontalAlignment: isVertical ? Text.AlignHCenter : Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: Color.mPrimary
|
||||
color: textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
scale: isVertical ? Math.min(1.0, root.width / implicitWidth) : 1.0
|
||||
@@ -302,7 +304,7 @@ Rectangle {
|
||||
Layout.preferredWidth: isVertical ? -1 : memTextWidth
|
||||
horizontalAlignment: isVertical ? Text.AlignHCenter : Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: Color.mPrimary
|
||||
color: textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
scale: isVertical ? Math.min(1.0, root.width / implicitWidth) : 1.0
|
||||
@@ -345,7 +347,7 @@ Rectangle {
|
||||
Layout.preferredWidth: isVertical ? -1 : percentTextWidth
|
||||
horizontalAlignment: isVertical ? Text.AlignHCenter : Text.AlignRight
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: Color.mPrimary
|
||||
color: textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
scale: isVertical ? Math.min(1.0, root.width / implicitWidth) : 1.0
|
||||
|
||||
@@ -14,6 +14,7 @@ ColumnLayout {
|
||||
property var widgetMetadata: null
|
||||
|
||||
// Local, editable state for checkboxes
|
||||
property bool valueUsePrimaryColor: widgetData.usePrimaryColor !== undefined ? widgetData.usePrimaryColor : widgetMetadata.usePrimaryColor
|
||||
property bool valueShowCpuUsage: widgetData.showCpuUsage !== undefined ? widgetData.showCpuUsage : widgetMetadata.showCpuUsage
|
||||
property bool valueShowCpuTemp: widgetData.showCpuTemp !== undefined ? widgetData.showCpuTemp : widgetMetadata.showCpuTemp
|
||||
property bool valueShowMemoryUsage: widgetData.showMemoryUsage !== undefined ? widgetData.showMemoryUsage : widgetMetadata.showMemoryUsage
|
||||
@@ -23,6 +24,7 @@ ColumnLayout {
|
||||
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {})
|
||||
settings.usePrimaryColor = valueUsePrimaryColor
|
||||
settings.showCpuUsage = valueShowCpuUsage
|
||||
settings.showCpuTemp = valueShowCpuTemp
|
||||
settings.showMemoryUsage = valueShowMemoryUsage
|
||||
@@ -32,6 +34,14 @@ ColumnLayout {
|
||||
return settings
|
||||
}
|
||||
|
||||
NToggle {
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.widget-settings.clock.use-primary-color.label")
|
||||
description: I18n.tr("bar.widget-settings.clock.use-primary-color.description")
|
||||
checked: valueUsePrimaryColor
|
||||
onToggled: checked => valueUsePrimaryColor = checked
|
||||
}
|
||||
|
||||
NToggle {
|
||||
id: showCpuUsage
|
||||
Layout.fillWidth: true
|
||||
|
||||
Reference in New Issue
Block a user