1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-27 15:02:50 -05:00

General code cleanups

This commit is contained in:
bbedward
2025-08-02 16:18:12 -04:00
parent 2cf7497324
commit 599118c63e
68 changed files with 102 additions and 1241 deletions

View File

@@ -31,7 +31,6 @@ PanelWindow {
show();
}
// Proper layer shell configuration
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
WlrLayershell.keyboardFocus: isVisible ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
@@ -39,7 +38,6 @@ PanelWindow {
visible: isVisible
color: "transparent"
// Full screen overlay setup for proper focus
anchors {
top: true
left: true
@@ -47,7 +45,6 @@ PanelWindow {
bottom: true
}
// App launcher logic
AppLauncher {
id: appLauncher
@@ -59,12 +56,10 @@ PanelWindow {
}
}
// Background click to close (no visual background)
MouseArea {
anchors.fill: parent
enabled: appDrawerPopout.isVisible
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)
appDrawerPopout.hide();
@@ -72,7 +67,6 @@ PanelWindow {
}
}
// Main launcher panel with asynchronous loading
Loader {
id: launcherLoader
@@ -108,11 +102,9 @@ PanelWindow {
color: Theme.popupBackground()
radius: Theme.cornerRadiusXLarge
// Remove layer rendering for better performance
antialiasing: true
smooth: true
// Material 3 elevation with multiple layers
Rectangle {
anchors.fill: parent
anchors.margins: -3
@@ -142,7 +134,6 @@ PanelWindow {
z: -1
}
// Content with focus management
Item {
id: keyHandler
@@ -153,7 +144,6 @@ PanelWindow {
forceActiveFocus();
}
// Handle keyboard shortcuts
Keys.onPressed: function(event) {
if (event.key === Qt.Key_Escape) {
appDrawerPopout.hide();
@@ -174,7 +164,6 @@ PanelWindow {
appLauncher.launchSelected();
event.accepted = true;
} else if (!searchField.activeFocus && event.text && event.text.length > 0 && event.text.match(/[a-zA-Z0-9\\s]/)) {
// User started typing, focus search field and pass the character
searchField.forceActiveFocus();
searchField.insertText(event.text);
event.accepted = true;
@@ -214,7 +203,6 @@ PanelWindow {
}
// Enhanced search field
DankTextField {
id: searchField
@@ -333,7 +321,6 @@ PanelWindow {
}
// App grid/list container with enhanced styling
Rectangle {
width: parent.width
height: {
@@ -347,7 +334,6 @@ PanelWindow {
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.05)
border.width: 1
// List view
DankListView {
id: appList
@@ -372,7 +358,6 @@ PanelWindow {
}
}
// Grid view
DankGridView {
id: appGrid

View File

@@ -8,7 +8,6 @@ import qs.Widgets
Item {
id: root
// Public interface
property string searchQuery: ""
property string selectedCategory: "All"
property string viewMode: "list" // "list" or "grid"
@@ -18,7 +17,6 @@ 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) => {
return cat !== "Education" && cat !== "Science";
@@ -28,18 +26,13 @@ Item {
return cat !== "All";
}));
}
// Category icons (computed from AppSearchService)
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
// Watch AppSearchService.applications changes via property binding
property var _watchApplications: AppSearchService.applications
// Signals
signal appLaunched(var app)
signal categorySelected(string category)
signal viewModeSelected(string mode)
@@ -50,7 +43,6 @@ Item {
keyboardNavigationActive = false;
var apps = [];
if (searchQuery.length === 0) {
// Show apps from category
if (selectedCategory === "All") {
apps = AppSearchService.applications || [];
} else {
@@ -58,7 +50,6 @@ Item {
apps = categoryApps.slice(0, maxResults);
}
} else {
// Search with category filter
if (selectedCategory === "All") {
apps = AppSearchService.searchApplications(searchQuery);
} else {
@@ -88,7 +79,6 @@ Item {
return (a.name || "").localeCompare(b.name || "");
});
// Convert to model format and populate
apps.forEach((app) => {
if (app)
filteredModel.append({
@@ -103,7 +93,6 @@ Item {
});
}
// Keyboard navigation functions
function selectNext() {
if (filteredModel.count > 0) {
keyboardNavigationActive = true;
@@ -142,7 +131,6 @@ Item {
}
}
// App launching
function launchSelected() {
if (filteredModel.count > 0 && selectedIndex >= 0 && selectedIndex < filteredModel.count) {
var selectedApp = filteredModel.get(selectedIndex);
@@ -151,28 +139,24 @@ Item {
}
function launchApp(appData) {
if (!appData) {
console.warn("AppLauncher: No app data provided");
if (!appData)
return ;
}
appData.desktopEntry.execute();
appLaunched(appData);
Prefs.addAppUsage(appData.desktopEntry);
}
// Category management
function setCategory(category) {
selectedCategory = category;
categorySelected(category);
}
// View mode management
function setViewMode(mode) {
viewMode = mode;
viewModeSelected(mode);
}
// Watch for changes
onSearchQueryChanged: {
if (debounceSearch)
searchDebounceTimer.restart();
@@ -182,7 +166,6 @@ Item {
onSelectedCategoryChanged: updateFilteredModel()
onAppUsageRankingChanged: updateFilteredModel()
on_WatchApplicationsChanged: updateFilteredModel()
// Initialize
Component.onCompleted: {
updateFilteredModel();
}
@@ -191,7 +174,6 @@ Item {
id: filteredModel
}
// Search debouncing
Timer {
id: searchDebounceTimer

View File

@@ -14,7 +14,6 @@ Item {
height: compact ? 36 : (72 + Theme.spacingS) // Single row vs two rows
// Compact single-row layout (for SpotlightModal style)
Row {
visible: compact
width: parent.width
@@ -55,13 +54,11 @@ Item {
}
// Two-row layout (for SpotlightModal organized style)
Column {
visible: !compact
width: parent.width
spacing: Theme.spacingS
// Top row: All, Development, Graphics, Games (4 items)
Row {
property var topRowCategories: ["All", "Development", "Graphics", "Games"]
@@ -105,7 +102,6 @@ Item {
}
// Bottom row: Internet, Media, Office, Settings, System (5 items)
Row {
property var bottomRowCategories: ["Internet", "Media", "Office", "Settings", "System"]