1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

font re-work, change default to inter variable + fira code

This commit is contained in:
bbedward
2025-07-28 11:24:24 -04:00
parent f16e7a506e
commit 03b8370c14
9 changed files with 419 additions and 92 deletions

View File

@@ -211,18 +211,49 @@ Column {
ListView {
id: processListView
property real stableY: 0
property bool isUserScrolling: false
property bool isScrollBarDragging: false
width: parent.width
height: parent.height - columnHeaders.height
clip: true
spacing: 4
model: SysMonitorService.processes
boundsBehavior: Flickable.StopAtBounds
flickDeceleration: 1500
maximumFlickVelocity: 2000
onMovementStarted: isUserScrolling = true
onMovementEnded: {
isUserScrolling = false
if (contentY > 40) {
stableY = contentY
}
}
onContentYChanged: {
if (!isUserScrolling && !isScrollBarDragging && visible && stableY > 40 && Math.abs(contentY - stableY) > 10) {
contentY = stableY
}
}
delegate: ProcessListItem {
process: modelData
contextMenu: root.contextMenu
}
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
ScrollBar.vertical: ScrollBar {
id: verticalScrollBar
policy: ScrollBar.AsNeeded
onPressedChanged: {
processListView.isScrollBarDragging = pressed
if (!pressed && processListView.contentY > 40) {
processListView.stableY = processListView.contentY
}
}
}
ScrollBar.horizontal: ScrollBar { policy: ScrollBar.AlwaysOff }
property real wheelMultiplier: 1.8
@@ -274,8 +305,11 @@ Column {
}
onModelChanged: {
if (model && model.length > 0) {
restoreAnchor();
if (model && model.length > 0 && !isUserScrolling && stableY > 40) {
// Preserve scroll position when model updates
Qt.callLater(function() {
contentY = stableY
})
}
}
}

View File

@@ -54,8 +54,10 @@ ScrollView {
StyledText {
text: SysMonitorService.hostname
font.pixelSize: Theme.fontSizeXLarge
font.family: Prefs.monoFontFamily
font.weight: Font.Light
color: Theme.surfaceText
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -63,6 +65,7 @@ ScrollView {
font.pixelSize: Theme.fontSizeMedium
font.family: Prefs.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -70,6 +73,7 @@ ScrollView {
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -77,6 +81,7 @@ ScrollView {
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.6)
verticalAlignment: Text.AlignVCenter
}
}
@@ -93,56 +98,141 @@ ScrollView {
width: parent.width
spacing: Theme.spacingXL
Column {
Rectangle {
width: (parent.width - Theme.spacingXL) / 2
spacing: Theme.spacingS
height: Math.max(hardwareColumn.implicitHeight, memoryColumn.implicitHeight) + Theme.spacingM
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainerHigh.r, Theme.surfaceContainerHigh.g, Theme.surfaceContainerHigh.b, 0.4)
border.width: 1
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1)
StyledText {
text: SysMonitorService.cpuModel
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
font.weight: Font.Medium
color: Theme.surfaceText
width: parent.width
elide: Text.ElideRight
Column {
id: hardwareColumn
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: Theme.spacingM
spacing: Theme.spacingXS
Row {
width: parent.width
spacing: Theme.spacingS
DankIcon {
name: "memory"
size: Theme.iconSizeSmall
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: "Hardware"
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
font.weight: Font.Bold
color: Theme.primary
anchors.verticalCenter: parent.verticalCenter
}
}
StyledText {
text: SysMonitorService.cpuModel
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
font.weight: Font.Medium
color: Theme.surfaceText
width: parent.width
elide: Text.ElideRight
wrapMode: Text.Wrap
maximumLineCount: 2
verticalAlignment: Text.AlignVCenter
}
StyledText {
text: SysMonitorService.motherboard
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.8)
width: parent.width
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
StyledText {
text: "BIOS " + SysMonitorService.biosVersion
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
width: parent.width
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
}
StyledText {
text: SysMonitorService.motherboard
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
font.weight: Font.Medium
color: Theme.surfaceText
width: parent.width
elide: Text.ElideRight
}
}
Column {
Rectangle {
width: (parent.width - Theme.spacingXL) / 2
spacing: Theme.spacingS
height: Math.max(hardwareColumn.implicitHeight, memoryColumn.implicitHeight) + Theme.spacingM
radius: Theme.cornerRadius
color: Qt.rgba(Theme.surfaceContainerHigh.r, Theme.surfaceContainerHigh.g, Theme.surfaceContainerHigh.b, 0.4)
border.width: 1
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.1)
StyledText {
text: SysMonitorService.formatMemory(SysMonitorService.totalMemoryMB) + " Memory"
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
font.weight: Font.Medium
color: Theme.surfaceText
width: parent.width
elide: Text.ElideRight
Column {
id: memoryColumn
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.margins: Theme.spacingM
spacing: Theme.spacingXS
Row {
width: parent.width
spacing: Theme.spacingS
DankIcon {
name: "developer_board"
size: Theme.iconSizeSmall
color: Theme.secondary
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: "Memory"
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
font.weight: Font.Bold
color: Theme.secondary
anchors.verticalCenter: parent.verticalCenter
}
}
StyledText {
text: SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB) + " Total"
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
font.weight: Font.Medium
color: Theme.surfaceText
width: parent.width
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
StyledText {
text: SysMonitorService.formatSystemMemory(SysMonitorService.usedMemoryKB) + " Used • " + SysMonitorService.formatSystemMemory(SysMonitorService.totalMemoryKB - SysMonitorService.usedMemoryKB) + " Available"
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
color: Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.7)
width: parent.width
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
Item {
width: parent.width
height: Theme.fontSizeSmall + Theme.spacingXS
}
}
StyledText {
text: "BIOS " + SysMonitorService.biosVersion
font.pixelSize: Theme.fontSizeSmall
font.family: Prefs.monoFontFamily
font.weight: Font.Medium
color: Theme.surfaceText
width: parent.width
elide: Text.ElideRight
}
}
}
@@ -181,6 +271,7 @@ ScrollView {
StyledText {
text: "Storage & Disks"
font.pixelSize: Theme.fontSizeLarge
font.family: Prefs.monoFontFamily
font.weight: Font.Bold
color: Theme.surfaceText
anchors.verticalCenter: parent.verticalCenter
@@ -206,6 +297,7 @@ ScrollView {
color: Theme.surfaceText
width: parent.width * 0.25
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -216,6 +308,7 @@ ScrollView {
color: Theme.surfaceText
width: parent.width * 0.2
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -226,6 +319,7 @@ ScrollView {
color: Theme.surfaceText
width: parent.width * 0.15
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -236,6 +330,7 @@ ScrollView {
color: Theme.surfaceText
width: parent.width * 0.15
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -246,6 +341,7 @@ ScrollView {
color: Theme.surfaceText
width: parent.width * 0.15
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -256,6 +352,7 @@ ScrollView {
color: Theme.surfaceText
width: parent.width * 0.1
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
}
@@ -290,6 +387,7 @@ ScrollView {
width: parent.width * 0.25
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -300,6 +398,7 @@ ScrollView {
width: parent.width * 0.2
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -310,6 +409,7 @@ ScrollView {
width: parent.width * 0.15
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -320,6 +420,7 @@ ScrollView {
width: parent.width * 0.15
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -330,6 +431,7 @@ ScrollView {
width: parent.width * 0.15
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
}
StyledText {
@@ -349,6 +451,7 @@ ScrollView {
width: parent.width * 0.1
elide: Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
}
}

View File

@@ -100,10 +100,22 @@ ScrollView {
width: parent.width
text: "Font Family"
description: "Select system font family"
currentValue: Prefs.fontFamily || "System Default"
currentValue: {
if (Prefs.fontFamily === Prefs.defaultFontFamily) {
return "Default";
}
return Prefs.fontFamily || "System Default";
}
enableFuzzySearch: true
popupWidthOffset: 100
maxPopupHeight: 400
options: {
var fonts = ["System Default"];
var availableFonts = Qt.fontFamilies();
// Add default font at the top
fonts.push("Default");
var rootFamilies = [];
var seenFamilies = new Set();
@@ -116,6 +128,11 @@ ScrollView {
continue;
}
// Skip the default font since we already added it as recommended
if (fontName === Prefs.defaultFontFamily) {
continue;
}
var rootName = fontName
.replace(/ (Thin|Extra Light|Light|Regular|Medium|Semi Bold|Demi Bold|Bold|Extra Bold|Black|Heavy)$/i, "")
.replace(/ (Italic|Oblique|Condensed|Extended|Narrow|Wide)$/i, "")
@@ -134,7 +151,13 @@ ScrollView {
return fonts.concat(rootFamilies.sort());
}
onValueChanged: (value) => {
Prefs.setFontFamily(value === "System Default" ? "Noto Sans" : value);
if (value === "System Default") {
Prefs.setFontFamily(Prefs.defaultFontFamily);
} else if (value === "Default") {
Prefs.setFontFamily(Prefs.defaultFontFamily);
} else {
Prefs.setFontFamily(value);
}
}
}
@@ -179,10 +202,22 @@ ScrollView {
width: parent.width
text: "Monospace Font"
description: "Select monospace font for process list and technical displays"
currentValue: Prefs.monoFontFamily || "System Default"
currentValue: {
if (Prefs.monoFontFamily === Prefs.defaultMonoFontFamily) {
return "Default";
}
return Prefs.monoFontFamily || "System Default";
}
enableFuzzySearch: true
popupWidthOffset: 100
maxPopupHeight: 400
options: {
var fonts = ["System Default"];
var availableFonts = Qt.fontFamilies();
// Add default mono font at the top
fonts.push("Default");
var monoFamilies = [];
var seenFamilies = new Set();
@@ -195,6 +230,11 @@ ScrollView {
continue;
}
// Skip the default mono font since we already added it as recommended
if (fontName === Prefs.defaultMonoFontFamily) {
continue;
}
// Look for common monospace indicators
var lowerName = fontName.toLowerCase();
if (lowerName.includes("mono") ||
@@ -225,7 +265,13 @@ ScrollView {
return fonts.concat(monoFamilies.sort());
}
onValueChanged: (value) => {
Prefs.setMonoFontFamily(value === "System Default" ? "JetBrains Mono" : value);
if (value === "System Default") {
Prefs.setMonoFontFamily(Prefs.defaultMonoFontFamily);
} else if (value === "Default") {
Prefs.setMonoFontFamily(Prefs.defaultMonoFontFamily);
} else {
Prefs.setMonoFontFamily(value);
}
}
}
}

View File

@@ -38,7 +38,7 @@ Rectangle {
StyledText {
text: "•"
font.pixelSize: Theme.fontSizeMedium
font.pixelSize: Theme.fontSizeSmall
color: Theme.outlineButton
anchors.verticalCenter: parent.verticalCenter
visible: !compactMode

View File

@@ -115,11 +115,6 @@ Rectangle {
title = activePlayer.trackTitle || "Unknown Track";
subtitle = activePlayer.trackArtist || "";
}
if (title.length > 20)
title = title.substring(0, 20) + "...";
if (subtitle.length > 22)
subtitle = subtitle.substring(0, 22) + "...";
return subtitle.length > 0 ? title + " • " + subtitle : title;
}
@@ -127,6 +122,8 @@ Rectangle {
color: Theme.surfaceText
font.weight: Font.Medium
elide: Text.ElideRight
wrapMode: Text.NoWrap
maximumLineCount: 1
MouseArea {
anchors.fill: parent