mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
sysmon-barwidget: ability to choose color of icon and text separately
This commit is contained in:
@@ -462,6 +462,7 @@
|
||||
"security": "Sicherheit",
|
||||
"select": "Auswählen",
|
||||
"select-color": "Farbe auswählen",
|
||||
"select-icon-color": "Symbolfarbe auswählen",
|
||||
"shortcuts": "Kurzbefehle",
|
||||
"shutdown": "Herunterfahren",
|
||||
"signal": "Signal",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Security",
|
||||
"select": "Select",
|
||||
"select-color": "Select color",
|
||||
"select-icon-color": "Select icon color",
|
||||
"shortcuts": "Shortcuts",
|
||||
"shutdown": "Shutdown",
|
||||
"signal": "Signal",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Seguridad",
|
||||
"select": "Seleccionar",
|
||||
"select-color": "Seleccionar color",
|
||||
"select-icon-color": "Seleccionar color de icono",
|
||||
"shortcuts": "Atajos",
|
||||
"shutdown": "Apagar",
|
||||
"signal": "Señal",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Sécurité",
|
||||
"select": "Sélectionner",
|
||||
"select-color": "Sélectionner une couleur",
|
||||
"select-icon-color": "Sélectionner la couleur de l'icône",
|
||||
"shortcuts": "Raccourcis",
|
||||
"shutdown": "Éteindre",
|
||||
"signal": "Signal",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Biztonság",
|
||||
"select": "Kiválasztás",
|
||||
"select-color": "Szín kiválasztása",
|
||||
"select-icon-color": "Ikon színének kiválasztása",
|
||||
"shortcuts": "Gyorsbillentyűk",
|
||||
"shutdown": "Leállítás",
|
||||
"signal": "Jelzés",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "セキュリティ",
|
||||
"select": "選択",
|
||||
"select-color": "色を選択",
|
||||
"select-icon-color": "アイコンの色を選択",
|
||||
"shortcuts": "ショートカット",
|
||||
"shutdown": "シャットダウン",
|
||||
"signal": "信号",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "보안",
|
||||
"select": "선택",
|
||||
"select-color": "색상 선택",
|
||||
"select-icon-color": "아이콘 색상 선택",
|
||||
"shortcuts": "단축키",
|
||||
"shutdown": "시스템 종료",
|
||||
"signal": "신호",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Beveiliging",
|
||||
"select": "Selecteer",
|
||||
"select-color": "Kleur selecteren",
|
||||
"select-icon-color": "Icoonkleur selecteren",
|
||||
"shortcuts": "Snelkoppelingen",
|
||||
"shutdown": "Afsluiten",
|
||||
"signal": "Signaal",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Bezpieczeństwo",
|
||||
"select": "Wybierz",
|
||||
"select-color": "Wybierz kolor",
|
||||
"select-icon-color": "Wybierz kolor ikony",
|
||||
"shortcuts": "Skróty",
|
||||
"shutdown": "Wyłącz",
|
||||
"signal": "Sygnał",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Segurança",
|
||||
"select": "Selecionar",
|
||||
"select-color": "Selecionar cor",
|
||||
"select-icon-color": "Selecionar cor do ícone",
|
||||
"shortcuts": "Atalhos",
|
||||
"shutdown": "Desligar",
|
||||
"signal": "Sinal",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Безопасность",
|
||||
"select": "Выбрать",
|
||||
"select-color": "Выбрать цвет",
|
||||
"select-icon-color": "Выбрать цвет значка",
|
||||
"shortcuts": "Ярлыки",
|
||||
"shutdown": "Выключить",
|
||||
"signal": "Сигнал",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Säkerhet",
|
||||
"select": "Välj",
|
||||
"select-color": "Välj färg",
|
||||
"select-icon-color": "Välj ikonfärg",
|
||||
"shortcuts": "Genvägar",
|
||||
"shutdown": "Stäng av",
|
||||
"signal": "Signal",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Güvenlik",
|
||||
"select": "Seç",
|
||||
"select-color": "Renk Seç",
|
||||
"select-icon-color": "Simge rengini seçin",
|
||||
"shortcuts": "Kısayollar",
|
||||
"shutdown": "Kapat",
|
||||
"signal": "Sinyal",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "Безпека",
|
||||
"select": "Вибрати",
|
||||
"select-color": "Вибрати колір",
|
||||
"select-icon-color": "Вибрати колір значка",
|
||||
"shortcuts": "Ярлики",
|
||||
"shutdown": "Вимкнути",
|
||||
"signal": "Сигнал",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "安全",
|
||||
"select": "选择",
|
||||
"select-color": "选择颜色",
|
||||
"select-icon-color": "选择图标颜色",
|
||||
"shortcuts": "快捷方式",
|
||||
"shutdown": "关机",
|
||||
"signal": "信号",
|
||||
|
||||
@@ -462,6 +462,7 @@
|
||||
"security": "安全",
|
||||
"select": "選取",
|
||||
"select-color": "選擇顏色",
|
||||
"select-icon-color": "選擇圖示顏色",
|
||||
"shortcuts": "快捷鍵",
|
||||
"shutdown": "關機",
|
||||
"signal": "訊號",
|
||||
|
||||
@@ -40,6 +40,7 @@ Item {
|
||||
readonly property real barFontSize: Style.getBarFontSizeForScreen(screenName)
|
||||
|
||||
readonly property bool compactMode: widgetSettings.compactMode !== undefined ? widgetSettings.compactMode : widgetMetadata.compactMode
|
||||
readonly property string iconColorKey: widgetSettings.iconColor !== undefined ? widgetSettings.iconColor : widgetMetadata.iconColor
|
||||
readonly property string textColorKey: widgetSettings.textColor !== undefined ? widgetSettings.textColor : widgetMetadata.textColor
|
||||
|
||||
readonly property bool useMonospaceFont: widgetSettings.useMonospaceFont !== undefined ? widgetSettings.useMonospaceFont : widgetMetadata.useMonospaceFont
|
||||
@@ -65,6 +66,21 @@ Item {
|
||||
readonly property real contentWidth: isVertical ? capsuleHeight : Math.round(mainGrid.implicitWidth + Style.marginXL)
|
||||
readonly property real contentHeight: isVertical ? Math.round(mainGrid.implicitHeight + Style.marginXL) : capsuleHeight
|
||||
|
||||
readonly property color iconColor: {
|
||||
switch (iconColorKey) {
|
||||
case "primary":
|
||||
return Color.mPrimary;
|
||||
case "secondary":
|
||||
return Color.mSecondary;
|
||||
case "tertiary":
|
||||
return Color.mTertiary;
|
||||
case "error":
|
||||
return Color.mError;
|
||||
default:
|
||||
return Color.mOnSurface;
|
||||
}
|
||||
}
|
||||
|
||||
readonly property color textColor: {
|
||||
switch (textColorKey) {
|
||||
case "primary":
|
||||
@@ -263,7 +279,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: (cpuWarning || cpuCritical) ? SystemStatService.cpuColor : Color.mOnSurface
|
||||
color: (cpuWarning || cpuCritical) ? SystemStatService.cpuColor : root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +293,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: (cpuWarning || cpuCritical) ? SystemStatService.cpuColor : textColor
|
||||
color: (cpuWarning || cpuCritical) ? SystemStatService.cpuColor : root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
@@ -331,7 +347,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: Color.mOnSurface
|
||||
color: root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,7 +361,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: textColor
|
||||
color: root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
@@ -399,7 +415,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: (tempWarning || tempCritical) ? SystemStatService.tempColor : Color.mOnSurface
|
||||
color: (tempWarning || tempCritical) ? SystemStatService.tempColor : root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -413,7 +429,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: (tempWarning || tempCritical) ? SystemStatService.tempColor : textColor
|
||||
color: (tempWarning || tempCritical) ? SystemStatService.tempColor : root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
@@ -467,7 +483,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: (gpuWarning || gpuCritical) ? SystemStatService.gpuColor : Color.mOnSurface
|
||||
color: (gpuWarning || gpuCritical) ? SystemStatService.gpuColor : root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -481,7 +497,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: (gpuWarning || gpuCritical) ? SystemStatService.gpuColor : textColor
|
||||
color: (gpuWarning || gpuCritical) ? SystemStatService.gpuColor : root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
@@ -535,7 +551,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: Color.mOnSurface
|
||||
color: root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +565,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: textColor
|
||||
color: root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
@@ -603,7 +619,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: (memWarning || memCritical) ? SystemStatService.memColor : Color.mOnSurface
|
||||
color: (memWarning || memCritical) ? SystemStatService.memColor : root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -617,7 +633,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: (memWarning || memCritical) ? SystemStatService.memColor : textColor
|
||||
color: (memWarning || memCritical) ? SystemStatService.memColor : root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
@@ -671,7 +687,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: (swapWarning || swapCritical) ? SystemStatService.swapColor : Color.mOnSurface
|
||||
color: (swapWarning || swapCritical) ? SystemStatService.swapColor : root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -685,7 +701,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: (swapWarning || swapCritical) ? SystemStatService.swapColor : textColor
|
||||
color: (swapWarning || swapCritical) ? SystemStatService.swapColor : root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
@@ -738,6 +754,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -751,7 +768,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: textColor
|
||||
color: root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
@@ -803,6 +820,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -816,7 +834,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: textColor
|
||||
color: root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
@@ -869,7 +887,7 @@ Item {
|
||||
applyUiScale: false
|
||||
x: Style.pixelAlignCenter(parent.width, width)
|
||||
y: Style.pixelAlignCenter(parent.height, contentHeight)
|
||||
color: (diskWarning || diskCritical) ? SystemStatService.getDiskColor(diskPath) : Color.mOnSurface
|
||||
color: (diskWarning || diskCritical) ? SystemStatService.getDiskColor(diskPath) : root.iconColor
|
||||
}
|
||||
}
|
||||
|
||||
@@ -886,7 +904,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: (diskWarning || diskCritical) ? SystemStatService.getDiskColor(diskPath) : textColor
|
||||
color: (diskWarning || diskCritical) ? SystemStatService.getDiskColor(diskPath) : root.textColor
|
||||
Layout.row: isVertical ? 0 : 0
|
||||
Layout.column: isVertical ? 0 : 1
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ ColumnLayout {
|
||||
|
||||
// Local, editable state for checkboxes
|
||||
property bool valueCompactMode: widgetData.compactMode !== undefined ? widgetData.compactMode : widgetMetadata.compactMode
|
||||
property string valueIconColor: widgetData.iconColor !== undefined ? widgetData.iconColor : widgetMetadata.iconColor
|
||||
property string valueTextColor: widgetData.textColor !== undefined ? widgetData.textColor : widgetMetadata.textColor
|
||||
property bool valueUseMonospaceFont: widgetData.useMonospaceFont !== undefined ? widgetData.useMonospaceFont : widgetMetadata.useMonospaceFont
|
||||
property bool valueShowCpuUsage: widgetData.showCpuUsage !== undefined ? widgetData.showCpuUsage : widgetMetadata.showCpuUsage
|
||||
@@ -36,6 +37,7 @@ ColumnLayout {
|
||||
function saveSettings() {
|
||||
var settings = Object.assign({}, widgetData || {});
|
||||
settings.compactMode = valueCompactMode;
|
||||
settings.iconColor = valueIconColor;
|
||||
settings.textColor = valueTextColor;
|
||||
settings.useMonospaceFont = valueUseMonospaceFont;
|
||||
settings.showCpuUsage = valueShowCpuUsage;
|
||||
@@ -66,6 +68,39 @@ ColumnLayout {
|
||||
}
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
label: I18n.tr("common.select-icon-color")
|
||||
description: I18n.tr("bar.clock.select-color-description")
|
||||
model: [
|
||||
{
|
||||
"name": I18n.tr("common.none"),
|
||||
"key": "none"
|
||||
},
|
||||
{
|
||||
"key": "primary",
|
||||
"name": I18n.tr("common.primary")
|
||||
},
|
||||
{
|
||||
"key": "secondary",
|
||||
"name": I18n.tr("common.secondary")
|
||||
},
|
||||
{
|
||||
"key": "tertiary",
|
||||
"name": I18n.tr("common.tertiary")
|
||||
},
|
||||
{
|
||||
"key": "error",
|
||||
"name": I18n.tr("common.error")
|
||||
}
|
||||
]
|
||||
currentKey: valueIconColor
|
||||
onSelected: key => {
|
||||
valueIconColor = key;
|
||||
settingsChanged(saveSettings());
|
||||
}
|
||||
minimumWidth: 200
|
||||
}
|
||||
|
||||
NComboBox {
|
||||
label: I18n.tr("common.select-color")
|
||||
description: I18n.tr("bar.clock.select-color-description")
|
||||
|
||||
@@ -195,6 +195,7 @@ Singleton {
|
||||
},
|
||||
"SystemMonitor": {
|
||||
"compactMode": true,
|
||||
"iconColor": "none",
|
||||
"textColor": "none",
|
||||
"useMonospaceFont": true,
|
||||
"showCpuUsage": true,
|
||||
|
||||
Reference in New Issue
Block a user