Skip to content

Commit eda60d9

Browse files
committed
feat: handle tab navigation in category
1 parent 25b17dc commit eda60d9

4 files changed

Lines changed: 376 additions & 79 deletions

File tree

modules/nexus/ContentArea.qml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,10 @@ Item {
128128
radius: Appearance.rounding.small
129129
color: "transparent"
130130

131-
onXChanged: if (tabItem.index === root.activeTabIndex) tabIndicator.targetX = tabItem.x
132-
onWidthChanged: if (tabItem.index === root.activeTabIndex) tabIndicator.targetWidth = tabItem.width
131+
onXChanged: if (tabItem.index === root.activeTabIndex)
132+
tabIndicator.targetX = tabItem.x
133+
onWidthChanged: if (tabItem.index === root.activeTabIndex)
134+
tabIndicator.targetWidth = tabItem.width
133135

134136
StyledText {
135137
id: tabLabel
@@ -200,26 +202,33 @@ Item {
200202
anchors.fill: parent
201203
asynchronous: true
202204

203-
source: root.activeConfig ? "panels/" + root.activeConfig.id.charAt(0).toUpperCase() + root.activeConfig.id.slice(1) + "Panel.qml" : ""
205+
readonly property string targetSource: root.activeConfig ? "panels/" + root.activeConfig.id.charAt(0).toUpperCase() + root.activeConfig.id.slice(1) + "Panel.qml" : ""
206+
property string resolvedSource: targetSource
207+
208+
source: resolvedSource
209+
210+
onTargetSourceChanged: resolvedSource = targetSource
204211

205212
onStatusChanged: {
206-
if (status === Loader.Error) {
207-
source = "panels/PlaceholderPanel.qml";
213+
if (status === Loader.Error && resolvedSource !== "panels/PlaceholderPanel.qml") {
214+
Qt.callLater(() => {
215+
resolvedSource = "panels/PlaceholderPanel.qml";
216+
});
208217
}
209218
}
210219

211-
onSourceChanged: {
212-
if (item && item.hasOwnProperty("activeTab")) {
213-
item.activeTab = root.tabs[root.activeTabIndex] || "";
220+
onLoaded: {
221+
if (item && item.hasOwnProperty("activeTabIndex")) {
222+
item.activeTabIndex = root.activeTabIndex;
214223
}
215224
}
216225
}
217226

218227
Connections {
219228
target: root
220229
function onActiveTabIndexChanged() {
221-
if (panelLoader.item && panelLoader.item.hasOwnProperty("activeTab")) {
222-
panelLoader.item.activeTab = root.tabs[root.activeTabIndex] || "";
230+
if (panelLoader.item && panelLoader.item.hasOwnProperty("activeTabIndex")) {
231+
panelLoader.item.activeTabIndex = root.activeTabIndex;
223232
}
224233
}
225234
}

modules/nexus/NexusRegistry.qml

Lines changed: 235 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -264,62 +264,242 @@ QtObject {
264264

265265
readonly property var settingDefinitions: [
266266
// Appearance
267-
{ label: "Theme Mode", category: "appearance", tab: "Wallpaper & Scheme", keywords: ["theme", "dark", "light", "auto", "mode"] },
268-
{ label: "Color Scheme", category: "appearance", tab: "Wallpaper & Scheme", keywords: ["color", "scheme", "catppuccin", "everforest", "nord", "gruvbox"] },
269-
{ label: "Wallpaper", category: "appearance", tab: "Wallpaper & Scheme", keywords: ["wallpaper", "background", "desktop", "image"] },
270-
{ label: "UI Font", category: "appearance", tab: "Typography & Motion", keywords: ["font", "typography", "text", "roboto"] },
271-
{ label: "Animation Speed", category: "appearance", tab: "Typography & Motion", keywords: ["animation", "speed", "motion"] },
272-
{ label: "Window Shadows", category: "appearance", tab: "Effects", keywords: ["shadow", "window", "effect"] },
273-
{ label: "Corner Rounding", category: "appearance", tab: "Effects", keywords: ["corner", "rounding", "radius"] },
267+
{
268+
label: "Theme Mode",
269+
category: "appearance",
270+
tab: "Wallpaper & Scheme",
271+
keywords: ["theme", "dark", "light", "auto", "mode"]
272+
},
273+
{
274+
label: "Color Scheme",
275+
category: "appearance",
276+
tab: "Wallpaper & Scheme",
277+
keywords: ["color", "scheme", "catppuccin", "everforest", "nord", "gruvbox"]
278+
},
279+
{
280+
label: "Wallpaper",
281+
category: "appearance",
282+
tab: "Wallpaper & Scheme",
283+
keywords: ["wallpaper", "background", "desktop", "image"]
284+
},
285+
{
286+
label: "UI Font",
287+
category: "appearance",
288+
tab: "Typography & Motion",
289+
keywords: ["font", "typography", "text", "roboto"]
290+
},
291+
{
292+
label: "Animation Speed",
293+
category: "appearance",
294+
tab: "Typography & Motion",
295+
keywords: ["animation", "speed", "motion"]
296+
},
297+
{
298+
label: "Window Shadows",
299+
category: "appearance",
300+
tab: "Effects",
301+
keywords: ["shadow", "window", "effect"]
302+
},
303+
{
304+
label: "Corner Rounding",
305+
category: "appearance",
306+
tab: "Effects",
307+
keywords: ["corner", "rounding", "radius"]
308+
},
274309

275310
// Taskbar
276-
{ label: "Taskbar Auto-hide", category: "taskbar", tab: "General", keywords: ["taskbar", "auto", "hide", "autohide"] },
277-
{ label: "Workspace Indicator", category: "taskbar", tab: "Workspaces", keywords: ["workspace", "indicator", "taskbar"] },
278-
{ label: "Status Icons", category: "taskbar", tab: "Systray & Status", keywords: ["status", "icons", "tray", "system"] },
311+
{
312+
label: "Taskbar Auto-hide",
313+
category: "taskbar",
314+
tab: "General",
315+
keywords: ["taskbar", "auto", "hide", "autohide"]
316+
},
317+
{
318+
label: "Workspace Indicator",
319+
category: "taskbar",
320+
tab: "Workspaces",
321+
keywords: ["workspace", "indicator", "taskbar"]
322+
},
323+
{
324+
label: "Status Icons",
325+
category: "taskbar",
326+
tab: "Systray & Status",
327+
keywords: ["status", "icons", "tray", "system"]
328+
},
279329

280330
// Launcher
281-
{ label: "Launcher Enabled", category: "launcher", tab: "General", keywords: ["launcher", "enabled", "toggle"] },
282-
{ label: "Launcher Apps", category: "launcher", tab: "General", keywords: ["launcher", "apps", "applications"] },
283-
{ label: "Favorite Apps", category: "launcher", tab: "Applications", keywords: ["favorite", "apps", "pin", "starred"] },
284-
{ label: "Actions", category: "launcher", tab: "Actions", keywords: ["actions", "special", "commands", "calculator"] },
331+
{
332+
label: "Launcher Enabled",
333+
category: "launcher",
334+
tab: "General",
335+
keywords: ["launcher", "enabled", "toggle"]
336+
},
337+
{
338+
label: "Launcher Apps",
339+
category: "launcher",
340+
tab: "General",
341+
keywords: ["launcher", "apps", "applications"]
342+
},
343+
{
344+
label: "Favorite Apps",
345+
category: "launcher",
346+
tab: "Applications",
347+
keywords: ["favorite", "apps", "pin", "starred"]
348+
},
349+
{
350+
label: "Actions",
351+
category: "launcher",
352+
tab: "Actions",
353+
keywords: ["actions", "special", "commands", "calculator"]
354+
},
285355

286356
// Dashboard
287-
{ label: "Widget Management", category: "dashboard", tab: "Dashboard", keywords: ["widget", "manage", "dashboard"] },
288-
{ label: "Media Widget", category: "dashboard", tab: "Media", keywords: ["media", "player", "music", "album"] },
289-
{ label: "System Monitor", category: "dashboard", tab: "Performance", keywords: ["system", "monitor", "cpu", "ram"] },
290-
{ label: "Weather Widget", category: "dashboard", tab: "Weather", keywords: ["weather", "temperature", "forecast"] },
357+
{
358+
label: "Widget Management",
359+
category: "dashboard",
360+
tab: "Dashboard",
361+
keywords: ["widget", "manage", "dashboard"]
362+
},
363+
{
364+
label: "Media Widget",
365+
category: "dashboard",
366+
tab: "Media",
367+
keywords: ["media", "player", "music", "album"]
368+
},
369+
{
370+
label: "System Monitor",
371+
category: "dashboard",
372+
tab: "Performance",
373+
keywords: ["system", "monitor", "cpu", "ram"]
374+
},
375+
{
376+
label: "Weather Widget",
377+
category: "dashboard",
378+
tab: "Weather",
379+
keywords: ["weather", "temperature", "forecast"]
380+
},
291381

292382
// Display
293-
{ label: "Display Resolution", category: "display", tab: "General", keywords: ["display", "monitor", "resolution", "refresh"] },
294-
{ label: "Night Light", category: "display", tab: "Night Light", keywords: ["night", "light", "blue", "eye", "temperature"] },
383+
{
384+
label: "Display Resolution",
385+
category: "display",
386+
tab: "General",
387+
keywords: ["display", "monitor", "resolution", "refresh"]
388+
},
389+
{
390+
label: "Night Light",
391+
category: "display",
392+
tab: "Night Light",
393+
keywords: ["night", "light", "blue", "eye", "temperature"]
394+
},
295395

296396
// Network
297-
{ label: "Wi-Fi Settings", category: "network", tab: "Wireless", keywords: ["wifi", "wireless", "network", "connect"] },
298-
{ label: "Ethernet Settings", category: "network", tab: "Ethernet", keywords: ["ethernet", "wired", "lan"] },
299-
{ label: "VPN Connections", category: "network", tab: "VPN", keywords: ["vpn", "wireguard", "tunnel", "privacy"] },
397+
{
398+
label: "Wi-Fi Settings",
399+
category: "network",
400+
tab: "Wireless",
401+
keywords: ["wifi", "wireless", "network", "connect"]
402+
},
403+
{
404+
label: "Ethernet Settings",
405+
category: "network",
406+
tab: "Ethernet",
407+
keywords: ["ethernet", "wired", "lan"]
408+
},
409+
{
410+
label: "VPN Connections",
411+
category: "network",
412+
tab: "VPN",
413+
keywords: ["vpn", "wireguard", "tunnel", "privacy"]
414+
},
300415

301416
// Audio
302-
{ label: "Audio Output", category: "audio", tab: "Output & Input", keywords: ["audio", "output", "speaker", "headphone", "volume"] },
303-
{ label: "Microphone", category: "audio", tab: "Output & Input", keywords: ["audio", "input", "microphone", "mic"] },
304-
{ label: "Per-App Volume", category: "audio", tab: "Applications", keywords: ["application", "volume", "per", "app", "mixer"] },
417+
{
418+
label: "Audio Output",
419+
category: "audio",
420+
tab: "Output & Input",
421+
keywords: ["audio", "output", "speaker", "headphone", "volume"]
422+
},
423+
{
424+
label: "Microphone",
425+
category: "audio",
426+
tab: "Output & Input",
427+
keywords: ["audio", "input", "microphone", "mic"]
428+
},
429+
{
430+
label: "Per-App Volume",
431+
category: "audio",
432+
tab: "Applications",
433+
keywords: ["application", "volume", "per", "app", "mixer"]
434+
},
305435

306436
// Bluetooth
307-
{ label: "Bluetooth Devices", category: "bluetooth", tab: "Devices", keywords: ["bluetooth", "device", "pair", "connect"] },
308-
{ label: "Bluetooth Settings", category: "bluetooth", tab: "Settings", keywords: ["bluetooth", "discoverable", "codec"] },
437+
{
438+
label: "Bluetooth Devices",
439+
category: "bluetooth",
440+
tab: "Devices",
441+
keywords: ["bluetooth", "device", "pair", "connect"]
442+
},
443+
{
444+
label: "Bluetooth Settings",
445+
category: "bluetooth",
446+
tab: "Settings",
447+
keywords: ["bluetooth", "discoverable", "codec"]
448+
},
309449

310450
// Power
311-
{ label: "Power Mode", category: "power", tab: "Power Modes & Inhibit", keywords: ["power", "mode", "balanced", "performance"] },
312-
{ label: "Battery Behavior", category: "power", tab: "Battery Behavior", keywords: ["battery", "charge", "health", "cycle"] },
451+
{
452+
label: "Power Mode",
453+
category: "power",
454+
tab: "Power Modes & Inhibit",
455+
keywords: ["power", "mode", "balanced", "performance"]
456+
},
457+
{
458+
label: "Battery Behavior",
459+
category: "power",
460+
tab: "Battery Behavior",
461+
keywords: ["battery", "charge", "health", "cycle"]
462+
},
313463

314464
// Notifications
315-
{ label: "Notification Settings", category: "notifications", tab: "General", keywords: ["notification", "alert", "badge", "sound"] },
316-
{ label: "Per-App Notifications", category: "notifications", tab: "Applications", keywords: ["notification", "application", "per", "app"] },
317-
{ label: "Do Not Disturb", category: "notifications", tab: "On-Screen-Display", keywords: ["do", "not", "disturb", "dnd", "quiet"] },
465+
{
466+
label: "Notification Settings",
467+
category: "notifications",
468+
tab: "General",
469+
keywords: ["notification", "alert", "badge", "sound"]
470+
},
471+
{
472+
label: "Per-App Notifications",
473+
category: "notifications",
474+
tab: "Applications",
475+
keywords: ["notification", "application", "per", "app"]
476+
},
477+
{
478+
label: "Do Not Disturb",
479+
category: "notifications",
480+
tab: "On-Screen-Display",
481+
keywords: ["do", "not", "disturb", "dnd", "quiet"]
482+
},
318483

319484
// Plugins
320-
{ label: "Plugin Management", category: "plugins", tab: "General", keywords: ["plugin", "extension", "addon", "manage"] },
321-
{ label: "Launcher Plugins", category: "plugins", tab: "Launcher", keywords: ["launcher", "plugin", "extension"] },
322-
{ label: "Taskbar Plugins", category: "plugins", tab: "Taskbar", keywords: ["taskbar", "plugin", "extension"] }
485+
{
486+
label: "Plugin Management",
487+
category: "plugins",
488+
tab: "General",
489+
keywords: ["plugin", "extension", "addon", "manage"]
490+
},
491+
{
492+
label: "Launcher Plugins",
493+
category: "plugins",
494+
tab: "Launcher",
495+
keywords: ["launcher", "plugin", "extension"]
496+
},
497+
{
498+
label: "Taskbar Plugins",
499+
category: "plugins",
500+
tab: "Taskbar",
501+
keywords: ["taskbar", "plugin", "extension"]
502+
}
323503
]
324504

325505
function buildSearchIndex() {
@@ -346,35 +526,41 @@ QtObject {
346526
const catLower = item.categoryLabel.toLowerCase();
347527

348528
// Exact label match gets highest score
349-
if (labelLower === query) score += 15;
350-
else if (labelLower.includes(query)) score += 10;
529+
if (labelLower === query)
530+
score += 15;
531+
else if (labelLower.includes(query))
532+
score += 10;
351533

352534
for (const term of terms) {
353-
if (labelLower.includes(term)) score += 5;
354-
if (catLower.includes(term)) score += 2;
535+
if (labelLower.includes(term))
536+
score += 5;
537+
if (catLower.includes(term))
538+
score += 2;
355539

356540
for (const kw of item.keywords) {
357-
if (kw === term) score += 4;
358-
else if (kw.startsWith(term)) score += 3;
359-
else if (kw.includes(term)) score += 1;
541+
if (kw === term)
542+
score += 4;
543+
else if (kw.startsWith(term))
544+
score += 3;
545+
else if (kw.includes(term))
546+
score += 1;
360547
}
361548
}
362549

363550
return score;
364551
}
365552

366553
function searchSettings(query, maxResults) {
367-
if (!query || !query.trim()) return [];
554+
if (!query || !query.trim())
555+
return [];
368556
maxResults = maxResults || 8;
369557

370558
const lower = query.toLowerCase().trim();
371559
const terms = lower.split(/\s+/);
372560
const index = root.buildSearchIndex();
373561

374-
return index
375-
.map(item => Object.assign({}, item, { score: root.calculateScore(item, lower, terms) }))
376-
.filter(item => item.score > 0)
377-
.sort((a, b) => b.score - a.score)
378-
.slice(0, maxResults);
562+
return index.map(item => Object.assign({}, item, {
563+
score: root.calculateScore(item, lower, terms)
564+
})).filter(item => item.score > 0).sort((a, b) => b.score - a.score).slice(0, maxResults);
379565
}
380566
}

0 commit comments

Comments
 (0)