From bb4510bbcdee3a3760c525494fdf12c4d25f0119 Mon Sep 17 00:00:00 2001 From: Ly-sec Date: Wed, 20 Aug 2025 13:35:49 +0200 Subject: [PATCH] Add font settings, replace some Text with NText --- Commons/Settings.qml | 7 +++- Modules/AppLauncher/AppLauncher.qml | 2 +- Modules/LockScreen/LockScreen.qml | 46 +++++++++++------------ Modules/SettingsPanel/Tabs/GeneralTab.qml | 39 +++++++++++++++++++ Widgets/NCircleStat.qml | 3 +- Widgets/NText.qml | 2 +- 6 files changed, 72 insertions(+), 27 deletions(-) diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 6fb29dd..d7fec7d 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -223,7 +223,12 @@ Singleton { property JsonObject ui ui: JsonObject { - property string fontFamily: "Roboto" // Family for all text + property string fontDefault: "Roboto" // Default font for all text + property string fontFixed: "DejaVu Sans Mono" // Fixed width font for terminal + property string fontBillboard: "Inter" // Large bold font for clocks and prominent displays + + // Legacy compatibility + property string fontFamily: fontDefault // Keep for backward compatibility } // Scaling (not stored inside JsonObject, or it crashes) diff --git a/Modules/AppLauncher/AppLauncher.qml b/Modules/AppLauncher/AppLauncher.qml index 58f0c2c..502f95d 100644 --- a/Modules/AppLauncher/AppLauncher.qml +++ b/Modules/AppLauncher/AppLauncher.qml @@ -369,7 +369,7 @@ NLoader { visible: !parent.iconLoaded } - Text { + NText { anchors.centerIn: parent visible: !parent.iconLoaded && !(modelData.isCalculator || modelData.isClipboard || modelData.isCommand) diff --git a/Modules/LockScreen/LockScreen.qml b/Modules/LockScreen/LockScreen.qml index aa1facf..161a6e3 100644 --- a/Modules/LockScreen/LockScreen.qml +++ b/Modules/LockScreen/LockScreen.qml @@ -233,13 +233,13 @@ NLoader { // Time display - Large and prominent with pulse animation Column { - spacing: Style.marginS * scaling + spacing: Style.marginXS * scaling Layout.alignment: Qt.AlignHCenter - Text { + NText { id: timeText text: Qt.formatDateTime(new Date(), "HH:mm") - font.family: "Inter" + font.family: Settings.data.ui.fontBillboard font.pointSize: Style.fontSizeXXXL * 6 * scaling font.weight: Font.Bold font.letterSpacing: -2 * scaling @@ -261,10 +261,10 @@ NLoader { } } - Text { + NText { id: dateText text: Qt.formatDateTime(new Date(), "dddd, MMMM d") - font.family: "Inter" + font.family: Settings.data.ui.fontBillboard font.pointSize: Style.fontSizeXXL * scaling font.weight: Font.Light color: Color.mOnSurface @@ -404,10 +404,10 @@ NLoader { anchors.margins: Style.marginM * scaling spacing: Style.marginM * scaling - Text { + NText { text: "SECURE TERMINAL" color: Color.mOnSurface - font.family: "DejaVu Sans Mono" + font.family: Settings.data.ui.fontFixed font.pointSize: Style.fontSizeL * scaling font.weight: Font.Bold Layout.fillWidth: true @@ -424,10 +424,10 @@ NLoader { color: batteryIndicator.charging ? Color.mPrimary : Color.mOnSurface } - Text { + NText { text: Math.round(batteryIndicator.percent) + "%" color: Color.mOnSurface - font.family: "DejaVu Sans Mono" + font.family: Settings.data.ui.fontFixed font.pointSize: Style.fontSizeM * scaling font.weight: Font.Bold } @@ -450,19 +450,19 @@ NLoader { Layout.fillWidth: true spacing: Style.marginM * scaling - Text { + NText { text: "root@noctalia:~$" color: Color.mPrimary - font.family: "DejaVu Sans Mono" + font.family: Settings.data.ui.fontFixed font.pointSize: Style.fontSizeL * scaling font.weight: Font.Bold } - Text { + NText { id: welcomeText text: "" color: Color.mOnSurface - font.family: "DejaVu Sans Mono" + font.family: Settings.data.ui.fontFixed font.pointSize: Style.fontSizeL * scaling property int currentIndex: 0 property string fullText: "Welcome back, " + Quickshell.env("USER") + "!" @@ -488,18 +488,18 @@ NLoader { Layout.fillWidth: true spacing: Style.marginM * scaling - Text { + NText { text: "root@noctalia:~$" color: Color.mPrimary - font.family: "DejaVu Sans Mono" + font.family: Settings.data.ui.fontFixed font.pointSize: Style.fontSizeL * scaling font.weight: Font.Bold } - Text { + NText { text: "sudo unlock-session" color: Color.mOnSurface - font.family: "DejaVu Sans Mono" + font.family: Settings.data.ui.fontFixed font.pointSize: Style.fontSizeL * scaling } @@ -509,7 +509,7 @@ NLoader { width: 0 height: 0 visible: false - font.family: "DejaVu Sans Mono" + font.family: Settings.data.ui.fontFixed font.pointSize: Style.fontSizeL * scaling color: Color.mOnSurface echoMode: TextInput.Password @@ -535,11 +535,11 @@ NLoader { } // Visual password display with integrated cursor - Text { + NText { id: asterisksText text: "*".repeat(passwordInput.text.length) color: Color.mOnSurface - font.family: "DejaVu Sans Mono" + font.family: Settings.data.ui.fontFixed font.pointSize: Style.fontSizeL * scaling visible: passwordInput.activeFocus @@ -585,7 +585,7 @@ NLoader { } // Status messages - Text { + NText { text: lock.authenticating ? "Authenticating..." : (lock.errorMessage !== "" ? "Authentication failed." : "") color: lock.authenticating ? Color.mPrimary : (lock.errorMessage !== "" ? Color.mError : Color.transparent) font.family: "DejaVu Sans Mono" @@ -618,11 +618,11 @@ NLoader { Layout.alignment: Qt.AlignRight Layout.bottomMargin: -12 * scaling - Text { + NText { anchors.centerIn: parent text: lock.authenticating ? "EXECUTING" : "EXECUTE" color: executeButtonArea.containsMouse ? Color.mOnPrimary : Color.mPrimary - font.family: "DejaVu Sans Mono" + font.family: Settings.data.ui.fontFixed font.pointSize: Style.fontSizeM * scaling font.weight: Font.Bold } diff --git a/Modules/SettingsPanel/Tabs/GeneralTab.qml b/Modules/SettingsPanel/Tabs/GeneralTab.qml index ae5f76f..40af08b 100644 --- a/Modules/SettingsPanel/Tabs/GeneralTab.qml +++ b/Modules/SettingsPanel/Tabs/GeneralTab.qml @@ -92,6 +92,45 @@ ColumnLayout { Layout.bottomMargin: Style.marginS * scaling } + // Font configuration section + ColumnLayout { + spacing: Style.marginS * scaling + Layout.fillWidth: true + + NTextInput { + label: "Default Font" + description: "Main font used throughout the interface." + text: Settings.data.ui.fontDefault + placeholderText: "Roboto" + Layout.fillWidth: true + onEditingFinished: { + Settings.data.ui.fontDefault = text + } + } + + NTextInput { + label: "Fixed Width Font" + description: "Monospace font used for terminal and code display." + text: Settings.data.ui.fontFixed + placeholderText: "DejaVu Sans Mono" + Layout.fillWidth: true + onEditingFinished: { + Settings.data.ui.fontFixed = text + } + } + + NTextInput { + label: "Billboard Font" + description: "Large font used for clocks and prominent displays." + text: Settings.data.ui.fontBillboard + placeholderText: "Inter" + Layout.fillWidth: true + onEditingFinished: { + Settings.data.ui.fontBillboard = text + } + } + } + NToggle { label: "Show Corners" description: "Display rounded corners on the edge of the screen." diff --git a/Widgets/NCircleStat.qml b/Widgets/NCircleStat.qml index e7d7d1a..1bd9e67 100644 --- a/Widgets/NCircleStat.qml +++ b/Widgets/NCircleStat.qml @@ -1,6 +1,7 @@ import QtQuick import qs.Commons import qs.Services +import qs.Widgets // Compact circular statistic display used in the SidePanel Rectangle { @@ -73,7 +74,7 @@ Rectangle { } // Percent centered in the circle - Text { + NText { id: valueLabel anchors.centerIn: parent text: `${root.value}${root.suffix}` diff --git a/Widgets/NText.qml b/Widgets/NText.qml index 59d7d63..7436c54 100644 --- a/Widgets/NText.qml +++ b/Widgets/NText.qml @@ -6,7 +6,7 @@ import qs.Widgets Text { id: root - font.family: Settings.data.ui.fontFamily + font.family: Settings.data.ui.fontDefault font.pointSize: Style.fontSizeM * scaling font.weight: Style.fontWeightMedium color: Color.mOnSurface