From 96429160c30ba5f6dcd25c8e6a181221195c41d8 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 15 Jun 2025 18:08:45 +1000 Subject: feat: user config file Config file at `~/.config/caelestia/shell.json` --- modules/launcher/ActionItem.qml | 2 +- modules/launcher/Actions.qml | 4 ++-- modules/launcher/AppItem.qml | 2 +- modules/launcher/AppList.qml | 8 ++++---- modules/launcher/Background.qml | 4 ++-- modules/launcher/Content.qml | 4 ++-- modules/launcher/ContentList.qml | 8 ++++---- modules/launcher/WallpaperItem.qml | 2 +- modules/launcher/WallpaperList.qml | 6 +++--- 9 files changed, 20 insertions(+), 20 deletions(-) (limited to 'modules/launcher') diff --git a/modules/launcher/ActionItem.qml b/modules/launcher/ActionItem.qml index a650768..db3242a 100644 --- a/modules/launcher/ActionItem.qml +++ b/modules/launcher/ActionItem.qml @@ -9,7 +9,7 @@ Item { required property Actions.Action modelData required property var list - implicitHeight: LauncherConfig.sizes.itemHeight + implicitHeight: Config.launcher.sizes.itemHeight anchors.left: parent?.left anchors.right: parent?.right diff --git a/modules/launcher/Actions.qml b/modules/launcher/Actions.qml index 0cbc870..beb77a5 100644 --- a/modules/launcher/Actions.qml +++ b/modules/launcher/Actions.qml @@ -96,7 +96,7 @@ Singleton { })) function fuzzyQuery(search: string): var { - return Fuzzy.go(search.slice(LauncherConfig.actionPrefix.length), preppedActions, { + return Fuzzy.go(search.slice(Config.launcher.actionPrefix.length), preppedActions, { all: true, keys: ["name", "desc"], scoreFn: r => r[0].score > 0 ? r[0].score * 0.9 + r[1].score * 0.1 : 0 @@ -104,7 +104,7 @@ Singleton { } function autocomplete(list: AppList, text: string): void { - list.search.text = `${LauncherConfig.actionPrefix}${text} `; + list.search.text = `${Config.launcher.actionPrefix}${text} `; } Process { diff --git a/modules/launcher/AppItem.qml b/modules/launcher/AppItem.qml index b6a0bf5..e3f6720 100644 --- a/modules/launcher/AppItem.qml +++ b/modules/launcher/AppItem.qml @@ -11,7 +11,7 @@ Item { required property DesktopEntry modelData required property PersistentProperties visibilities - implicitHeight: LauncherConfig.sizes.itemHeight + implicitHeight: Config.launcher.sizes.itemHeight anchors.left: parent?.left anchors.right: parent?.right diff --git a/modules/launcher/AppList.qml b/modules/launcher/AppList.qml index a431395..b2b9f57 100644 --- a/modules/launcher/AppList.qml +++ b/modules/launcher/AppList.qml @@ -14,14 +14,14 @@ ListView { required property TextField search required property PersistentProperties visibilities - property bool isAction: search.text.startsWith(LauncherConfig.actionPrefix) + property bool isAction: search.text.startsWith(Config.launcher.actionPrefix) function getModelValues() { let text = search.text; if (isAction) return Actions.fuzzyQuery(text); - if (text.startsWith(LauncherConfig.actionPrefix)) - text = search.text.slice(LauncherConfig.actionPrefix.length); + if (text.startsWith(Config.launcher.actionPrefix)) + text = search.text.slice(Config.launcher.actionPrefix.length); return Apps.fuzzyQuery(text); } @@ -32,7 +32,7 @@ ListView { spacing: Appearance.spacing.small orientation: Qt.Vertical - implicitHeight: (LauncherConfig.sizes.itemHeight + spacing) * Math.min(LauncherConfig.maxShown, count) - spacing + implicitHeight: (Config.launcher.sizes.itemHeight + spacing) * Math.min(Config.launcher.maxShown, count) - spacing highlightMoveDuration: Appearance.anim.durations.normal highlightResizeDuration: 0 diff --git a/modules/launcher/Background.qml b/modules/launcher/Background.qml index 5a3d5d4..82c5f4a 100644 --- a/modules/launcher/Background.qml +++ b/modules/launcher/Background.qml @@ -7,12 +7,12 @@ ShapePath { id: root required property Wrapper wrapper - readonly property real rounding: BorderConfig.rounding + readonly property real rounding: Config.border.rounding readonly property bool flatten: wrapper.height < rounding * 2 readonly property real roundingY: flatten ? wrapper.height / 2 : rounding strokeWidth: -1 - fillColor: BorderConfig.colour + fillColor: Config.border.colour PathArc { relativeX: root.rounding diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index 54cc872..b6d1056 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -74,7 +74,7 @@ Item { topPadding: Appearance.padding.larger bottomPadding: Appearance.padding.larger - placeholderText: qsTr("Type \"%1\" for commands").arg(LauncherConfig.actionPrefix) + placeholderText: qsTr("Type \"%1\" for commands").arg(Config.launcher.actionPrefix) background: null onAccepted: { @@ -83,7 +83,7 @@ Item { if (list.showWallpapers) { Wallpapers.setWallpaper(currentItem.modelData.path); root.visibilities.launcher = false; - } else if (text.startsWith(LauncherConfig.actionPrefix)) { + } else if (text.startsWith(Config.launcher.actionPrefix)) { currentItem.modelData.onClicked(list.currentList); } else { Apps.launch(currentItem.modelData); diff --git a/modules/launcher/ContentList.qml b/modules/launcher/ContentList.qml index 9818118..ad116f7 100644 --- a/modules/launcher/ContentList.qml +++ b/modules/launcher/ContentList.qml @@ -15,7 +15,7 @@ Item { required property int padding required property int rounding - property bool showWallpapers: search.text.startsWith(`${LauncherConfig.actionPrefix}wallpaper `) + property bool showWallpapers: search.text.startsWith(`${Config.launcher.actionPrefix}wallpaper `) property var currentList: (showWallpapers ? wallpaperList : appList).item anchors.horizontalCenter: parent.horizontalCenter @@ -29,7 +29,7 @@ Item { name: "apps" PropertyChanges { - root.implicitWidth: LauncherConfig.sizes.itemWidth + root.implicitWidth: Config.launcher.sizes.itemWidth root.implicitHeight: Math.max(empty.height, appList.height) appList.active: true } @@ -43,8 +43,8 @@ Item { name: "wallpapers" PropertyChanges { - root.implicitWidth: Math.max(LauncherConfig.sizes.itemWidth, wallpaperList.width) - root.implicitHeight: LauncherConfig.sizes.wallpaperHeight + root.implicitWidth: Math.max(Config.launcher.sizes.itemWidth, wallpaperList.width) + root.implicitHeight: Config.launcher.sizes.wallpaperHeight wallpaperList.active: true } } diff --git a/modules/launcher/WallpaperItem.qml b/modules/launcher/WallpaperItem.qml index dbd482e..862e910 100644 --- a/modules/launcher/WallpaperItem.qml +++ b/modules/launcher/WallpaperItem.qml @@ -42,7 +42,7 @@ StyledRect { path: root.modelData.path smooth: !root.PathView.view.moving - width: LauncherConfig.sizes.wallpaperWidth + width: Config.launcher.sizes.wallpaperWidth height: width / 16 * 9 } diff --git a/modules/launcher/WallpaperList.qml b/modules/launcher/WallpaperList.qml index fef1726..fd82a2b 100644 --- a/modules/launcher/WallpaperList.qml +++ b/modules/launcher/WallpaperList.qml @@ -14,8 +14,8 @@ PathView { const screenWidth = QsWindow.window?.screen.width * 0.8; if (!screenWidth) return 0; - const itemWidth = LauncherConfig.sizes.wallpaperWidth * 0.8; - const max = LauncherConfig.maxWallpapers; + const itemWidth = Config.launcher.sizes.wallpaperWidth * 0.8; + const max = Config.launcher.maxWallpapers; if (max * itemWidth > screenWidth) { const items = Math.floor(screenWidth / itemWidth); return items > 1 && items % 2 === 0 ? items - 1 : items; @@ -43,7 +43,7 @@ PathView { Wallpapers.preview(currentItem.modelData.path); } - implicitWidth: Math.min(numItems, count) * (LauncherConfig.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2) + implicitWidth: Math.min(numItems, count) * (Config.launcher.sizes.wallpaperWidth * 0.8 + Appearance.padding.larger * 2) pathItemCount: numItems cacheItemCount: 4 -- cgit v1.2.3-freya