From 9d4ac03d21dd40ff3bbe9b704551fcbf91fae667 Mon Sep 17 00:00:00 2001 From: ItsLemmy Date: Sat, 29 Nov 2025 10:38:06 -0500 Subject: [PATCH] Removed fonts dependencies (now using Qt font as default) and removed some complex settings migration code. --- Assets/settings-default.json | 4 +- CREDITS.md | 2 - Commons/Settings.qml | 320 +------------------------------- Services/System/FontService.qml | 15 -- 4 files changed, 6 insertions(+), 335 deletions(-) diff --git a/Assets/settings-default.json b/Assets/settings-default.json index fd76e684..e999a313 100644 --- a/Assets/settings-default.json +++ b/Assets/settings-default.json @@ -78,8 +78,8 @@ "allowPanelsOnScreenWithoutBar": true }, "ui": { - "fontDefault": "Roboto", - "fontFixed": "DejaVu Sans Mono", + "fontDefault": "", + "fontFixed": "", "fontDefaultScale": 1, "fontFixedScale": 1, "tooltipsEnabled": true, diff --git a/CREDITS.md b/CREDITS.md index a71a8368..0e8c4267 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -26,8 +26,6 @@ Noctalia Shell is made possible by the incredible work of many open-source proje ### Theming & Appearance - **[Matugen](https://github.com/InioX/matugen)** - Material You color scheme generation from wallpapers -- **[Inter Font](https://rsms.me/inter/)** - UI font family -- **[Roboto](https://fonts.google.com/specimen/Roboto)** - Additional UI font family ### Utilities - **[cliphist](https://github.com/sentriz/cliphist)** - Clipboard history support diff --git a/Commons/Settings.qml b/Commons/Settings.qml index 63f0af16..62b12a86 100644 --- a/Commons/Settings.qml +++ b/Commons/Settings.qml @@ -67,6 +67,8 @@ Singleton { adapter.general.avatarImage = defaultAvatar; adapter.screenRecorder.directory = defaultVideosDirectory; adapter.wallpaper.directory = defaultWallpapersDirectory; + adapter.ui.fontDefault = Qt.application.font.family; + adapter.ui.fontFixed = "monospace"; // Set the adapter to the settingsFileView to trigger the real settings load settingsFileView.adapter = adapter; @@ -234,8 +236,8 @@ Singleton { // ui property JsonObject ui: JsonObject { - property string fontDefault: "Roboto" - property string fontFixed: "DejaVu Sans Mono" + property string fontDefault: "" + property string fontFixed: "" property real fontDefaultScale: 1.0 property real fontFixedScale: 1.0 property bool tooltipsEnabled: true @@ -757,116 +759,6 @@ Singleton { Logger.w("Settings", "Added a ControlCenter widget to the right section"); } } - - // ----------------- - // TEMP Normalize OSD enabled types and migrate legacy show* toggles - try { - var osdRawJson = settingsFileView.text(); - if (osdRawJson) { - var osdParsed = JSON.parse(osdRawJson); - if (osdParsed.osd) { - var legacyHandled = false; - - if (osdParsed.osd.enabledTypes === undefined) { - // Some configurations (<= v23) stored booleans like showVolume/showBrightness/etc. - // Convert them into the new enabledTypes array as soon as we detect the legacy shape. - var legacyOsd = osdParsed.osd; - var typeMappings = [ - { - key: "showVolume", - type: 0 - }, - { - key: "showInputVolume", - type: 1 - }, - { - key: "showBrightness", - type: 2 - }, - { - key: "showLockKey", - type: 3 - } - ]; - - var migratedTypes = []; - var sawLegacyKey = false; - - for (var i = 0; i < typeMappings.length; i++) { - var mapping = typeMappings[i]; - if (legacyOsd[mapping.key] !== undefined) - sawLegacyKey = true; - - var enabled = legacyOsd[mapping.key]; - if (enabled === undefined) - enabled = true; // default behaviour before enabledTypes existed - - if (enabled && migratedTypes.indexOf(mapping.type) === -1) - migratedTypes.push(mapping.type); - } - - if (legacyOsd.showLockKeyNotifications !== undefined) { - sawLegacyKey = true; - if (legacyOsd.showLockKeyNotifications) { - if (migratedTypes.indexOf(3) === -1) - migratedTypes.push(3); - } else { - migratedTypes = migratedTypes.filter(function (type) { - return type !== 3; - }); - } - } - - if (sawLegacyKey) { - if (migratedTypes.length === 0) { - migratedTypes = [0, 1, 2, 3]; - } - adapter.osd.enabledTypes = migratedTypes; - Logger.i("Settings", "Migrated legacy OSD toggles to enabledTypes = " + JSON.stringify(migratedTypes)); - legacyHandled = true; - } - } - - // No matter which format the JSON used, hydrate the runtime value from disk so we don't - // accidentally keep the default [0,1,2,3] array after a restart. - if (!legacyHandled && osdParsed.osd.enabledTypes !== undefined) { - var parsedTypes = osdParsed.osd.enabledTypes; - if (Array.isArray(parsedTypes)) { - adapter.osd.enabledTypes = parsedTypes.slice(); - } else if (parsedTypes && typeof parsedTypes === "object" && parsedTypes.length !== undefined) { - // QJsonArray can materialise as a list-like object; convert it to a plain array - var normalized = []; - for (var idx = 0; idx < parsedTypes.length; idx++) { - var value = parsedTypes[idx]; - if (value !== undefined) - normalized.push(value); - } - adapter.osd.enabledTypes = normalized; - } - } - } - } - } catch (error) { - Logger.w("Settings", "Failed to normalize OSD enabledTypes:", error); - } - - // ----------------- - // Migrate ShellState-related files from old cache files to ShellState - // This consolidates migrations that were previously in individual files - if (adapter.settingsVersion < 25) { - // Only migrate the settings once! - if (ShellState?.isLoaded) { - migrateShellStateFiles(); - } else { - // Wait for ShellState to be ready - Qt.callLater(() => { - if (ShellState?.isLoaded) { - migrateShellStateFiles(); - } - }); - } - } } // ----------------------------------------------------- @@ -893,208 +785,4 @@ Singleton { return null; } } - - // ----------------------------------------------------- - // --- TO BE REMOVED - // ----------------------------------------------------- - // Migrate old cache files to ShellState - function migrateShellStateFiles() { - // Migrate display.json → ShellState (CompositorService) - migrateDisplayFile(); - - // Migrate notifications-state.json → ShellState (NotificationService) - migrateNotificationsStateFile(); - - // Migrate changelog-state.json → ShellState (UpdateService) - migrateChangelogStateFile(); - - // Migrate color-schemes-list.json → ShellState (SchemeDownloader) - migrateColorSchemesListFile(); - - // Migrate wallpaper paths from Settings → ShellState (WallpaperService) - migrateWallpaperPaths(); - } - - // ----------------------------------------------------- - function migrateDisplayFile() { - // Check if ShellState already has display data - const cached = ShellState.getDisplay(); - if (cached && Object.keys(cached).length > 0) { - return; // Already migrated - } - - const oldDisplayPath = cacheDir + "display.json"; - const migrationFileView = Qt.createQmlObject(` - import QtQuick - import Quickshell.Io - import qs.Commons - FileView { - id: migrationView - path: "${oldDisplayPath}" - printErrors: false - adapter: JsonAdapter { - property var displays: ({}) - } - onLoaded: { - if (adapter.displays && Object.keys(adapter.displays).length > 0) { - ShellState.setDisplay(adapter.displays); - Logger.i("Settings", "Migrated display.json to ShellState"); - } - migrationView.destroy(); - } - onLoadFailed: { - migrationView.destroy(); - } - } - `, root, "displayMigrationView"); - } - - // ----------------------------------------------------- - function migrateNotificationsStateFile() { - // Check if ShellState already has notifications state - const cached = ShellState.getNotificationsState(); - if (cached && cached.lastSeenTs && cached.lastSeenTs > 0) { - return; // Already migrated - } - - // Also check Settings for lastSeenTs - if (adapter.notifications && adapter.notifications.lastSeenTs) { - ShellState.setNotificationsState({ - lastSeenTs: adapter.notifications.lastSeenTs - }); - Logger.i("Settings", "Migrated notifications lastSeenTs from Settings to ShellState"); - return; - } - - const oldStatePath = cacheDir + "notifications-state.json"; - const migrationFileView = Qt.createQmlObject(` - import QtQuick - import Quickshell.Io - import qs.Commons - FileView { - id: migrationView - path: "${oldStatePath}" - printErrors: false - adapter: JsonAdapter { - property real lastSeenTs: 0 - } - onLoaded: { - if (adapter.lastSeenTs && adapter.lastSeenTs > 0) { - ShellState.setNotificationsState({ - lastSeenTs: adapter.lastSeenTs - }); - Logger.i("Settings", "Migrated notifications-state.json to ShellState"); - } - migrationView.destroy(); - } - onLoadFailed: { - migrationView.destroy(); - } - } - `, root, "notificationsMigrationView"); - } - - function migrateChangelogStateFile() { - // Check if ShellState already has changelog state - const cached = ShellState.getChangelogState(); - if (cached && cached.lastSeenVersion && cached.lastSeenVersion !== "") { - return; // Already migrated - } - - // Also check Settings for lastSeenVersion - if (adapter.changelog && adapter.changelog.lastSeenVersion) { - ShellState.setChangelogState({ - lastSeenVersion: adapter.changelog.lastSeenVersion - }); - Logger.i("Settings", "Migrated changelog lastSeenVersion from Settings to ShellState"); - return; - } - - const oldChangelogPath = cacheDir + "changelog-state.json"; - const migrationFileView = Qt.createQmlObject(` - import QtQuick - import Quickshell.Io - import qs.Commons - FileView { - id: migrationView - path: "${oldChangelogPath}" - printErrors: false - adapter: JsonAdapter { - property string lastSeenVersion: "" - } - onLoaded: { - if (adapter.lastSeenVersion && adapter.lastSeenVersion !== "") { - ShellState.setChangelogState({ - lastSeenVersion: adapter.lastSeenVersion - }); - Logger.i("Settings", "Migrated changelog-state.json to ShellState"); - } - migrationView.destroy(); - } - onLoadFailed: { - migrationView.destroy(); - } - } - `, root, "changelogMigrationView"); - } - - function migrateColorSchemesListFile() { - // Check if ShellState already has color schemes list - const cached = ShellState.getColorSchemesList(); - if (cached && cached.schemes && cached.schemes.length > 0) { - return; // Already migrated - } - - const oldSchemesPath = cacheDir + "color-schemes-list.json"; - const migrationFileView = Qt.createQmlObject(` - import QtQuick - import Quickshell.Io - import qs.Commons - FileView { - id: migrationView - path: "${oldSchemesPath}" - printErrors: false - adapter: JsonAdapter { - property var schemes: [] - property real timestamp: 0 - } - onLoaded: { - if (adapter.schemes && adapter.schemes.length > 0) { - ShellState.setColorSchemesList({ - schemes: adapter.schemes, - timestamp: adapter.timestamp || 0 - }); - Logger.i("Settings", "Migrated color-schemes-list.json to ShellState"); - } - migrationView.destroy(); - } - onLoadFailed: { - migrationView.destroy(); - } - } - `, root, "schemesMigrationView"); - } - - function migrateWallpaperPaths() { - // Check if ShellState already has wallpaper paths - const cached = ShellState.getWallpapers(); - if (cached && Object.keys(cached).length > 0) { - return; // Already migrated - } - - // Migrate from Settings wallpaper.monitors - var monitors = adapter.wallpaper.monitors || []; - if (monitors.length > 0) { - var wallpapers = {}; - for (var i = 0; i < monitors.length; i++) { - if (monitors[i].name && monitors[i].wallpaper) { - wallpapers[monitors[i].name] = monitors[i].wallpaper; - } - } - if (Object.keys(wallpapers).length > 0) { - ShellState.setWallpapers(wallpapers); - Logger.i("Settings", "Migrated wallpaper paths from Settings to ShellState"); - } - } - } } diff --git a/Services/System/FontService.qml b/Services/System/FontService.qml index f9be21b9..9ccbe370 100644 --- a/Services/System/FontService.qml +++ b/Services/System/FontService.qml @@ -113,15 +113,6 @@ Singleton { } function finalizeFontLoading() { - // Add fallbacks if needed (models are already sorted) - if (monospaceFonts.count === 0) { - addFallbackFonts(monospaceFonts, ["DejaVu Sans Mono"]); - } - - if (displayFonts.count === 0) { - addFallbackFonts(displayFonts, ["Inter", "Roboto", "DejaVu Sans"]); - } - fontsLoaded = true; isLoading = false; Logger.d("Font", "Loaded", availableFonts.count, "fonts:", monospaceFonts.count, "monospace,", displayFonts.count, "display"); @@ -168,12 +159,6 @@ Singleton { result = true; } - // Essential fallback fonts only - var essentialFonts = ["Inter", "Roboto", "DejaVu Sans"]; - if (essentialFonts.indexOf(fontName) !== -1) { - result = true; - } - // Cache the result if (!fontCache[fontName]) { fontCache[fontName] = {};