diff --git a/Modules/Bar/Widgets/SystemMonitor.qml b/Modules/Bar/Widgets/SystemMonitor.qml index d35fc1c..87fa235 100644 --- a/Modules/Bar/Widgets/SystemMonitor.qml +++ b/Modules/Bar/Widgets/SystemMonitor.qml @@ -37,16 +37,14 @@ Item { readonly property bool showNetworkStats: (widgetSettings.showNetworkStats !== undefined) ? widgetSettings.showNetworkStats : widgetMetadata.showNetworkStats readonly property bool showDiskUsage: (widgetSettings.showDiskUsage !== undefined) ? widgetSettings.showDiskUsage : widgetMetadata.showDiskUsage - implicitWidth: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : Math.round(horizontalLayout.implicitWidth + Style.marginS * 2 * scaling) - - implicitHeight: (barPosition === "left" || barPosition === "right") ? Math.round(verticalLayout.implicitHeight + Style.marginS * 2 * scaling) : Math.round(Style.barHeight * scaling) - + implicitWidth: backgroundContainer.width + implicitHeight: backgroundContainer.height Rectangle { id: backgroundContainer anchors.centerIn: parent - width: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : parent.width - height: (barPosition === "left" || barPosition === "right") ? parent.height : Math.round(Style.capsuleHeight * scaling) + width: (barPosition === "left" || barPosition === "right") ? Math.round(Style.capsuleHeight * scaling) : Math.round(horizontalLayout.implicitWidth + Style.marginS * 2 * scaling) + height: (barPosition === "left" || barPosition === "right") ? Math.round(verticalLayout.implicitHeight + Style.marginS * 2 * scaling) : Math.round(Style.capsuleHeight * scaling) radius: Math.round(Style.radiusM * scaling) color: Color.mSurfaceVariant @@ -251,7 +249,6 @@ Item { spacing: Style.marginS * scaling visible: barPosition === "left" || barPosition === "right" - // CPU Usage Component Item { Layout.preferredHeight: Math.round(Style.capsuleHeight * scaling) @@ -279,7 +276,6 @@ Item { font.pointSize: Style.fontSizeS * scaling anchors.horizontalCenter: parent.horizontalCenter } - } } @@ -295,7 +291,6 @@ Item { anchors.centerIn: parent spacing: Style.marginXXS * scaling - NText { text: `${SystemStatService.cpuTemp}°` font.family: Settings.data.ui.fontFixed @@ -306,13 +301,12 @@ Item { color: Color.mPrimary } - NIcon { + NIcon { icon: "cpu-temperature" // Fire is so tall, we need to make it smaller font.pointSize: Style.fontSizeXS * scaling anchors.horizontalCenter: parent.horizontalCenter } - } } @@ -356,7 +350,7 @@ Item { Column { id: networkDownloadRowVertical anchors.centerIn: parent - spacing: Style.marginXXS * scaling + spacing: Style.marginXXS * scaling NIcon { icon: "download-speed" @@ -386,7 +380,7 @@ Item { Column { id: networkUploadRowVertical anchors.centerIn: parent - spacing: Style.marginXXS * scaling + spacing: Style.marginXXS * scaling NIcon { icon: "upload-speed" @@ -416,7 +410,7 @@ Item { ColumnLayout { id: diskUsageRowVertical anchors.centerIn: parent - spacing: Style.marginXXS * scaling + spacing: Style.marginXXS * scaling NIcon { icon: "storage" diff --git a/Services/FontService.qml b/Services/FontService.qml index cd05860..d63de0d 100644 --- a/Services/FontService.qml +++ b/Services/FontService.qml @@ -3,6 +3,7 @@ pragma Singleton import QtQuick import QtQuick.Controls import Quickshell +import Quickshell.Io import qs.Commons Singleton { @@ -12,11 +13,17 @@ Singleton { property ListModel monospaceFonts: ListModel {} property ListModel displayFonts: ListModel {} property bool fontsLoaded: false + property var fontconfigMonospaceFonts: [] // ------------------------------------------- function init() { Logger.log("Font", "Service started") - loadSystemFonts() + loadFontconfigMonospaceFonts() + } + + function loadFontconfigMonospaceFonts() { + fontconfigProcess.command = ["fc-list", ":mono", "family"] + fontconfigProcess.running = true } function loadSystemFonts() { @@ -57,13 +64,11 @@ Singleton { sortModel(displayFonts) if (monospaceFonts.count === 0) { - Logger.log("Font", "No monospace fonts detected, adding fallbacks") - addFallbackFonts(monospaceFonts, ["DejaVu Sans Mono", "Liberation Mono", "Courier New", "Courier", "Monaco", "Consolas", "Lucida Console", "Monaco", "Andale Mono"]) + addFallbackFonts(monospaceFonts, ["DejaVu Sans Mono"]) } if (displayFonts.count === 0) { - Logger.log("Font", "No display fonts detected, adding fallbacks") - addFallbackFonts(displayFonts, ["Inter", "Roboto", "Open Sans", "Arial", "Helvetica", "Verdana", "Segoe UI", "SF Pro Display", "Ubuntu", "Noto Sans"]) + addFallbackFonts(displayFonts, ["Inter", "Roboto", "DejaVu Sans"]) } fontsLoaded = true @@ -71,29 +76,30 @@ Singleton { } function isMonospaceFont(fontName) { - var patterns = ["mono", "monospace", "fixed", "console", "terminal", "typewriter", "courier", "dejavu", "liberation", "source code", "fira code", "jetbrains", "cascadia", "hack", "inconsolata", "roboto mono", "ubuntu mono", "menlo", "consolas", "monaco", "andale mono"] - var lowerFontName = fontName.toLowerCase() - - for (var i = 0; i < patterns.length; i++) { - if (lowerFontName.includes(patterns[i])) - return true + // First, check if fontconfig detected this as monospace + if (fontconfigMonospaceFonts.indexOf(fontName) !== -1) { + return true } - var commonFonts = ["DejaVu Sans Mono", "Liberation Mono", "Source Code Pro", "Fira Code", "JetBrains Mono", "Cascadia Code", "Hack", "Inconsolata", "Roboto Mono", "Ubuntu Mono", "Menlo", "Consolas", "Monaco", "Andale Mono", "Courier New", "Courier", "Lucida Console", "Monaco", "MS Gothic", "MS Mincho"] - return commonFonts.includes(fontName) + // Minimal fallback: only check for basic monospace patterns + var lowerFontName = fontName.toLowerCase() + if (lowerFontName.includes("mono") || lowerFontName.includes("monospace")) { + return true + } + + return false } function isDisplayFont(fontName) { - var patterns = ["display", "headline", "title", "hero", "showcase", "brand", "inter", "roboto", "open sans", "lato", "montserrat", "poppins", "raleway", "nunito", "source sans", "ubuntu", "noto sans", "work sans", "dm sans", "manrope", "plus jakarta", "figtree"] + // Minimal fallback: only check for basic display patterns var lowerFontName = fontName.toLowerCase() - - for (var i = 0; i < patterns.length; i++) { - if (lowerFontName.includes(patterns[i])) - return true + if (lowerFontName.includes("display") || lowerFontName.includes("headline") || lowerFontName.includes("title")) { + return true } - var commonFonts = ["Inter", "Roboto", "Open Sans", "Lato", "Montserrat", "Poppins", "Raleway", "Nunito", "Source Sans Pro", "Ubuntu", "Noto Sans", "Work Sans", "DM Sans", "Manrope", "Plus Jakarta Sans", "Figtree", "SF Pro Display", "Segoe UI", "Arial", "Helvetica", "Verdana"] - return commonFonts.includes(fontName) + // Essential fallback fonts only + var essentialFonts = ["Inter", "Roboto", "DejaVu Sans"] + return essentialFonts.includes(fontName) } function sortModel(model) { @@ -153,4 +159,36 @@ Singleton { return results } + + // Process for fontconfig commands + Process { + id: fontconfigProcess + running: false + + stdout: StdioCollector { + onStreamFinished: { + if (this.text !== "") { + var lines = this.text.split('\n') + fontconfigMonospaceFonts = [] + + for (var i = 0; i < lines.length; i++) { + var line = lines[i].trim() + if (line && line !== "") { + if (fontconfigMonospaceFonts.indexOf(line) === -1) { + fontconfigMonospaceFonts.push(line) + } + } + } + } + loadSystemFonts() + } + } + + onExited: function (exitCode, exitStatus) { + if (exitCode !== 0) { + fontconfigMonospaceFonts = [] + } + loadSystemFonts() + } + } }