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

launcher: optimize bindings and filters

This commit is contained in:
bbedward
2026-01-04 11:49:05 -05:00
parent 2e1bed5fb5
commit 151d695212
9 changed files with 250 additions and 279 deletions

View File

@@ -467,6 +467,7 @@ Item {
Item {
width: parent.width
height: parent.height - y
opacity: parentModal?.isClosing ? 0 : 1
SpotlightResults {
id: resultsView

View File

@@ -3,7 +3,6 @@ import Quickshell.Hyprland
import Quickshell.Io
import qs.Common
import qs.Modals.Common
import qs.Services
DankModal {
id: spotlightModal
@@ -18,62 +17,69 @@ DankModal {
property bool spotlightOpen: false
property alias spotlightContent: spotlightContentInstance
property bool openedFromOverview: false
property bool isClosing: false
function resetContent() {
if (!spotlightContent)
return;
if (spotlightContent.appLauncher) {
spotlightContent.appLauncher.searchQuery = "";
spotlightContent.appLauncher.selectedIndex = 0;
spotlightContent.appLauncher.setCategory(I18n.tr("All"));
}
if (spotlightContent.fileSearchController)
spotlightContent.fileSearchController.reset();
if (spotlightContent.resetScroll)
spotlightContent.resetScroll();
if (spotlightContent.searchField)
spotlightContent.searchField.text = "";
spotlightContent.searchMode = "apps";
}
function show() {
openedFromOverview = false;
isClosing = false;
resetContent();
spotlightOpen = true;
if (spotlightContent?.appLauncher)
spotlightContent.appLauncher.ensureInitialized();
open();
Qt.callLater(() => {
if (spotlightContent && spotlightContent.searchField) {
if (spotlightContent?.searchField)
spotlightContent.searchField.forceActiveFocus();
}
});
}
function showWithQuery(query) {
if (spotlightContent) {
if (spotlightContent.appLauncher) {
spotlightContent.appLauncher.searchQuery = query;
}
if (spotlightContent.searchField) {
spotlightContent.searchField.text = query;
}
}
openedFromOverview = false;
isClosing = false;
resetContent();
spotlightOpen = true;
if (spotlightContent?.appLauncher) {
spotlightContent.appLauncher.ensureInitialized();
spotlightContent.appLauncher.searchQuery = query;
}
if (spotlightContent?.searchField)
spotlightContent.searchField.text = query;
open();
Qt.callLater(() => {
if (spotlightContent && spotlightContent.searchField) {
if (spotlightContent?.searchField)
spotlightContent.searchField.forceActiveFocus();
}
});
}
function hide() {
openedFromOverview = false;
isClosing = true;
spotlightOpen = false;
close();
}
onDialogClosed: {
if (spotlightContent) {
if (spotlightContent.appLauncher) {
spotlightContent.appLauncher.searchQuery = "";
spotlightContent.appLauncher.selectedIndex = 0;
spotlightContent.appLauncher.setCategory(I18n.tr("All"));
}
if (spotlightContent.fileSearchController) {
spotlightContent.fileSearchController.reset();
}
if (spotlightContent.resetScroll) {
spotlightContent.resetScroll();
}
if (spotlightContent.searchField) {
spotlightContent.searchField.text = "";
}
}
isClosing = false;
resetContent();
}
function toggle() {