controlcenter: launcher pane refreshment

This commit is contained in:
ATMDA 2025-11-17 22:01:40 -05:00
parent c30e39ff06
commit 4de4a787de
3 changed files with 357 additions and 7 deletions

View file

@ -13,6 +13,7 @@ QtObject {
readonly property Bt bt: Bt {}
readonly property Network network: Network {}
readonly property Ethernet ethernet: Ethernet {}
readonly property Launcher launcher: Launcher {}
onActiveChanged: activeIndex = panes.indexOf(active)
onActiveIndexChanged: active = panes[activeIndex]
@ -34,4 +35,8 @@ QtObject {
component Ethernet: QtObject {
property var active
}
component Launcher: QtObject {
property var active
}
}

View file

@ -21,13 +21,26 @@ RowLayout {
required property Session session
property var selectedApp: null
property var selectedApp: root.session.launcher.active
property bool hideFromLauncherChecked: false
anchors.fill: parent
spacing: 0
onSelectedAppChanged: {
root.session.launcher.active = root.selectedApp;
updateToggleState();
}
Connections {
target: root.session.launcher
function onActiveChanged() {
root.selectedApp = root.session.launcher.active;
updateToggleState();
}
}
function updateToggleState() {
if (!root.selectedApp) {
root.hideFromLauncherChecked = false;
@ -73,9 +86,6 @@ RowLayout {
Config.save();
}
onSelectedAppChanged: {
updateToggleState();
}
AppDb {
id: allAppsDb
@ -202,6 +212,23 @@ RowLayout {
Item {
Layout.fillWidth: true
}
ToggleButton {
toggled: !root.session.launcher.active
icon: "settings"
accent: "Primary"
onClicked: {
if (root.session.launcher.active) {
root.session.launcher.active = null;
} else {
// Toggle to show settings - if there are apps, select the first one, otherwise show settings
if (root.filteredApps.length > 0) {
root.session.launcher.active = root.filteredApps[0];
}
}
}
}
}
StyledText {
@ -351,7 +378,7 @@ RowLayout {
StateLayer {
function onClicked(): void {
root.selectedApp = modelData;
root.session.launcher.active = modelData;
}
}
@ -405,11 +432,74 @@ RowLayout {
Loader {
id: rightLauncherLoader
property var pane: root.session.launcher.active
property string paneId: pane ? (pane.id || pane.entry?.id || "") : ""
anchors.fill: parent
anchors.margins: Appearance.padding.large * 2
opacity: 1
scale: 1
transformOrigin: Item.Center
clip: false
asynchronous: true
sourceComponent: rightContentComponent
sourceComponent: pane ? appDetails : settings
Component.onCompleted: {
targetComponent = pane ? appDetails : settings;
nextComponent = targetComponent;
}
property Component targetComponent: settings
property Component nextComponent: settings
function getComponentForPane() {
return pane ? appDetails : settings;
}
Behavior on paneId {
SequentialAnimation {
ParallelAnimation {
Anim {
target: rightLauncherLoader
property: "opacity"
to: 0
easing.bezierCurve: Appearance.anim.curves.standardAccel
}
Anim {
target: rightLauncherLoader
property: "scale"
to: 0.8
easing.bezierCurve: Appearance.anim.curves.standardAccel
}
}
PropertyAction {
target: rightLauncherLoader
property: "targetComponent"
value: rightLauncherLoader.nextComponent
}
ParallelAnimation {
Anim {
target: rightLauncherLoader
property: "opacity"
to: 1
easing.bezierCurve: Appearance.anim.curves.standardDecel
}
Anim {
target: rightLauncherLoader
property: "scale"
to: 1
easing.bezierCurve: Appearance.anim.curves.standardDecel
}
}
}
}
onPaneChanged: {
nextComponent = getComponentForPane();
paneId = pane ? (pane.id || pane.entry?.id || "") : "";
}
}
}
@ -420,7 +510,30 @@ RowLayout {
}
Component {
id: rightContentComponent
id: settings
StyledFlickable {
id: settingsFlickable
flickableDirection: Flickable.VerticalFlick
contentHeight: settingsInner.height
StyledScrollBar.vertical: StyledScrollBar {
flickable: settingsFlickable
}
Settings {
id: settingsInner
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
session: root.session
}
}
}
Component {
id: appDetails
ColumnLayout {
anchors.fill: parent
@ -516,4 +629,10 @@ RowLayout {
}
}
}
component Anim: NumberAnimation {
target: rightLauncherLoader
duration: Appearance.anim.durations.normal / 2
easing.type: Easing.BezierSpline
}
}

View file

@ -0,0 +1,226 @@
pragma ComponentBehavior: Bound
import ".."
import qs.components
import qs.components.controls
import qs.components.effects
import qs.services
import qs.config
import QtQuick
import QtQuick.Layouts
ColumnLayout {
id: root
required property Session session
spacing: Appearance.spacing.normal
MaterialIcon {
Layout.alignment: Qt.AlignHCenter
text: "apps"
font.pointSize: Appearance.font.size.extraLarge * 3
font.bold: true
}
StyledText {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Launcher Settings")
font.pointSize: Appearance.font.size.large
font.bold: true
}
SectionHeader {
Layout.topMargin: Appearance.spacing.large
title: qsTr("General")
description: qsTr("General launcher settings")
}
SectionContainer {
ToggleRow {
label: qsTr("Enabled")
checked: Config.launcher.enabled
toggle.onToggled: {
Config.launcher.enabled = checked;
Config.save();
}
}
ToggleRow {
label: qsTr("Show on hover")
checked: Config.launcher.showOnHover
toggle.onToggled: {
Config.launcher.showOnHover = checked;
Config.save();
}
}
ToggleRow {
label: qsTr("Vim keybinds")
checked: Config.launcher.vimKeybinds
toggle.onToggled: {
Config.launcher.vimKeybinds = checked;
Config.save();
}
}
ToggleRow {
label: qsTr("Enable dangerous actions")
checked: Config.launcher.enableDangerousActions
toggle.onToggled: {
Config.launcher.enableDangerousActions = checked;
Config.save();
}
}
}
SectionHeader {
Layout.topMargin: Appearance.spacing.large
title: qsTr("Display")
description: qsTr("Display and appearance settings")
}
SectionContainer {
contentSpacing: Appearance.spacing.small / 2
PropertyRow {
label: qsTr("Max shown items")
value: qsTr("%1").arg(Config.launcher.maxShown)
}
PropertyRow {
showTopMargin: true
label: qsTr("Max wallpapers")
value: qsTr("%1").arg(Config.launcher.maxWallpapers)
}
PropertyRow {
showTopMargin: true
label: qsTr("Drag threshold")
value: qsTr("%1 px").arg(Config.launcher.dragThreshold)
}
}
SectionHeader {
Layout.topMargin: Appearance.spacing.large
title: qsTr("Prefixes")
description: qsTr("Command prefix settings")
}
SectionContainer {
contentSpacing: Appearance.spacing.small / 2
PropertyRow {
label: qsTr("Special prefix")
value: Config.launcher.specialPrefix || qsTr("None")
}
PropertyRow {
showTopMargin: true
label: qsTr("Action prefix")
value: Config.launcher.actionPrefix || qsTr("None")
}
}
SectionHeader {
Layout.topMargin: Appearance.spacing.large
title: qsTr("Fuzzy search")
description: qsTr("Fuzzy search settings")
}
SectionContainer {
ToggleRow {
label: qsTr("Apps")
checked: Config.launcher.useFuzzy.apps
toggle.onToggled: {
Config.launcher.useFuzzy.apps = checked;
Config.save();
}
}
ToggleRow {
label: qsTr("Actions")
checked: Config.launcher.useFuzzy.actions
toggle.onToggled: {
Config.launcher.useFuzzy.actions = checked;
Config.save();
}
}
ToggleRow {
label: qsTr("Schemes")
checked: Config.launcher.useFuzzy.schemes
toggle.onToggled: {
Config.launcher.useFuzzy.schemes = checked;
Config.save();
}
}
ToggleRow {
label: qsTr("Variants")
checked: Config.launcher.useFuzzy.variants
toggle.onToggled: {
Config.launcher.useFuzzy.variants = checked;
Config.save();
}
}
ToggleRow {
label: qsTr("Wallpapers")
checked: Config.launcher.useFuzzy.wallpapers
toggle.onToggled: {
Config.launcher.useFuzzy.wallpapers = checked;
Config.save();
}
}
}
SectionHeader {
Layout.topMargin: Appearance.spacing.large
title: qsTr("Sizes")
description: qsTr("Size settings for launcher items")
}
SectionContainer {
contentSpacing: Appearance.spacing.small / 2
PropertyRow {
label: qsTr("Item width")
value: qsTr("%1 px").arg(Config.launcher.sizes.itemWidth)
}
PropertyRow {
showTopMargin: true
label: qsTr("Item height")
value: qsTr("%1 px").arg(Config.launcher.sizes.itemHeight)
}
PropertyRow {
showTopMargin: true
label: qsTr("Wallpaper width")
value: qsTr("%1 px").arg(Config.launcher.sizes.wallpaperWidth)
}
PropertyRow {
showTopMargin: true
label: qsTr("Wallpaper height")
value: qsTr("%1 px").arg(Config.launcher.sizes.wallpaperHeight)
}
}
SectionHeader {
Layout.topMargin: Appearance.spacing.large
title: qsTr("Hidden apps")
description: qsTr("Applications hidden from launcher")
}
SectionContainer {
contentSpacing: Appearance.spacing.small / 2
PropertyRow {
label: qsTr("Total hidden")
value: qsTr("%1").arg(Config.launcher.hiddenApps ? Config.launcher.hiddenApps.length : 0)
}
}
}