diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-01-28 19:21:44 +1100 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2026-01-28 19:21:44 +1100 |
| commit | 9d7f0c48cebec02aaf2ca780b89a763ce91f8624 (patch) | |
| tree | 2345921b670f730268203020e754465503707ed3 /modules/controlcenter/launcher | |
| parent | controlcenter: remove qt5compat dep (diff) | |
| download | caelestia-shell-9d7f0c48cebec02aaf2ca780b89a763ce91f8624.tar.gz caelestia-shell-9d7f0c48cebec02aaf2ca780b89a763ce91f8624.tar.bz2 caelestia-shell-9d7f0c48cebec02aaf2ca780b89a763ce91f8624.zip | |
internal: format
Diffstat (limited to 'modules/controlcenter/launcher')
| -rw-r--r-- | modules/controlcenter/launcher/LauncherPane.qml | 349 | ||||
| -rw-r--r-- | modules/controlcenter/launcher/Settings.qml | 1 |
2 files changed, 173 insertions, 177 deletions
diff --git a/modules/controlcenter/launcher/LauncherPane.qml b/modules/controlcenter/launcher/LauncherPane.qml index fabe75e..0dd464f 100644 --- a/modules/controlcenter/launcher/LauncherPane.qml +++ b/modules/controlcenter/launcher/LauncherPane.qml @@ -79,7 +79,6 @@ Item { Config.save(); } - AppDb { id: allAppsDb @@ -118,9 +117,7 @@ Item { scoreFn: r => r[0].score }); - return results - .sort((a, b) => b._score - a._score) - .map(r => r.obj._item); + return results.sort((a, b) => b._score - a._score).map(r => r.obj._item); } property list<var> filteredApps: [] @@ -156,214 +153,214 @@ Item { spacing: Appearance.spacing.small RowLayout { - spacing: Appearance.spacing.smaller + spacing: Appearance.spacing.smaller - StyledText { - text: qsTr("Launcher") - font.pointSize: Appearance.font.size.large - font.weight: 500 - } + StyledText { + text: qsTr("Launcher") + font.pointSize: Appearance.font.size.large + font.weight: 500 + } - Item { - Layout.fillWidth: true - } + Item { + Layout.fillWidth: true + } - ToggleButton { - toggled: !root.session.launcher.active - icon: "settings" - accent: "Primary" - iconSize: Appearance.font.size.normal - horizontalPadding: Appearance.padding.normal - verticalPadding: Appearance.padding.smaller - tooltip: qsTr("Launcher settings") + ToggleButton { + toggled: !root.session.launcher.active + icon: "settings" + accent: "Primary" + iconSize: Appearance.font.size.normal + horizontalPadding: Appearance.padding.normal + verticalPadding: Appearance.padding.smaller + tooltip: qsTr("Launcher settings") - onClicked: { - if (root.session.launcher.active) { - root.session.launcher.active = null; - } else { - if (root.filteredApps.length > 0) { - root.session.launcher.active = root.filteredApps[0]; + onClicked: { + if (root.session.launcher.active) { + root.session.launcher.active = null; + } else { + if (root.filteredApps.length > 0) { + root.session.launcher.active = root.filteredApps[0]; + } } } } } - } - StyledText { - Layout.topMargin: Appearance.spacing.large - text: qsTr("Applications (%1)").arg(root.searchText ? root.filteredApps.length : allAppsDb.apps.length) - font.pointSize: Appearance.font.size.normal - font.weight: 500 - } + StyledText { + Layout.topMargin: Appearance.spacing.large + text: qsTr("Applications (%1)").arg(root.searchText ? root.filteredApps.length : allAppsDb.apps.length) + font.pointSize: Appearance.font.size.normal + font.weight: 500 + } - StyledText { - text: qsTr("All applications available in the launcher") - color: Colours.palette.m3outline - } + StyledText { + text: qsTr("All applications available in the launcher") + color: Colours.palette.m3outline + } - StyledRect { - Layout.fillWidth: true - Layout.topMargin: Appearance.spacing.normal - Layout.bottomMargin: Appearance.spacing.small + StyledRect { + Layout.fillWidth: true + Layout.topMargin: Appearance.spacing.normal + Layout.bottomMargin: Appearance.spacing.small - color: Colours.layer(Colours.palette.m3surfaceContainer, 2) - radius: Appearance.rounding.full + color: Colours.layer(Colours.palette.m3surfaceContainer, 2) + radius: Appearance.rounding.full - implicitHeight: Math.max(searchIcon.implicitHeight, searchField.implicitHeight, clearIcon.implicitHeight) + implicitHeight: Math.max(searchIcon.implicitHeight, searchField.implicitHeight, clearIcon.implicitHeight) - MaterialIcon { - id: searchIcon + MaterialIcon { + id: searchIcon - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.leftMargin: Appearance.padding.normal + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: Appearance.padding.normal - text: "search" - color: Colours.palette.m3onSurfaceVariant - } + text: "search" + color: Colours.palette.m3onSurfaceVariant + } - StyledTextField { - id: searchField + StyledTextField { + id: searchField - anchors.left: searchIcon.right - anchors.right: clearIcon.left - anchors.leftMargin: Appearance.spacing.small - anchors.rightMargin: Appearance.spacing.small + anchors.left: searchIcon.right + anchors.right: clearIcon.left + anchors.leftMargin: Appearance.spacing.small + anchors.rightMargin: Appearance.spacing.small - topPadding: Appearance.padding.normal - bottomPadding: Appearance.padding.normal + topPadding: Appearance.padding.normal + bottomPadding: Appearance.padding.normal - placeholderText: qsTr("Search applications...") + placeholderText: qsTr("Search applications...") - onTextChanged: { - root.searchText = text; + onTextChanged: { + root.searchText = text; + } } - } - MaterialIcon { - id: clearIcon + MaterialIcon { + id: clearIcon - anchors.verticalCenter: parent.verticalCenter - anchors.right: parent.right - anchors.rightMargin: Appearance.padding.normal + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: Appearance.padding.normal - width: searchField.text ? implicitWidth : implicitWidth / 2 - opacity: { - if (!searchField.text) - return 0; - if (clearMouse.pressed) - return 0.7; - if (clearMouse.containsMouse) - return 0.8; - return 1; - } + width: searchField.text ? implicitWidth : implicitWidth / 2 + opacity: { + if (!searchField.text) + return 0; + if (clearMouse.pressed) + return 0.7; + if (clearMouse.containsMouse) + return 0.8; + return 1; + } - text: "close" - color: Colours.palette.m3onSurfaceVariant + text: "close" + color: Colours.palette.m3onSurfaceVariant - MouseArea { - id: clearMouse + MouseArea { + id: clearMouse - anchors.fill: parent - hoverEnabled: true - cursorShape: searchField.text ? Qt.PointingHandCursor : undefined + anchors.fill: parent + hoverEnabled: true + cursorShape: searchField.text ? Qt.PointingHandCursor : undefined - onClicked: searchField.text = "" - } + onClicked: searchField.text = "" + } - Behavior on width { - Anim { - duration: Appearance.anim.durations.small + Behavior on width { + Anim { + duration: Appearance.anim.durations.small + } } - } - Behavior on opacity { - Anim { - duration: Appearance.anim.durations.small + Behavior on opacity { + Anim { + duration: Appearance.anim.durations.small + } } } } - } - Loader { - id: appsListLoader - Layout.fillWidth: true - Layout.fillHeight: true - active: true - - sourceComponent: StyledListView { - id: appsListView - + Loader { + id: appsListLoader Layout.fillWidth: true Layout.fillHeight: true + active: true - model: root.filteredApps - spacing: Appearance.spacing.small / 2 - clip: true + sourceComponent: StyledListView { + id: appsListView - StyledScrollBar.vertical: StyledScrollBar { - flickable: parent - } + Layout.fillWidth: true + Layout.fillHeight: true - delegate: StyledRect { - required property var modelData + model: root.filteredApps + spacing: Appearance.spacing.small / 2 + clip: true - width: parent ? parent.width : 0 + StyledScrollBar.vertical: StyledScrollBar { + flickable: parent + } - readonly property bool isSelected: root.selectedApp === modelData + delegate: StyledRect { + required property var modelData - color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" - radius: Appearance.rounding.normal + width: parent ? parent.width : 0 - opacity: 0 + readonly property bool isSelected: root.selectedApp === modelData - Behavior on opacity { - NumberAnimation { - duration: 1000 - easing.type: Easing.OutCubic + color: isSelected ? Colours.layer(Colours.palette.m3surfaceContainer, 2) : "transparent" + radius: Appearance.rounding.normal + + opacity: 0 + + Behavior on opacity { + NumberAnimation { + duration: 1000 + easing.type: Easing.OutCubic + } } - } - Component.onCompleted: { - opacity = 1; - } + Component.onCompleted: { + opacity = 1; + } - StateLayer { - function onClicked(): void { - root.session.launcher.active = modelData; + StateLayer { + function onClicked(): void { + root.session.launcher.active = modelData; + } } - } - RowLayout { - anchors.left: parent.left - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - anchors.margins: Appearance.padding.normal + RowLayout { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.margins: Appearance.padding.normal - spacing: Appearance.spacing.normal + spacing: Appearance.spacing.normal - IconImage { - Layout.alignment: Qt.AlignVCenter - implicitSize: 32 - source: { - const entry = modelData.entry; - return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; + IconImage { + Layout.alignment: Qt.AlignVCenter + implicitSize: 32 + source: { + const entry = modelData.entry; + return entry ? Quickshell.iconPath(entry.icon, "image-missing") : "image-missing"; + } } - } - StyledText { - Layout.fillWidth: true - text: modelData.name || modelData.entry?.name || qsTr("Unknown") - font.pointSize: Appearance.font.size.normal + StyledText { + Layout.fillWidth: true + text: modelData.name || modelData.entry?.name || qsTr("Unknown") + font.pointSize: Appearance.font.size.normal + } } - } - implicitHeight: 40 + implicitHeight: 40 + } } } } } - } rightContent: Component { Item { @@ -518,7 +515,8 @@ Item { implicitSize: Appearance.font.size.extraLarge * 3 * 2 source: { const app = appDetailsLayout.displayedApp; - if (!app) return "image-missing"; + if (!app) + return "image-missing"; const entry = app.entry; if (entry && entry.icon) { return Quickshell.iconPath(entry.icon, "image-missing"); @@ -561,35 +559,34 @@ Item { anchors.top: parent.top spacing: Appearance.spacing.normal - SwitchRow { - Layout.topMargin: Appearance.spacing.normal - visible: appDetailsLayout.displayedApp !== null - label: qsTr("Hide from launcher") - checked: root.hideFromLauncherChecked - enabled: appDetailsLayout.displayedApp !== null - onToggled: checked => { - root.hideFromLauncherChecked = checked; - const app = appDetailsLayout.displayedApp; - if (app) { - const appId = app.id || app.entry?.id; - const hiddenApps = Config.launcher.hiddenApps ? [...Config.launcher.hiddenApps] : []; - if (checked) { - if (!hiddenApps.includes(appId)) { - hiddenApps.push(appId); - } - } else { - const index = hiddenApps.indexOf(appId); - if (index !== -1) { - hiddenApps.splice(index, 1); + SwitchRow { + Layout.topMargin: Appearance.spacing.normal + visible: appDetailsLayout.displayedApp !== null + label: qsTr("Hide from launcher") + checked: root.hideFromLauncherChecked + enabled: appDetailsLayout.displayedApp !== null + onToggled: checked => { + root.hideFromLauncherChecked = checked; + const app = appDetailsLayout.displayedApp; + if (app) { + const appId = app.id || app.entry?.id; + const hiddenApps = Config.launcher.hiddenApps ? [...Config.launcher.hiddenApps] : []; + if (checked) { + if (!hiddenApps.includes(appId)) { + hiddenApps.push(appId); + } + } else { + const index = hiddenApps.indexOf(appId); + if (index !== -1) { + hiddenApps.splice(index, 1); + } } + Config.launcher.hiddenApps = hiddenApps; + Config.save(); } - Config.launcher.hiddenApps = hiddenApps; - Config.save(); } } } - - } } } } diff --git a/modules/controlcenter/launcher/Settings.qml b/modules/controlcenter/launcher/Settings.qml index 161221e..5eaf6e0 100644 --- a/modules/controlcenter/launcher/Settings.qml +++ b/modules/controlcenter/launcher/Settings.qml @@ -215,4 +215,3 @@ ColumnLayout { } } } - |