Compare commits

..

No commits in common. "d38c4b51614bb2b59caaea38bc68021ba1d86444" and "1db16b435c910754214696e46279dca7fb35ea04" have entirely different histories.

6 changed files with 39 additions and 37 deletions

View file

@ -12,6 +12,14 @@ Column {
property bool active: true property bool active: true
function _loadColor(pct) {
const t = Math.max(0, Math.min(100, pct)) / 100;
const a = t < 0.5 ? S.Theme.base0B : S.Theme.base0A;
const b = t < 0.5 ? S.Theme.base0A : S.Theme.base08;
const u = t < 0.5 ? t * 2 : (t - 0.5) * 2;
return Qt.rgba(a.r + (b.r - a.r) * u, a.g + (b.g - a.g) * u, a.b + (b.b - a.b) * u, 1);
}
// Per-core rows // Per-core rows
Repeater { Repeater {
model: root.cores.length model: root.cores.length
@ -22,7 +30,7 @@ Column {
readonly property int _u: root.cores[index]?.usage ?? 0 readonly property int _u: root.cores[index]?.usage ?? 0
readonly property real _f: root.cores[index]?.freq_ghz ?? 0 readonly property real _f: root.cores[index]?.freq_ghz ?? 0
readonly property color _barColor: S.Theme.loadColor(_u) readonly property color _barColor: root._loadColor(_u)
readonly property bool _throttled: { readonly property bool _throttled: {
const maxF = root.coreMaxFreq[index] ?? 0; const maxF = root.coreMaxFreq[index] ?? 0;
return maxF > 0 && _f < maxF * 0.85 && _u >= 60; return maxF > 0 && _f < maxF * 0.85 && _u >= 60;
@ -210,7 +218,7 @@ Column {
anchors.rightMargin: 12 anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: modelData.cpu.toFixed(1) + "%" text: modelData.cpu.toFixed(1) + "%"
color: S.Theme.loadColor(modelData.cpu) color: root._loadColor(modelData.cpu)
font.pixelSize: S.Theme.fontSize - 2 font.pixelSize: S.Theme.fontSize - 2
font.family: S.Theme.fontFamily font.family: S.Theme.fontFamily
width: 36 width: 36

View file

@ -17,6 +17,14 @@ Column {
return bytes + "B"; return bytes + "B";
} }
function _barColor(pct) {
const t = Math.max(0, Math.min(100, pct)) / 100;
const a = t < 0.5 ? S.Theme.base0B : S.Theme.base0A;
const b = t < 0.5 ? S.Theme.base0A : S.Theme.base08;
const u = t < 0.5 ? t * 2 : (t - 0.5) * 2;
return Qt.rgba(a.r + (b.r - a.r) * u, a.g + (b.g - a.g) * u, a.b + (b.b - a.b) * u, 1);
}
Repeater { Repeater {
model: root.mounts model: root.mounts
@ -56,7 +64,7 @@ Column {
Rectangle { Rectangle {
width: parent.width * (modelData.pct / 100) width: parent.width * (modelData.pct / 100)
height: parent.height height: parent.height
color: S.Theme.loadColor(modelData.pct) color: root._barColor(modelData.pct)
radius: 2 radius: 2
Behavior on width { Behavior on width {
NumberAnimation { NumberAnimation {

View file

@ -8,6 +8,14 @@ Column {
property bool active: true property bool active: true
function _loadColor(pct) {
const t = Math.max(0, Math.min(100, pct)) / 100;
const a = t < 0.5 ? S.Theme.base0B : S.Theme.base0A;
const b = t < 0.5 ? S.Theme.base0A : S.Theme.base08;
const u = t < 0.5 ? t * 2 : (t - 0.5) * 2;
return Qt.rgba(a.r + (b.r - a.r) * u, a.g + (b.g - a.g) * u, a.b + (b.b - a.b) * u, 1);
}
function _fmt(gb) { function _fmt(gb) {
return gb >= 10 ? gb.toFixed(1) + "G" : gb.toFixed(2) + "G"; return gb >= 10 ? gb.toFixed(1) + "G" : gb.toFixed(2) + "G";
} }
@ -33,7 +41,7 @@ Column {
anchors.rightMargin: 12 anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: S.SystemStats.gpuUsage + "%" text: S.SystemStats.gpuUsage + "%"
color: S.Theme.loadColor(S.SystemStats.gpuUsage) color: root._loadColor(S.SystemStats.gpuUsage)
font.pixelSize: S.Theme.fontSize font.pixelSize: S.Theme.fontSize
font.family: S.Theme.fontFamily font.family: S.Theme.fontFamily
font.bold: true font.bold: true
@ -62,7 +70,7 @@ Column {
Rectangle { Rectangle {
width: parent.width * Math.min(1, S.SystemStats.gpuUsage / 100) width: parent.width * Math.min(1, S.SystemStats.gpuUsage / 100)
height: parent.height height: parent.height
color: S.Theme.loadColor(S.SystemStats.gpuUsage) color: root._loadColor(S.SystemStats.gpuUsage)
radius: 3 radius: 3
Behavior on width { Behavior on width {
enabled: root.active enabled: root.active
@ -105,7 +113,7 @@ Column {
const offset = maxSamples - d.length; const offset = maxSamples - d.length;
for (let i = 0; i < d.length; i++) { for (let i = 0; i < d.length; i++) {
const barH = Math.max(1, height * d[i] / 100); const barH = Math.max(1, height * d[i] / 100);
const col = S.Theme.loadColor(d[i]); const col = root._loadColor(d[i]);
ctx.fillStyle = col.toString(); ctx.fillStyle = col.toString();
ctx.fillRect((offset + i) * bw, height - barH, Math.max(1, bw - 0.5), barH); ctx.fillRect((offset + i) * bw, height - barH, Math.max(1, bw - 0.5), barH);
} }

View file

@ -21,6 +21,14 @@ Column {
} }
} }
function _tempColor(celsius) {
const t = Math.max(0, Math.min(100, celsius)) / 100;
const a = t < 0.5 ? S.Theme.base0B : S.Theme.base0A;
const b = t < 0.5 ? S.Theme.base0A : S.Theme.base08;
const u = t < 0.5 ? t * 2 : (t - 0.5) * 2;
return Qt.rgba(a.r + (b.r - a.r) * u, a.g + (b.g - a.g) * u, a.b + (b.b - a.b) * u, 1);
}
// Header - current temp // Header - current temp
Item { Item {
width: root.width width: root.width
@ -242,7 +250,7 @@ Column {
anchors.rightMargin: 12 anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: modelData.celsius + "\u00B0C" text: modelData.celsius + "\u00B0C"
color: S.Theme.loadColor(modelData.celsius) color: root._tempColor(modelData.celsius)
font.pixelSize: S.Theme.fontSize - 2 font.pixelSize: S.Theme.fontSize - 2
font.family: S.Theme.fontFamily font.family: S.Theme.fontFamily
font.bold: _isActive font.bold: _isActive

View file

@ -239,27 +239,6 @@ WlSessionLockSurface {
} }
} }
// Clear password after idle - wiggle then clear
Timer {
id: _clearTimer
interval: 30000
running: _keyInput.text.length > 0 && root.auth.state !== "busy"
onTriggered: {
if (!S.Theme.reducedMotion)
_shakeAnim.restart();
_keyInput.text = "";
}
}
// Restart clear timer on each keystroke
Connections {
target: _keyInput
function onTextChanged() {
if (_keyInput.text.length > 0)
_clearTimer.restart();
}
}
// Unlock animation // Unlock animation
property bool _unlocking: false property bool _unlocking: false

View file

@ -39,15 +39,6 @@ QtObject {
property bool _reducedMotionConfig: false property bool _reducedMotionConfig: false
readonly property bool reducedMotion: _reducedMotionConfig || PowerProfileService.powerSaver readonly property bool reducedMotion: _reducedMotionConfig || PowerProfileService.powerSaver
// Green -> yellow -> red gradient for 0-100% load/usage values
function loadColor(pct) {
const t = Math.max(0, Math.min(100, pct)) / 100;
const a = t < 0.5 ? root.base0B : root.base0A;
const b = t < 0.5 ? root.base0A : root.base08;
const u = t < 0.5 ? t * 2 : (t - 0.5) * 2;
return Qt.rgba(a.r + (b.r - a.r) * u, a.g + (b.g - a.g) * u, a.b + (b.b - a.b) * u, 1);
}
property FileView _themeFile: FileView { property FileView _themeFile: FileView {
path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/theme.json" path: (Quickshell.env("XDG_CONFIG_HOME") || (Quickshell.env("HOME") + "/.config")) + "/nova-shell/theme.json"
watchChanges: true watchChanges: true