feat(tracker): show CPU load percentage in the song panel

This commit is contained in:
5684185+vsariola@users.noreply.github.com
2025-06-17 17:59:54 +03:00
parent 1a13fadd75
commit 340620ed49
5 changed files with 34 additions and 1 deletions

View File

@ -129,6 +129,14 @@ func (t *SongPanel) layoutSongOptions(gtx C, tr *Tracker) D {
layout.Rigid(func(gtx C) D {
return layoutSongOptionRow(gtx, tr.Theme, "Cursor step", NumUpDown(tr.Theme, t.Step, "Cursor step").Layout)
}),
layout.Rigid(func(gtx C) D {
cpuload := tr.Model.CPULoad()
label := Label(tr.Theme, &tr.Theme.SongPanel.RowValue, fmt.Sprintf("%.0f %%", cpuload*100))
if cpuload >= 1 {
label.Color = tr.Theme.SongPanel.ErrorColor
}
return layoutSongOptionRow(gtx, tr.Theme, "CPU load", label.Layout)
}),
)
})
}),