1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-07 05:55:37 -05:00

Show default font to reflect users choice

This commit is contained in:
purian23
2025-08-01 23:02:13 -04:00
parent 2f97c39647
commit 12c62720b3
2 changed files with 10 additions and 8 deletions

View File

@@ -108,16 +108,18 @@ ScrollView {
text: "Font Family" text: "Font Family"
description: "Select system font family" description: "Select system font family"
currentValue: { currentValue: {
if (Prefs.fontFamily === Prefs.defaultFontFamily) // Always show the font name in parentheses for clarity
return "Default"; if (Prefs.fontFamily === Prefs.defaultFontFamily) {
return "Default (" + Prefs.defaultFontFamily + ")";
return Prefs.fontFamily || "Default"; } else {
return Prefs.fontFamily || "Default (" + Prefs.defaultFontFamily + ")";
}
} }
enableFuzzySearch: true enableFuzzySearch: true
popupWidthOffset: 100 popupWidthOffset: 100
maxPopupHeight: 400 maxPopupHeight: 400
options: { options: {
var fonts = ["Default"]; var fonts = ["Default (" + Prefs.defaultFontFamily + ")"];
var availableFonts = Qt.fontFamilies(); var availableFonts = Qt.fontFamilies();
var rootFamilies = []; var rootFamilies = [];
var seenFamilies = new Set(); var seenFamilies = new Set();
@@ -144,7 +146,7 @@ ScrollView {
return fonts.concat(rootFamilies.sort()); return fonts.concat(rootFamilies.sort());
} }
onValueChanged: (value) => { onValueChanged: (value) => {
if (value === "Default") if (value.startsWith("Default ("))
Prefs.setFontFamily(Prefs.defaultFontFamily); Prefs.setFontFamily(Prefs.defaultFontFamily);
else else
Prefs.setFontFamily(value); Prefs.setFontFamily(value);

View File

@@ -214,7 +214,7 @@ Rectangle {
parent: Overlay.overlay parent: Overlay.overlay
width: dropdown.width + root.popupWidthOffset width: dropdown.width + root.popupWidthOffset
height: Math.min(root.maxPopupHeight, (root.enableFuzzySearch ? 48 : 0) + Math.min(filteredOptions.length, 10) * 36 + 16) height: Math.min(root.maxPopupHeight, (root.enableFuzzySearch ? 54 : 0) + Math.min(filteredOptions.length, 10) * 36 + 16)
padding: 0 padding: 0
modal: true modal: true
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
@@ -245,7 +245,7 @@ Rectangle {
id: searchContainer id: searchContainer
width: parent.width width: parent.width
height: 36 height: 42
visible: root.enableFuzzySearch visible: root.enableFuzzySearch
radius: Theme.cornerRadiusSmall radius: Theme.cornerRadiusSmall
color: Theme.surfaceVariantAlpha color: Theme.surfaceVariantAlpha