1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-26 06:22:50 -05:00

uncomment toast, and format

This commit is contained in:
bbedward
2025-07-24 19:46:05 -04:00
parent 762785b27a
commit fc52aa2c7a
21 changed files with 575 additions and 427 deletions

View File

@@ -6,9 +6,9 @@ import Quickshell.Io
import Quickshell.Wayland
import Quickshell.Widgets
import qs.Common
import qs.Modules.AppDrawer
import qs.Services
import qs.Widgets
import qs.Modules.AppDrawer
PanelWindow {
id: appDrawerPopout
@@ -50,10 +50,9 @@ PanelWindow {
// App launcher logic
AppLauncher {
id: appLauncher
viewMode: Prefs.appLauncherViewMode
gridColumns: 4
onAppLaunched: appDrawerPopout.hide()
onViewModeSelected: function(mode) {
Prefs.setAppLauncherViewMode(mode);
@@ -67,48 +66,48 @@ PanelWindow {
onClicked: function(mouse) {
// Only close if click is outside the launcher panel
var localPos = mapToItem(launcherLoader, mouse.x, mouse.y);
if (localPos.x < 0 || localPos.x > launcherLoader.width ||
localPos.y < 0 || localPos.y > launcherLoader.height) {
if (localPos.x < 0 || localPos.x > launcherLoader.width || localPos.y < 0 || localPos.y > launcherLoader.height)
appDrawerPopout.hide();
}
}
}
// Main launcher panel with asynchronous loading
Loader {
id: launcherLoader
asynchronous: true
active: appDrawerPopout.isVisible
width: 520
height: 600
x: Theme.spacingL
y: Theme.barHeight + Theme.spacingXS
opacity: appDrawerPopout.isVisible ? 1 : 0
scale: appDrawerPopout.isVisible ? 1 : 0.9
Behavior on opacity {
NumberAnimation {
duration: Anims.durMed
easing.type: Easing.BezierSpline
easing.bezierCurve: Anims.emphasized
}
}
Behavior on scale {
NumberAnimation {
duration: Anims.durMed
easing.type: Easing.BezierSpline
easing.bezierCurve: Anims.emphasized
}
}
sourceComponent: Rectangle {
id: launcherPanel
color: Theme.popupBackground()
radius: Theme.cornerRadiusXLarge
// Remove layer rendering for better performance
antialiasing: true
smooth: true
@@ -146,13 +145,14 @@ PanelWindow {
// Content with focus management
Item {
id: keyHandler
anchors.fill: parent
focus: true
Component.onCompleted: {
if (appDrawerPopout.isVisible)
forceActiveFocus();
}
// Handle keyboard shortcuts
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Escape) {
@@ -214,6 +214,7 @@ PanelWindow {
font.pixelSize: Theme.fontSizeMedium
color: Theme.surfaceVariantText
}
}
// Enhanced search field
@@ -252,26 +253,25 @@ PanelWindow {
event.accepted = false;
}
}
Component.onCompleted: {
if (appDrawerPopout.isVisible) {
if (appDrawerPopout.isVisible)
searchField.forceActiveFocus();
}
}
Connections {
function onIsVisibleChanged() {
if (appDrawerPopout.isVisible) {
if (appDrawerPopout.isVisible)
Qt.callLater(function() {
searchField.forceActiveFocus();
});
} else {
else
searchField.clearFocus();
}
}
target: appDrawerPopout
}
}
// Category filter and view mode controls
@@ -285,7 +285,7 @@ PanelWindow {
Item {
width: 200
height: 36
DankDropdown {
anchors.fill: parent
text: ""
@@ -296,6 +296,7 @@ PanelWindow {
appLauncher.setCategory(value);
}
}
}
Item {
@@ -335,7 +336,9 @@ PanelWindow {
appLauncher.setViewMode("grid");
}
}
}
}
// App grid/list container
@@ -399,10 +402,15 @@ PanelWindow {
appLauncher.keyboardNavigationActive = false;
}
}
}
}
}
}
}
}
}

View File

@@ -18,62 +18,35 @@ Item {
property bool debounceSearch: true
property int debounceInterval: 50
property bool keyboardNavigationActive: false
// Categories (computed from AppSearchService)
property var categories: {
var allCategories = AppSearchService.getAllCategories().filter(cat => {
var allCategories = AppSearchService.getAllCategories().filter((cat) => {
return cat !== "Education" && cat !== "Science";
});
var result = ["All"];
return result.concat(allCategories.filter(cat => {
return result.concat(allCategories.filter((cat) => {
return cat !== "All";
}));
}
// Category icons (computed from AppSearchService)
property var categoryIcons: categories.map(category => AppSearchService.getCategoryIcon(category))
property var categoryIcons: categories.map((category) => {
return AppSearchService.getCategoryIcon(category);
})
// App usage ranking helper
property var appUsageRanking: Prefs.appUsageRanking
// Internal model
property alias model: filteredModel
// Signals
signal appLaunched(var app)
signal categorySelected(string category)
signal viewModeSelected(string mode)
// Internal model
property alias model: filteredModel
ListModel {
id: filteredModel
}
// Search debouncing
Timer {
id: searchDebounceTimer
interval: root.debounceInterval
repeat: false
onTriggered: updateFilteredModel()
}
// Watch for changes
onSearchQueryChanged: {
if (debounceSearch) {
searchDebounceTimer.restart();
} else {
updateFilteredModel();
}
}
onSelectedCategoryChanged: updateFilteredModel()
onAppUsageRankingChanged: updateFilteredModel()
function updateFilteredModel() {
filteredModel.clear();
selectedIndex = 0;
keyboardNavigationActive = false;
var apps = [];
if (searchQuery.length === 0) {
// Show apps from category
if (selectedCategory === "All") {
@@ -90,8 +63,10 @@ Item {
var categoryApps = AppSearchService.getAppsInCategory(selectedCategory);
if (categoryApps.length > 0) {
var allSearchResults = AppSearchService.searchApplications(searchQuery);
var categoryNames = new Set(categoryApps.map(app => app.name));
apps = allSearchResults.filter(searchApp => {
var categoryNames = new Set(categoryApps.map((app) => {
return app.name;
}));
apps = allSearchResults.filter((searchApp) => {
return categoryNames.has(searchApp.name);
}).slice(0, maxResults);
} else {
@@ -99,25 +74,20 @@ Item {
}
}
}
// Sort apps by usage ranking, then alphabetically
apps = apps.sort(function(a, b) {
var aId = a.id || (a.execString || a.exec || "");
var bId = b.id || (b.execString || b.exec || "");
var aUsage = appUsageRanking[aId] ? appUsageRanking[aId].usageCount : 0;
var bUsage = appUsageRanking[bId] ? appUsageRanking[bId].usageCount : 0;
if (aUsage !== bUsage) {
if (aUsage !== bUsage)
return bUsage - aUsage; // Higher usage first
}
return (a.name || "").localeCompare(b.name || ""); // Alphabetical fallback
});
// Convert to model format and populate
apps.forEach(app => {
if (app) {
apps.forEach((app) => {
if (app)
filteredModel.append({
"name": app.name || "",
"exec": app.execString || "",
@@ -126,7 +96,7 @@ Item {
"categories": app.categories || [],
"desktopEntry": app
});
}
});
}
@@ -180,9 +150,8 @@ Item {
function launchApp(appData) {
if (!appData) {
console.warn("AppLauncher: No app data provided");
return;
return ;
}
appData.desktopEntry.execute();
appLaunched(appData);
Prefs.addAppUsage(appData.desktopEntry);
@@ -200,8 +169,31 @@ Item {
viewModeSelected(mode);
}
// Watch for changes
onSearchQueryChanged: {
if (debounceSearch)
searchDebounceTimer.restart();
else
updateFilteredModel();
}
onSelectedCategoryChanged: updateFilteredModel()
onAppUsageRankingChanged: updateFilteredModel()
// Initialize
Component.onCompleted: {
updateFilteredModel();
}
}
ListModel {
id: filteredModel
}
// Search debouncing
Timer {
id: searchDebounceTimer
interval: root.debounceInterval
repeat: false
onTriggered: updateFilteredModel()
}
}

View File

@@ -48,8 +48,11 @@ Item {
categorySelected(modelData);
}
}
}
}
}
// Two-row layout (for SpotlightModal organized style)
@@ -66,7 +69,7 @@ Item {
spacing: Theme.spacingS
Repeater {
model: parent.topRowCategories.filter(cat => {
model: parent.topRowCategories.filter((cat) => {
return categories.includes(cat);
})
@@ -95,8 +98,11 @@ Item {
categorySelected(modelData);
}
}
}
}
}
// Bottom row: Internet, Media, Office, Settings, System (5 items)
@@ -107,7 +113,7 @@ Item {
spacing: Theme.spacingS
Repeater {
model: parent.bottomRowCategories.filter(cat => {
model: parent.bottomRowCategories.filter((cat) => {
return categories.includes(cat);
})
@@ -136,8 +142,13 @@ Item {
categorySelected(modelData);
}
}
}
}
}
}
}
}