mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-13 17:22: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:
@@ -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();
|
||||
|
||||
@@ -338,6 +338,7 @@ Singleton {
|
||||
property bool sortAppsAlphabetically: false
|
||||
property int appLauncherGridColumns: 4
|
||||
property bool spotlightCloseNiriOverview: true
|
||||
property bool rememberLastQuery: false
|
||||
property var spotlightSectionViewModes: ({})
|
||||
onSpotlightSectionViewModesChanged: saveSettings()
|
||||
property var appDrawerSectionViewModes: ({})
|
||||
|
||||
@@ -83,6 +83,8 @@ var SPEC = {
|
||||
timeLocale: { def: "" },
|
||||
|
||||
launcherLastMode: { def: "all" },
|
||||
launcherLastQuery: { def: "" },
|
||||
launcherQueryHistory: { def: [] },
|
||||
appDrawerLastMode: { def: "apps" },
|
||||
niriOverviewLastMode: { def: "apps" },
|
||||
|
||||
|
||||
@@ -189,6 +189,7 @@ var SPEC = {
|
||||
sortAppsAlphabetically: { def: false },
|
||||
appLauncherGridColumns: { def: 4 },
|
||||
spotlightCloseNiriOverview: { def: true },
|
||||
rememberLastQuery: { def: false },
|
||||
spotlightSectionViewModes: { def: {} },
|
||||
appDrawerSectionViewModes: { def: {} },
|
||||
niriOverviewOverlayEnabled: { def: true },
|
||||
|
||||
Reference in New Issue
Block a user