1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-13 09:12:08 -04:00

feat(danklauncher): add launcher history (#2086)

* remember last search query

* add launcherLastQuery SessionSpec

* add rememberLastQuery option

* Add remember last query for appdrawer

* Add query history sessiondata

* Complete and cleanup

* Discard changes to quickshell/Modules/Settings/LauncherTab.qml

* Cleanup logic

* Add rememberLastQuery option

* Add rememberLastQuery option description

* Move setLauncherLastQuery above validation

* Fix logic bug with empty query
This commit is contained in:
Triệu Kha
2026-03-30 20:09:39 +07:00
committed by GitHub
parent 03d2a3fd39
commit 577863b969
9 changed files with 119 additions and 25 deletions

View File

@@ -132,6 +132,8 @@ Singleton {
property string timeLocale: ""
property string launcherLastMode: "all"
property string launcherLastQuery: ""
property var launcherQueryHistory: []
property string appDrawerLastMode: "apps"
property string niriOverviewLastMode: "apps"
property string settingsSidebarExpandedIds: ","
@@ -1096,6 +1098,43 @@ Singleton {
saveSettings();
}
function setLauncherLastQuery(query) {
launcherLastQuery = query;
saveSettings();
}
function addLauncherHistory(query) {
let q = query.trim();
setLauncherLastQuery(q);
if (!q)
return;
if (launcherQueryHistory.length > 0 && launcherQueryHistory[0] === q) {
return;
}
let history = [...launcherQueryHistory];
let idx = history.indexOf(q);
if (idx !== -1)
history.splice(idx, 1);
history.unshift(q);
if (history.length > 50)
history = history.slice(0, 50);
launcherQueryHistory = history;
saveSettings();
}
function clearLauncherHistory() {
launcherLastQuery = "";
launcherSearchHistory = [];
saveSettings();
}
function setAppDrawerLastMode(mode) {
appDrawerLastMode = mode;
saveSettings();