cleanup: removed unnecessary comments

This commit is contained in:
ATMDA 2025-11-19 21:15:40 -05:00
parent 978a3f4302
commit 147410e39b
22 changed files with 9 additions and 194 deletions

View file

@ -97,6 +97,5 @@ Item {
} }
} }
// Expose initialOpeningComplete for NavRail to prevent tab switching during opening animation
readonly property bool initialOpeningComplete: panes.initialOpeningComplete readonly property bool initialOpeningComplete: panes.initialOpeningComplete
} }

View file

@ -19,7 +19,6 @@ ClippingRectangle {
required property Session session required property Session session
// Expose initialOpeningComplete so parent can check if opening animation is done
readonly property bool initialOpeningComplete: layout.initialOpeningComplete readonly property bool initialOpeningComplete: layout.initialOpeningComplete
color: "transparent" color: "transparent"
@ -27,7 +26,6 @@ ClippingRectangle {
focus: false focus: false
activeFocusOnTab: false activeFocusOnTab: false
// Clear focus when clicking anywhere in the panes area
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
z: -1 z: -1
@ -37,7 +35,6 @@ ClippingRectangle {
} }
} }
// Clear focus when switching panes
Connections { Connections {
target: root.session target: root.session
@ -54,8 +51,6 @@ ClippingRectangle {
clip: true clip: true
property bool animationComplete: true property bool animationComplete: true
// Track if initial opening animation has completed
// During initial opening, only the active pane loads to avoid hiccups
property bool initialOpeningComplete: false property bool initialOpeningComplete: false
Timer { Timer {
@ -66,8 +61,6 @@ ClippingRectangle {
} }
} }
// Timer to detect when initial opening animation completes
// Uses large duration to cover both normal and detached opening cases
Timer { Timer {
id: initialOpeningTimer id: initialOpeningTimer
interval: Appearance.anim.durations.large interval: Appearance.anim.durations.large
@ -94,7 +87,6 @@ ClippingRectangle {
Connections { Connections {
target: root.session target: root.session
function onActiveIndexChanged(): void { function onActiveIndexChanged(): void {
// Mark animation as incomplete and start delay timer
layout.animationComplete = false; layout.animationComplete = false;
animationDelayTimer.restart(); animationDelayTimer.restart();
} }
@ -110,28 +102,21 @@ ClippingRectangle {
implicitWidth: root.width implicitWidth: root.width
implicitHeight: root.height implicitHeight: root.height
// Track if this pane has ever been loaded to enable caching
property bool hasBeenLoaded: false property bool hasBeenLoaded: false
// Function to compute if this pane should be active
function updateActive(): void { function updateActive(): void {
const diff = Math.abs(root.session.activeIndex - pane.paneIndex); const diff = Math.abs(root.session.activeIndex - pane.paneIndex);
const isActivePane = diff === 0; const isActivePane = diff === 0;
let shouldBeActive = false; let shouldBeActive = false;
// During initial opening animation, only load the active pane
// This prevents hiccups from multiple panes loading simultaneously
if (!layout.initialOpeningComplete) { if (!layout.initialOpeningComplete) {
shouldBeActive = isActivePane; shouldBeActive = isActivePane;
} else { } else {
// After initial opening, allow current and adjacent panes for smooth transitions
if (diff <= 1) { if (diff <= 1) {
shouldBeActive = true; shouldBeActive = true;
} else if (pane.hasBeenLoaded) { } else if (pane.hasBeenLoaded) {
// For distant panes that have been loaded before, keep them active to preserve cached data
shouldBeActive = true; shouldBeActive = true;
} else { } else {
// For new distant panes, wait until animation completes to avoid heavy loading during transition
shouldBeActive = layout.animationComplete; shouldBeActive = layout.animationComplete;
} }
} }
@ -152,12 +137,10 @@ ClippingRectangle {
} }
onActiveChanged: { onActiveChanged: {
// Mark pane as loaded when it becomes active
if (active && !pane.hasBeenLoaded) { if (active && !pane.hasBeenLoaded) {
pane.hasBeenLoaded = true; pane.hasBeenLoaded = true;
} }
// Load the component with initial properties when activated
if (active && !item) { if (active && !item) {
loader.setSource(pane.componentPath, { loader.setSource(pane.componentPath, {
"session": root.session "session": root.session
@ -166,7 +149,6 @@ ClippingRectangle {
} }
onItemChanged: { onItemChanged: {
// Mark pane as loaded when item is created
if (item) { if (item) {
pane.hasBeenLoaded = true; pane.hasBeenLoaded = true;
} }

View file

@ -11,7 +11,6 @@ QtObject {
property int activeIndex: 0 property int activeIndex: 0
property bool navExpanded: false property bool navExpanded: false
// Pane-specific state objects
readonly property BluetoothState bt: BluetoothState {} readonly property BluetoothState bt: BluetoothState {}
readonly property NetworkState network: NetworkState {} readonly property NetworkState network: NetworkState {}
readonly property EthernetState ethernet: EthernetState {} readonly property EthernetState ethernet: EthernetState {}

View file

@ -22,7 +22,6 @@ Item {
required property Session session required property Session session
// Appearance settings
property real animDurationsScale: Config.appearance.anim.durations.scale ?? 1 property real animDurationsScale: Config.appearance.anim.durations.scale ?? 1
property string fontFamilyMaterial: Config.appearance.font.family.material ?? "Material Symbols Rounded" property string fontFamilyMaterial: Config.appearance.font.family.material ?? "Material Symbols Rounded"
property string fontFamilyMono: Config.appearance.font.family.mono ?? "CaskaydiaCove NF" property string fontFamilyMono: Config.appearance.font.family.mono ?? "CaskaydiaCove NF"
@ -37,7 +36,6 @@ Item {
property real borderRounding: Config.border.rounding ?? 1 property real borderRounding: Config.border.rounding ?? 1
property real borderThickness: Config.border.thickness ?? 1 property real borderThickness: Config.border.thickness ?? 1
// Background settings
property bool desktopClockEnabled: Config.background.desktopClock.enabled ?? false property bool desktopClockEnabled: Config.background.desktopClock.enabled ?? false
property bool backgroundEnabled: Config.background.enabled ?? true property bool backgroundEnabled: Config.background.enabled ?? true
property bool visualiserEnabled: Config.background.visualiser.enabled ?? false property bool visualiserEnabled: Config.background.visualiser.enabled ?? false
@ -127,13 +125,8 @@ Item {
anchors.fill: parent anchors.fill: parent
asynchronous: true asynchronous: true
active: { active: {
// Lazy load: only activate when:
// 1. Right pane is loaded AND
// 2. Appearance pane is active (index 3) or adjacent (for smooth transitions)
// This prevents loading all wallpapers when control center opens but appearance pane isn't visible
const isActive = root.session.activeIndex === 3; const isActive = root.session.activeIndex === 3;
const isAdjacent = Math.abs(root.session.activeIndex - 3) === 1; const isAdjacent = Math.abs(root.session.activeIndex - 3) === 1;
// Access loader through SplitPaneLayout's rightLoader
const splitLayout = root.children[0]; const splitLayout = root.children[0];
const loader = splitLayout && splitLayout.rightLoader ? splitLayout.rightLoader : null; const loader = splitLayout && splitLayout.rightLoader ? splitLayout.rightLoader : null;
const shouldActivate = loader && loader.item !== null && (isActive || isAdjacent); const shouldActivate = loader && loader.item !== null && (isActive || isAdjacent);
@ -150,7 +143,6 @@ Item {
onActiveChanged: { onActiveChanged: {
if (!active && wallpaperLoader.item) { if (!active && wallpaperLoader.item) {
const container = wallpaperLoader.item; const container = wallpaperLoader.item;
// Access timer through wallpaperGrid
if (container && container.wallpaperGrid) { if (container && container.wallpaperGrid) {
const grid = container.wallpaperGrid; const grid = container.wallpaperGrid;
if (grid.imageUpdateTimer) { if (grid.imageUpdateTimer) {
@ -186,20 +178,17 @@ Item {
} }
} }
// Lazy loading model: loads one image at a time, only when touching bottom
// This prevents GridView from creating all delegates at once
QtObject { QtObject {
id: lazyModel id: lazyModel
property var sourceList: null property var sourceList: null
property int loadedCount: 0 // Total items available to load property int loadedCount: 0
property int visibleCount: 0 // Items actually exposed to GridView (only visible + buffer) property int visibleCount: 0
property int totalCount: 0 property int totalCount: 0
function initialize(list) { function initialize(list) {
sourceList = list; sourceList = list;
totalCount = list ? list.length : 0; totalCount = list ? list.length : 0;
// Start with enough items to fill the initial viewport (~3 rows)
const initialRows = 3; const initialRows = 3;
const cols = wallpaperGrid.columnsCount > 0 ? wallpaperGrid.columnsCount : 3; const cols = wallpaperGrid.columnsCount > 0 ? wallpaperGrid.columnsCount : 3;
const initialCount = Math.min(initialRows * cols, totalCount); const initialCount = Math.min(initialRows * cols, totalCount);
@ -216,7 +205,6 @@ Item {
} }
function updateVisibleCount(neededCount) { function updateVisibleCount(neededCount) {
// Always round up to complete rows to avoid incomplete rows in the grid
const cols = wallpaperGrid.columnsCount > 0 ? wallpaperGrid.columnsCount : 1; const cols = wallpaperGrid.columnsCount > 0 ? wallpaperGrid.columnsCount : 1;
const maxVisible = Math.min(neededCount, loadedCount); const maxVisible = Math.min(neededCount, loadedCount);
const rows = Math.ceil(maxVisible / cols); const rows = Math.ceil(maxVisible / cols);
@ -237,7 +225,6 @@ Item {
readonly property int minCellWidth: 200 + Appearance.spacing.normal readonly property int minCellWidth: 200 + Appearance.spacing.normal
readonly property int columnsCount: Math.max(1, Math.floor(parent.width / minCellWidth)) readonly property int columnsCount: Math.max(1, Math.floor(parent.width / minCellWidth))
// Height based on visible items only - prevents GridView from creating all delegates
readonly property int layoutPreferredHeight: { readonly property int layoutPreferredHeight: {
if (!lazyModel || lazyModel.visibleCount === 0 || columnsCount === 0) { if (!lazyModel || lazyModel.visibleCount === 0 || columnsCount === 0) {
return 0; return 0;
@ -255,7 +242,6 @@ Item {
topMargin: 0 topMargin: 0
bottomMargin: 0 bottomMargin: 0
// Use ListModel for incremental updates to prevent flashing when new items are added
ListModel { ListModel {
id: wallpaperListModel id: wallpaperListModel
} }
@ -270,7 +256,6 @@ Item {
const newCount = lazyModel.visibleCount; const newCount = lazyModel.visibleCount;
const currentCount = wallpaperListModel.count; const currentCount = wallpaperListModel.count;
// Only append new items - never remove or replace existing ones
if (newCount > currentCount) { if (newCount > currentCount) {
const flickable = wallpaperGridContainer.parentFlickable; const flickable = wallpaperGridContainer.parentFlickable;
const oldScrollY = flickable ? flickable.contentY : 0; const oldScrollY = flickable ? flickable.contentY : 0;
@ -279,7 +264,6 @@ Item {
wallpaperListModel.append({modelData: lazyModel.sourceList[i]}); wallpaperListModel.append({modelData: lazyModel.sourceList[i]});
} }
// Preserve scroll position after model update
if (flickable) { if (flickable) {
Qt.callLater(function() { Qt.callLater(function() {
if (Math.abs(flickable.contentY - oldScrollY) < 1) { if (Math.abs(flickable.contentY - oldScrollY) < 1) {
@ -382,7 +366,6 @@ Item {
const neededCount = Math.min((neededBottomRow + 1) * wallpaperGrid.columnsCount, lazyModel.loadedCount); const neededCount = Math.min((neededBottomRow + 1) * wallpaperGrid.columnsCount, lazyModel.loadedCount);
lazyModel.updateVisibleCount(neededCount); lazyModel.updateVisibleCount(neededCount);
// Load more when we're within 1 row of running out of loaded items
const loadedRows = Math.ceil(lazyModel.loadedCount / wallpaperGrid.columnsCount); const loadedRows = Math.ceil(lazyModel.loadedCount / wallpaperGrid.columnsCount);
const rowsRemaining = loadedRows - (bottomRow + 1); const rowsRemaining = loadedRows - (bottomRow + 1);
@ -434,7 +417,6 @@ Item {
const neededCount = Math.min((neededBottomRow + 1) * wallpaperGrid.columnsCount, lazyModel.loadedCount); const neededCount = Math.min((neededBottomRow + 1) * wallpaperGrid.columnsCount, lazyModel.loadedCount);
lazyModel.updateVisibleCount(neededCount); lazyModel.updateVisibleCount(neededCount);
// Load more when we're within 1 row of running out of loaded items
const loadedRows = Math.ceil(lazyModel.loadedCount / wallpaperGrid.columnsCount); const loadedRows = Math.ceil(lazyModel.loadedCount / wallpaperGrid.columnsCount);
const rowsRemaining = loadedRows - (bottomRow + 1); const rowsRemaining = loadedRows - (bottomRow + 1);
@ -450,8 +432,6 @@ Item {
} }
} }
// Parent Flickable handles scrolling
interactive: false interactive: false
@ -786,11 +766,9 @@ Item {
function onClicked(): void { function onClicked(): void {
const variant = modelData.variant; const variant = modelData.variant;
// Optimistic update - set immediately for responsive UI
Schemes.currentVariant = variant; Schemes.currentVariant = variant;
Quickshell.execDetached(["caelestia", "scheme", "set", "-v", variant]); Quickshell.execDetached(["caelestia", "scheme", "set", "-v", variant]);
// Reload after a delay to confirm changes
Qt.callLater(() => { Qt.callLater(() => {
reloadTimer.restart(); reloadTimer.restart();
}); });
@ -873,11 +851,9 @@ Item {
const flavour = modelData.flavour; const flavour = modelData.flavour;
const schemeKey = `${name} ${flavour}`; const schemeKey = `${name} ${flavour}`;
// Optimistic update - set immediately for responsive UI
Schemes.currentScheme = schemeKey; Schemes.currentScheme = schemeKey;
Quickshell.execDetached(["caelestia", "scheme", "set", "-n", name, "-f", flavour]); Quickshell.execDetached(["caelestia", "scheme", "set", "-n", name, "-f", flavour]);
// Reload after a delay to confirm changes
Qt.callLater(() => { Qt.callLater(() => {
reloadTimer.restart(); reloadTimer.restart();
}); });

View file

@ -40,7 +40,6 @@ Item {
anchors.right: parent.right anchors.right: parent.right
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
// Audio header above the collapsible sections
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
spacing: Appearance.spacing.smaller spacing: Appearance.spacing.smaller

View file

@ -440,7 +440,6 @@ StyledFlickable {
} }
} }
// FAB Menu (positioned absolutely relative to flickable)
ColumnLayout { ColumnLayout {
anchors.right: fabRoot.right anchors.right: fabRoot.right
anchors.bottom: fabRoot.top anchors.bottom: fabRoot.top

View file

@ -328,7 +328,7 @@ ColumnLayout {
anchors.left: parent.left anchors.left: parent.left
text: qsTr("Rename adapter (currently does not work)") // FIXME: remove disclaimer when fixed text: qsTr("Rename adapter (currently does not work)")
color: Colours.palette.m3outline color: Colours.palette.m3outline
font.pointSize: Appearance.font.size.small font.pointSize: Appearance.font.size.small
} }
@ -345,8 +345,6 @@ ColumnLayout {
readOnly: !root.session.bt.editingAdapterName readOnly: !root.session.bt.editingAdapterName
onAccepted: { onAccepted: {
root.session.bt.editingAdapterName = false; root.session.bt.editingAdapterName = false;
// Doesn't work for now, will be added to QS later
// root.session.bt.currentAdapter.name = text;
} }
leftPadding: Appearance.padding.normal leftPadding: Appearance.padding.normal

View file

@ -18,10 +18,7 @@ Item {
property Component headerComponent: null property Component headerComponent: null
property list<Component> sections: [] property list<Component> sections: []
// Optional: Custom content to insert after header but before sections
property Component topContent: null property Component topContent: null
// Optional: Custom content to insert after all sections
property Component bottomContent: null property Component bottomContent: null
implicitWidth: layout.implicitWidth implicitWidth: layout.implicitWidth
@ -35,7 +32,6 @@ Item {
anchors.top: parent.top anchors.top: parent.top
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
// Header component (e.g., ConnectionHeader or SettingsHeader)
Loader { Loader {
id: headerLoader id: headerLoader
@ -44,7 +40,6 @@ Item {
visible: root.headerComponent !== null visible: root.headerComponent !== null
} }
// Top content (optional)
Loader { Loader {
id: topContentLoader id: topContentLoader
@ -53,7 +48,6 @@ Item {
visible: root.topContent !== null visible: root.topContent !== null
} }
// Sections
Repeater { Repeater {
model: root.sections model: root.sections
@ -65,7 +59,6 @@ Item {
} }
} }
// Bottom content (optional)
Loader { Loader {
id: bottomContentLoader id: bottomContentLoader

View file

@ -28,7 +28,6 @@ ColumnLayout {
spacing: Appearance.spacing.small spacing: Appearance.spacing.small
// Header with action buttons (optional)
Loader { Loader {
id: headerLoader id: headerLoader
@ -37,7 +36,6 @@ ColumnLayout {
visible: root.headerComponent !== null && root.showHeader visible: root.headerComponent !== null && root.showHeader
} }
// Title and description row
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: root.headerComponent ? 0 : 0 Layout.topMargin: root.headerComponent ? 0 : 0
@ -61,10 +59,8 @@ ColumnLayout {
} }
} }
// Expose view for access from parent components
property alias view: view property alias view: view
// Description text
StyledText { StyledText {
visible: root.description !== "" visible: root.description !== ""
Layout.fillWidth: true Layout.fillWidth: true
@ -72,20 +68,18 @@ ColumnLayout {
color: Colours.palette.m3outline color: Colours.palette.m3outline
} }
// List view
StyledListView { StyledListView {
id: view id: view
Layout.fillWidth: true Layout.fillWidth: true
// Use contentHeight to show all items without estimation
implicitHeight: contentHeight implicitHeight: contentHeight
model: root.model model: root.model
delegate: root.delegate delegate: root.delegate
spacing: Appearance.spacing.small / 2 spacing: Appearance.spacing.small / 2
interactive: false // Disable individual scrolling - parent pane handles it interactive: false
clip: false // Don't clip - let parent handle scrolling clip: false
} }
} }

View file

@ -3,26 +3,17 @@ pragma ComponentBehavior: Bound
import qs.config import qs.config
import QtQuick import QtQuick
// Reusable pane transition animation component
// Provides standard fade-out/scale-down update fade-in/scale-up animation
// Used when switching between detail/settings views in panes
SequentialAnimation { SequentialAnimation {
id: root id: root
// The Loader element to animate
required property Item target required property Item target
// Optional list of PropertyActions to execute during the transition
// These typically update the component being displayed
property list<PropertyAction> propertyActions property list<PropertyAction> propertyActions
// Animation parameters (with sensible defaults)
property real scaleFrom: 1.0 property real scaleFrom: 1.0
property real scaleTo: 0.8 property real scaleTo: 0.8
property real opacityFrom: 1.0 property real opacityFrom: 1.0
property real opacityTo: 0.0 property real opacityTo: 0.0
// Fade out and scale down
ParallelAnimation { ParallelAnimation {
NumberAnimation { NumberAnimation {
target: root.target target: root.target
@ -45,8 +36,6 @@ SequentialAnimation {
} }
} }
// Execute property actions (component switching, state updates, etc.)
// This is where the component change happens while invisible
ScriptAction { ScriptAction {
script: { script: {
for (let i = 0; i < root.propertyActions.length; i++) { for (let i = 0; i < root.propertyActions.length; i++) {
@ -58,7 +47,6 @@ SequentialAnimation {
} }
} }
// Fade in and scale up
ParallelAnimation { ParallelAnimation {
NumberAnimation { NumberAnimation {
target: root.target target: root.target

View file

@ -15,19 +15,14 @@ RowLayout {
property Component leftContent: null property Component leftContent: null
property Component rightContent: null property Component rightContent: null
// Left pane configuration
property real leftWidthRatio: 0.4 property real leftWidthRatio: 0.4
property int leftMinimumWidth: 420 property int leftMinimumWidth: 420
property var leftLoaderProperties: ({}) property var leftLoaderProperties: ({})
// Right pane configuration
property var rightLoaderProperties: ({}) property var rightLoaderProperties: ({})
// Expose loaders for customization (access via splitLayout.leftLoader or splitLayout.rightLoader)
property alias leftLoader: leftLoader property alias leftLoader: leftLoader
property alias rightLoader: rightLoader property alias rightLoader: rightLoader
// Left pane
Item { Item {
id: leftPane id: leftPane
@ -57,7 +52,6 @@ RowLayout {
asynchronous: true asynchronous: true
sourceComponent: root.leftContent sourceComponent: root.leftContent
// Apply any additional properties from leftLoaderProperties
Component.onCompleted: { Component.onCompleted: {
for (const key in root.leftLoaderProperties) { for (const key in root.leftLoaderProperties) {
leftLoader[key] = root.leftLoaderProperties[key]; leftLoader[key] = root.leftLoaderProperties[key];
@ -74,7 +68,6 @@ RowLayout {
} }
} }
// Right pane
Item { Item {
id: rightPane id: rightPane
@ -101,7 +94,6 @@ RowLayout {
asynchronous: true asynchronous: true
sourceComponent: root.rightContent sourceComponent: root.rightContent
// Apply any additional properties from rightLoaderProperties
Component.onCompleted: { Component.onCompleted: {
for (const key in root.rightLoaderProperties) { for (const key in root.rightLoaderProperties) {
rightLoader[key] = root.rightLoaderProperties[key]; rightLoader[key] = root.rightLoaderProperties[key];

View file

@ -19,7 +19,6 @@ Item {
property var activeItem: null property var activeItem: null
property var paneIdGenerator: function(item) { return item ? String(item) : ""; } property var paneIdGenerator: function(item) { return item ? String(item) : ""; }
// Optional: Additional component to overlay on top (e.g., password dialogs)
property Component overlayComponent: null property Component overlayComponent: null
SplitPaneLayout { SplitPaneLayout {
@ -82,7 +81,6 @@ Item {
} }
} }
// Overlay component (e.g., password dialogs)
Loader { Loader {
id: overlayLoader id: overlayLoader

View file

@ -62,26 +62,20 @@ Item {
const appId = root.selectedApp.id || root.selectedApp.entry?.id; const appId = root.selectedApp.id || root.selectedApp.entry?.id;
// Create a new array to ensure change detection
const hiddenApps = Config.launcher.hiddenApps ? [...Config.launcher.hiddenApps] : []; const hiddenApps = Config.launcher.hiddenApps ? [...Config.launcher.hiddenApps] : [];
if (isHidden) { if (isHidden) {
// Add to hiddenApps if not already there
if (!hiddenApps.includes(appId)) { if (!hiddenApps.includes(appId)) {
hiddenApps.push(appId); hiddenApps.push(appId);
} }
} else { } else {
// Remove from hiddenApps
const index = hiddenApps.indexOf(appId); const index = hiddenApps.indexOf(appId);
if (index !== -1) { if (index !== -1) {
hiddenApps.splice(index, 1); hiddenApps.splice(index, 1);
} }
} }
// Update Config
Config.launcher.hiddenApps = hiddenApps; Config.launcher.hiddenApps = hiddenApps;
// Persist changes to disk
Config.save(); Config.save();
} }
@ -90,15 +84,13 @@ Item {
id: allAppsDb id: allAppsDb
path: `${Paths.state}/apps.sqlite` path: `${Paths.state}/apps.sqlite`
entries: DesktopEntries.applications.values // No filter - show all apps entries: DesktopEntries.applications.values
} }
property string searchText: "" property string searchText: ""
function filterApps(search: string): list<var> { function filterApps(search: string): list<var> {
// If search is empty, return all apps directly
if (!search || search.trim() === "") { if (!search || search.trim() === "") {
// Convert QQmlListProperty to array
const apps = []; const apps = [];
for (let i = 0; i < allAppsDb.apps.length; i++) { for (let i = 0; i < allAppsDb.apps.length; i++) {
apps.push(allAppsDb.apps[i]); apps.push(allAppsDb.apps[i]);
@ -110,7 +102,6 @@ Item {
return []; return [];
} }
// Prepare apps for fuzzy search
const preparedApps = []; const preparedApps = [];
for (let i = 0; i < allAppsDb.apps.length; i++) { for (let i = 0; i < allAppsDb.apps.length; i++) {
const app = allAppsDb.apps[i]; const app = allAppsDb.apps[i];
@ -121,14 +112,12 @@ Item {
}); });
} }
// Perform fuzzy search
const results = Fuzzy.go(search, preparedApps, { const results = Fuzzy.go(search, preparedApps, {
all: true, all: true,
keys: ["name"], keys: ["name"],
scoreFn: r => r[0].score scoreFn: r => r[0].score
}); });
// Return sorted by score (highest first)
return results return results
.sort((a, b) => b._score - a._score) .sort((a, b) => b._score - a._score)
.map(r => r.obj._item); .map(r => r.obj._item);
@ -192,7 +181,6 @@ Item {
if (root.session.launcher.active) { if (root.session.launcher.active) {
root.session.launcher.active = null; root.session.launcher.active = null;
} else { } else {
// Toggle to show settings - if there are apps, select the first one, otherwise show settings
if (root.filteredApps.length > 0) { if (root.filteredApps.length > 0) {
root.session.launcher.active = root.filteredApps[0]; root.session.launcher.active = root.filteredApps[0];
} }
@ -302,13 +290,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
asynchronous: true asynchronous: true
active: { active: true
// Lazy load: activate when left pane is loaded
// The ListView will load asynchronously, and search will work because filteredApps
// is updated regardless of whether the ListView is loaded
// Access loader through parent - this will be set when component loads
return true;
}
sourceComponent: StyledListView { sourceComponent: StyledListView {
id: appsListView id: appsListView
@ -418,11 +400,9 @@ Item {
sourceComponent: rightLauncherPane.targetComponent sourceComponent: rightLauncherPane.targetComponent
active: true active: true
// Expose displayedApp to loaded components
property var displayedApp: rightLauncherPane.displayedApp property var displayedApp: rightLauncherPane.displayedApp
onItemChanged: { onItemChanged: {
// Ensure displayedApp is set when item is created (for async loading)
if (item && rightLauncherPane.pane && rightLauncherPane.displayedApp !== rightLauncherPane.pane) { if (item && rightLauncherPane.pane && rightLauncherPane.displayedApp !== rightLauncherPane.pane) {
rightLauncherPane.displayedApp = rightLauncherPane.pane; rightLauncherPane.displayedApp = rightLauncherPane.pane;
} }
@ -508,12 +488,10 @@ Item {
id: appDetailsLayout id: appDetailsLayout
anchors.fill: parent anchors.fill: parent
// Get displayedApp from parent Loader (the Loader has displayedApp property we set)
readonly property var displayedApp: parent && parent.displayedApp !== undefined ? parent.displayedApp : null readonly property var displayedApp: parent && parent.displayedApp !== undefined ? parent.displayedApp : null
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
// Show SettingsHeader when no app is selected, or show app icon + title when app is selected
SettingsHeader { SettingsHeader {
Layout.leftMargin: Appearance.padding.large * 2 Layout.leftMargin: Appearance.padding.large * 2
Layout.rightMargin: Appearance.padding.large * 2 Layout.rightMargin: Appearance.padding.large * 2
@ -523,7 +501,6 @@ Item {
title: qsTr("Launcher Applications") title: qsTr("Launcher Applications")
} }
// App icon and title display (shown when app is selected)
Item { Item {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.leftMargin: Appearance.padding.large * 2 Layout.leftMargin: Appearance.padding.large * 2

View file

@ -45,7 +45,6 @@ Item {
anchors.right: parent.right anchors.right: parent.right
spacing: Appearance.spacing.normal spacing: Appearance.spacing.normal
// Network header above the collapsible sections
RowLayout { RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
spacing: Appearance.spacing.smaller spacing: Appearance.spacing.smaller
@ -102,7 +101,6 @@ Item {
root.session.ethernet.active = null; root.session.ethernet.active = null;
root.session.network.active = null; root.session.network.active = null;
} else { } else {
// Toggle to show settings - prefer ethernet if available, otherwise wireless
if (Nmcli.ethernetDevices.length > 0) { if (Nmcli.ethernetDevices.length > 0) {
root.session.ethernet.active = Nmcli.ethernetDevices[0]; root.session.ethernet.active = Nmcli.ethernetDevices[0];
} else if (Nmcli.networks.length > 0) { } else if (Nmcli.networks.length > 0) {

View file

@ -27,7 +27,6 @@ DeviceDetails {
} }
onNetworkChanged: { onNetworkChanged: {
// Restart timer when network changes
connectionUpdateTimer.stop(); connectionUpdateTimer.stop();
if (network && network.ssid) { if (network && network.ssid) {
connectionUpdateTimer.start(); connectionUpdateTimer.start();
@ -48,11 +47,9 @@ DeviceDetails {
updateDeviceDetails(); updateDeviceDetails();
} }
function onWirelessDeviceDetailsChanged() { function onWirelessDeviceDetailsChanged() {
// When details are updated, check if we should stop the timer
if (network && network.ssid) { if (network && network.ssid) {
const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid);
if (isActive && Nmcli.wirelessDeviceDetails && Nmcli.wirelessDeviceDetails !== null) { if (isActive && Nmcli.wirelessDeviceDetails && Nmcli.wirelessDeviceDetails !== null) {
// We have details for the active network, stop the timer
connectionUpdateTimer.stop(); connectionUpdateTimer.stop();
} }
} }
@ -65,22 +62,16 @@ DeviceDetails {
repeat: true repeat: true
running: network && network.ssid running: network && network.ssid
onTriggered: { onTriggered: {
// Periodically check if network becomes active and update details
if (network) { if (network) {
const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid); const isActive = network.active || (Nmcli.active && Nmcli.active.ssid === network.ssid);
if (isActive) { if (isActive) {
// Network is active - check if we have details
if (!Nmcli.wirelessDeviceDetails || Nmcli.wirelessDeviceDetails === null) { if (!Nmcli.wirelessDeviceDetails || Nmcli.wirelessDeviceDetails === null) {
// Network is active but we don't have details yet, fetch them
Nmcli.getWirelessDeviceDetails("", () => { Nmcli.getWirelessDeviceDetails("", () => {
// After fetching, check if we got details - if not, timer will try again
}); });
} else { } else {
// We have details, can stop the timer
connectionUpdateTimer.stop(); connectionUpdateTimer.stop();
} }
} else { } else {
// Network is not active, clear details
if (Nmcli.wirelessDeviceDetails !== null) { if (Nmcli.wirelessDeviceDetails !== null) {
Nmcli.wirelessDeviceDetails = null; Nmcli.wirelessDeviceDetails = null;
} }

View file

@ -33,10 +33,8 @@ DeviceList {
model: ScriptModel { model: ScriptModel {
values: [...Nmcli.networks].sort((a, b) => { values: [...Nmcli.networks].sort((a, b) => {
// Put active/connected network first
if (a.active !== b.active) if (a.active !== b.active)
return b.active - a.active; return b.active - a.active;
// Then sort by signal strength
return b.strength - a.strength; return b.strength - a.strength;
}) })
} }
@ -114,7 +112,6 @@ DeviceList {
StateLayer { StateLayer {
function onClicked(): void { function onClicked(): void {
root.session.network.active = modelData; root.session.network.active = modelData;
// Check if we need to refresh saved connections when selecting a network
if (modelData && modelData.ssid) { if (modelData && modelData.ssid) {
root.checkSavedProfileForNetwork(modelData.ssid); root.checkSavedProfileForNetwork(modelData.ssid);
} }

View file

@ -19,7 +19,6 @@ Item {
required property Session session required property Session session
readonly property var network: { readonly property var network: {
// Prefer pendingNetwork, then active network
if (session.network.pendingNetwork) { if (session.network.pendingNetwork) {
return session.network.pendingNetwork; return session.network.pendingNetwork;
} }
@ -157,12 +156,10 @@ Item {
focus: true focus: true
Keys.onPressed: event => { Keys.onPressed: event => {
// Ensure we have focus when receiving keyboard input
if (!activeFocus) { if (!activeFocus) {
forceActiveFocus(); forceActiveFocus();
} }
// Clear error when user starts typing
if (connectButton.hasError && event.text && event.text.length > 0) { if (connectButton.hasError && event.text && event.text.length > 0) {
connectButton.hasError = false; connectButton.hasError = false;
} }
@ -191,7 +188,6 @@ Item {
target: root.session.network target: root.session.network
function onShowPasswordDialogChanged(): void { function onShowPasswordDialogChanged(): void {
if (root.session.network.showPasswordDialog) { if (root.session.network.showPasswordDialog) {
// Use callLater to ensure focus happens after dialog is fully rendered
Qt.callLater(() => { Qt.callLater(() => {
passwordContainer.forceActiveFocus(); passwordContainer.forceActiveFocus();
passwordContainer.passwordBuffer = ""; passwordContainer.passwordBuffer = "";
@ -205,7 +201,6 @@ Item {
target: root target: root
function onVisibleChanged(): void { function onVisibleChanged(): void {
if (root.visible) { if (root.visible) {
// Use callLater to ensure focus happens after dialog is fully rendered
Qt.callLater(() => { Qt.callLater(() => {
passwordContainer.forceActiveFocus(); passwordContainer.forceActiveFocus();
}); });
@ -383,46 +378,36 @@ Item {
return; return;
} }
// Clear any previous error
hasError = false; hasError = false;
// Set connecting state
connecting = true; connecting = true;
enabled = false; enabled = false;
text = qsTr("Connecting..."); text = qsTr("Connecting...");
// Connect to network
NetworkConnection.connectWithPassword(root.network, password, result => { NetworkConnection.connectWithPassword(root.network, password, result => {
if (result && result.success) if (result && result.success) {
// Connection successful, monitor will handle the rest } else if (result && result.needsPassword) {
{} else if (result && result.needsPassword) {
// Shouldn't happen since we provided password
connectionMonitor.stop(); connectionMonitor.stop();
connecting = false; connecting = false;
hasError = true; hasError = true;
enabled = true; enabled = true;
text = qsTr("Connect"); text = qsTr("Connect");
passwordContainer.passwordBuffer = ""; passwordContainer.passwordBuffer = "";
// Delete the failed connection
if (root.network && root.network.ssid) { if (root.network && root.network.ssid) {
Nmcli.forgetNetwork(root.network.ssid); Nmcli.forgetNetwork(root.network.ssid);
} }
} else { } else {
// Connection failed immediately - show error
connectionMonitor.stop(); connectionMonitor.stop();
connecting = false; connecting = false;
hasError = true; hasError = true;
enabled = true; enabled = true;
text = qsTr("Connect"); text = qsTr("Connect");
passwordContainer.passwordBuffer = ""; passwordContainer.passwordBuffer = "";
// Delete the failed connection
if (root.network && root.network.ssid) { if (root.network && root.network.ssid) {
Nmcli.forgetNetwork(root.network.ssid); Nmcli.forgetNetwork(root.network.ssid);
} }
} }
}); });
// Start monitoring connection
connectionMonitor.start(); connectionMonitor.start();
} }
} }
@ -435,19 +420,14 @@ Item {
return; return;
} }
// Check if we're connected to the target network (case-insensitive SSID comparison)
const isConnected = root.network && Nmcli.active && Nmcli.active.ssid && Nmcli.active.ssid.toLowerCase().trim() === root.network.ssid.toLowerCase().trim(); const isConnected = root.network && Nmcli.active && Nmcli.active.ssid && Nmcli.active.ssid.toLowerCase().trim() === root.network.ssid.toLowerCase().trim();
if (isConnected) { if (isConnected) {
// Successfully connected - give it a moment for network list to update
// Use Timer for actual delay
connectionSuccessTimer.start(); connectionSuccessTimer.start();
return; return;
} }
// Check for connection failures - if pending connection was cleared but we're not connected
if (Nmcli.pendingConnection === null && connectButton.connecting) { if (Nmcli.pendingConnection === null && connectButton.connecting) {
// Wait a bit more before giving up (allow time for connection to establish)
if (connectionMonitor.repeatCount > 10) { if (connectionMonitor.repeatCount > 10) {
connectionMonitor.stop(); connectionMonitor.stop();
connectButton.connecting = false; connectButton.connecting = false;
@ -455,7 +435,6 @@ Item {
connectButton.enabled = true; connectButton.enabled = true;
connectButton.text = qsTr("Connect"); connectButton.text = qsTr("Connect");
passwordContainer.passwordBuffer = ""; passwordContainer.passwordBuffer = "";
// Delete the failed connection
if (root.network && root.network.ssid) { if (root.network && root.network.ssid) {
Nmcli.forgetNetwork(root.network.ssid); Nmcli.forgetNetwork(root.network.ssid);
} }
@ -486,7 +465,6 @@ Item {
id: connectionSuccessTimer id: connectionSuccessTimer
interval: 500 interval: 500
onTriggered: { onTriggered: {
// Double-check connection is still active
if (root.visible && Nmcli.active && Nmcli.active.ssid) { if (root.visible && Nmcli.active && Nmcli.active.ssid) {
const stillConnected = Nmcli.active.ssid.toLowerCase().trim() === root.network.ssid.toLowerCase().trim(); const stillConnected = Nmcli.active.ssid.toLowerCase().trim() === root.network.ssid.toLowerCase().trim();
if (stillConnected) { if (stillConnected) {
@ -514,7 +492,6 @@ Item {
connectButton.enabled = true; connectButton.enabled = true;
connectButton.text = qsTr("Connect"); connectButton.text = qsTr("Connect");
passwordContainer.passwordBuffer = ""; passwordContainer.passwordBuffer = "";
// Delete the failed connection
Nmcli.forgetNetwork(ssid); Nmcli.forgetNetwork(ssid);
} }
} }

View file

@ -4,13 +4,8 @@ import QtQuick
QtObject { QtObject {
id: root id: root
// Active selected device
property BluetoothDevice active: null property BluetoothDevice active: null
// Current adapter being used
property BluetoothAdapter currentAdapter: Bluetooth.defaultAdapter property BluetoothAdapter currentAdapter: Bluetooth.defaultAdapter
// UI state flags
property bool editingAdapterName: false property bool editingAdapterName: false
property bool fabMenuOpen: false property bool fabMenuOpen: false
property bool editingDeviceName: false property bool editingDeviceName: false

View file

@ -3,7 +3,6 @@ import QtQuick
QtObject { QtObject {
id: root id: root
// Active selected ethernet interface
property var active: null property var active: null
} }

View file

@ -3,7 +3,6 @@ import QtQuick
QtObject { QtObject {
id: root id: root
// Active selected application
property var active: null property var active: null
} }

View file

@ -3,10 +3,7 @@ import QtQuick
QtObject { QtObject {
id: root id: root
// Active selected wireless network
property var active: null property var active: null
// Password dialog state
property bool showPasswordDialog: false property bool showPasswordDialog: false
property var pendingNetwork: null property var pendingNetwork: null
} }

View file

@ -18,15 +18,10 @@ Item {
required property Session session required property Session session
// Clock
property bool clockShowIcon: Config.bar.clock.showIcon ?? true property bool clockShowIcon: Config.bar.clock.showIcon ?? true
// Bar Behavior
property bool persistent: Config.bar.persistent ?? true property bool persistent: Config.bar.persistent ?? true
property bool showOnHover: Config.bar.showOnHover ?? true property bool showOnHover: Config.bar.showOnHover ?? true
property int dragThreshold: Config.bar.dragThreshold ?? 20 property int dragThreshold: Config.bar.dragThreshold ?? 20
// Status Icons
property bool showAudio: Config.bar.status.showAudio ?? true property bool showAudio: Config.bar.status.showAudio ?? true
property bool showMicrophone: Config.bar.status.showMicrophone ?? true property bool showMicrophone: Config.bar.status.showMicrophone ?? true
property bool showKbLayout: Config.bar.status.showKbLayout ?? false property bool showKbLayout: Config.bar.status.showKbLayout ?? false
@ -34,25 +29,17 @@ Item {
property bool showBluetooth: Config.bar.status.showBluetooth ?? true property bool showBluetooth: Config.bar.status.showBluetooth ?? true
property bool showBattery: Config.bar.status.showBattery ?? true property bool showBattery: Config.bar.status.showBattery ?? true
property bool showLockStatus: Config.bar.status.showLockStatus ?? true property bool showLockStatus: Config.bar.status.showLockStatus ?? true
// Tray Settings
property bool trayBackground: Config.bar.tray.background ?? false property bool trayBackground: Config.bar.tray.background ?? false
property bool trayCompact: Config.bar.tray.compact ?? false property bool trayCompact: Config.bar.tray.compact ?? false
property bool trayRecolour: Config.bar.tray.recolour ?? false property bool trayRecolour: Config.bar.tray.recolour ?? false
// Workspaces
property int workspacesShown: Config.bar.workspaces.shown ?? 5 property int workspacesShown: Config.bar.workspaces.shown ?? 5
property bool workspacesActiveIndicator: Config.bar.workspaces.activeIndicator ?? true property bool workspacesActiveIndicator: Config.bar.workspaces.activeIndicator ?? true
property bool workspacesOccupiedBg: Config.bar.workspaces.occupiedBg ?? false property bool workspacesOccupiedBg: Config.bar.workspaces.occupiedBg ?? false
property bool workspacesShowWindows: Config.bar.workspaces.showWindows ?? false property bool workspacesShowWindows: Config.bar.workspaces.showWindows ?? false
property bool workspacesPerMonitor: Config.bar.workspaces.perMonitorWorkspaces ?? true property bool workspacesPerMonitor: Config.bar.workspaces.perMonitorWorkspaces ?? true
// Scroll Actions
property bool scrollWorkspaces: Config.bar.scrollActions.workspaces ?? true property bool scrollWorkspaces: Config.bar.scrollActions.workspaces ?? true
property bool scrollVolume: Config.bar.scrollActions.volume ?? true property bool scrollVolume: Config.bar.scrollActions.volume ?? true
property bool scrollBrightness: Config.bar.scrollActions.brightness ?? true property bool scrollBrightness: Config.bar.scrollActions.brightness ?? true
// Popouts
property bool popoutActiveWindow: Config.bar.popouts.activeWindow ?? true property bool popoutActiveWindow: Config.bar.popouts.activeWindow ?? true
property bool popoutTray: Config.bar.popouts.tray ?? true property bool popoutTray: Config.bar.popouts.tray ?? true
property bool popoutStatusIcons: Config.bar.popouts.statusIcons ?? true property bool popoutStatusIcons: Config.bar.popouts.statusIcons ?? true
@ -60,7 +47,6 @@ Item {
anchors.fill: parent anchors.fill: parent
Component.onCompleted: { Component.onCompleted: {
// Update entries
if (Config.bar.entries) { if (Config.bar.entries) {
entriesModel.clear(); entriesModel.clear();
for (let i = 0; i < Config.bar.entries.length; i++) { for (let i = 0; i < Config.bar.entries.length; i++) {
@ -74,15 +60,10 @@ Item {
} }
function saveConfig(entryIndex, entryEnabled) { function saveConfig(entryIndex, entryEnabled) {
// Update clock setting
Config.bar.clock.showIcon = root.clockShowIcon; Config.bar.clock.showIcon = root.clockShowIcon;
// Update bar behavior
Config.bar.persistent = root.persistent; Config.bar.persistent = root.persistent;
Config.bar.showOnHover = root.showOnHover; Config.bar.showOnHover = root.showOnHover;
Config.bar.dragThreshold = root.dragThreshold; Config.bar.dragThreshold = root.dragThreshold;
// Update status icons
Config.bar.status.showAudio = root.showAudio; Config.bar.status.showAudio = root.showAudio;
Config.bar.status.showMicrophone = root.showMicrophone; Config.bar.status.showMicrophone = root.showMicrophone;
Config.bar.status.showKbLayout = root.showKbLayout; Config.bar.status.showKbLayout = root.showKbLayout;
@ -90,35 +71,24 @@ Item {
Config.bar.status.showBluetooth = root.showBluetooth; Config.bar.status.showBluetooth = root.showBluetooth;
Config.bar.status.showBattery = root.showBattery; Config.bar.status.showBattery = root.showBattery;
Config.bar.status.showLockStatus = root.showLockStatus; Config.bar.status.showLockStatus = root.showLockStatus;
// Update tray settings
Config.bar.tray.background = root.trayBackground; Config.bar.tray.background = root.trayBackground;
Config.bar.tray.compact = root.trayCompact; Config.bar.tray.compact = root.trayCompact;
Config.bar.tray.recolour = root.trayRecolour; Config.bar.tray.recolour = root.trayRecolour;
// Update workspaces
Config.bar.workspaces.shown = root.workspacesShown; Config.bar.workspaces.shown = root.workspacesShown;
Config.bar.workspaces.activeIndicator = root.workspacesActiveIndicator; Config.bar.workspaces.activeIndicator = root.workspacesActiveIndicator;
Config.bar.workspaces.occupiedBg = root.workspacesOccupiedBg; Config.bar.workspaces.occupiedBg = root.workspacesOccupiedBg;
Config.bar.workspaces.showWindows = root.workspacesShowWindows; Config.bar.workspaces.showWindows = root.workspacesShowWindows;
Config.bar.workspaces.perMonitorWorkspaces = root.workspacesPerMonitor; Config.bar.workspaces.perMonitorWorkspaces = root.workspacesPerMonitor;
// Update scroll actions
Config.bar.scrollActions.workspaces = root.scrollWorkspaces; Config.bar.scrollActions.workspaces = root.scrollWorkspaces;
Config.bar.scrollActions.volume = root.scrollVolume; Config.bar.scrollActions.volume = root.scrollVolume;
Config.bar.scrollActions.brightness = root.scrollBrightness; Config.bar.scrollActions.brightness = root.scrollBrightness;
// Update popouts
Config.bar.popouts.activeWindow = root.popoutActiveWindow; Config.bar.popouts.activeWindow = root.popoutActiveWindow;
Config.bar.popouts.tray = root.popoutTray; Config.bar.popouts.tray = root.popoutTray;
Config.bar.popouts.statusIcons = root.popoutStatusIcons; Config.bar.popouts.statusIcons = root.popoutStatusIcons;
// Update entries from the model (same approach as clock - use provided value if available)
const entries = []; const entries = [];
for (let i = 0; i < entriesModel.count; i++) { for (let i = 0; i < entriesModel.count; i++) {
const entry = entriesModel.get(i); const entry = entriesModel.get(i);
// If this is the entry being updated, use the provided value (same as clock toggle reads from switch)
// Otherwise use the value from the model
let enabled = entry.enabled; let enabled = entry.enabled;
if (entryIndex !== undefined && i === entryIndex) { if (entryIndex !== undefined && i === entryIndex) {
enabled = entryEnabled; enabled = entryEnabled;
@ -129,8 +99,6 @@ Item {
}); });
} }
Config.bar.entries = entries; Config.bar.entries = entries;
// Persist changes to disk
Config.save(); Config.save();
} }