feat: added bootable disks to the Dashboard

This commit is contained in:
Serhiy Mytrovtsiy
2025-08-15 16:42:12 +02:00
parent c44bc7e750
commit 7d49169122
43 changed files with 184 additions and 6 deletions

View File

@@ -141,6 +141,23 @@ class Dashboard: NSStackView {
}
return value
}
private var disksValue: String {
guard let disks = SystemKit.shared.device.info.disk else {
return localizedString("Unknown")
}
var value = ""
for i in 0..<disks.count {
var row = disks[i].name != nil ? disks[i].name! : localizedString("Unknown")
if let size = disks[i].size {
let value = ByteCountFormatter.string(fromByteCount: size, countStyle: .file)
row += " (\(value))"
}
value += "\(row)\(i == disks.count-1 ? "" : "\n")"
}
return value
}
private var uptimeValue: String {
let form = DateComponentsFormatter()
form.maximumUnitCount = 2
@@ -176,7 +193,8 @@ class Dashboard: NSStackView {
scrollView.stackView.addArrangedSubview(PreferencesSection([
PreferencesRow(localizedString("Processor"), "", component: textView(self.processorValue)),
PreferencesRow(localizedString("Memory"), component: textView(self.memoryValue)),
PreferencesRow(localizedString("Graphics"), component: textView(self.graphicsValue))
PreferencesRow(localizedString("Graphics"), component: textView(self.graphicsValue)),
PreferencesRow(localizedString("Disks"), component: textView(self.disksValue))
]))
scrollView.stackView.addArrangedSubview(PreferencesSection([