mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-09 15:22:13 -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:
@@ -90,7 +90,7 @@ DankPopout {
|
||||
if (!lc)
|
||||
return;
|
||||
|
||||
const query = _pendingQuery;
|
||||
const query = _pendingQuery || (SettingsData.rememberLastQuery ? SessionData.launcherLastQuery : "") || "";
|
||||
const mode = _pendingMode || SessionData.appDrawerLastMode || "apps";
|
||||
_pendingMode = "";
|
||||
_pendingQuery = "";
|
||||
@@ -102,12 +102,9 @@ DankPopout {
|
||||
if (lc.controller) {
|
||||
lc.controller.searchMode = mode;
|
||||
lc.controller.pluginFilter = "";
|
||||
lc.controller.searchQuery = "";
|
||||
if (query) {
|
||||
lc.controller.setSearchQuery(query);
|
||||
} else {
|
||||
lc.controller.performSearch();
|
||||
}
|
||||
lc.controller.searchQuery = query;
|
||||
|
||||
lc.controller.performSearch();
|
||||
}
|
||||
lc.resetScroll?.();
|
||||
lc.actionPanel?.hide();
|
||||
|
||||
@@ -831,6 +831,15 @@ Item {
|
||||
checked: SessionData.searchAppActions
|
||||
onToggled: checked => SessionData.setSearchAppActions(checked)
|
||||
}
|
||||
|
||||
SettingsToggleRow {
|
||||
settingKey: "rememberLastQuery"
|
||||
tags: ["launcher", "remember", "last", "search", "query"]
|
||||
text: I18n.tr("Remember Last Query")
|
||||
description: I18n.tr("Autofill last remembered query when opened")
|
||||
checked: SettingsData.rememberLastQuery
|
||||
onToggled: checked => SettingsData.set("rememberLastQuery", checked)
|
||||
}
|
||||
}
|
||||
|
||||
SettingsCard {
|
||||
@@ -1189,17 +1198,11 @@ Item {
|
||||
if (diffMins < 1)
|
||||
return I18n.tr("Last launched just now");
|
||||
if (diffMins < 60)
|
||||
return diffMins === 1
|
||||
? I18n.tr("Last launched %1 minute ago").arg(diffMins)
|
||||
: I18n.tr("Last launched %1 minutes ago").arg(diffMins);
|
||||
return diffMins === 1 ? I18n.tr("Last launched %1 minute ago").arg(diffMins) : I18n.tr("Last launched %1 minutes ago").arg(diffMins);
|
||||
if (diffHours < 24)
|
||||
return diffHours === 1
|
||||
? I18n.tr("Last launched %1 hour ago").arg(diffHours)
|
||||
: I18n.tr("Last launched %1 hours ago").arg(diffHours);
|
||||
return diffHours === 1 ? I18n.tr("Last launched %1 hour ago").arg(diffHours) : I18n.tr("Last launched %1 hours ago").arg(diffHours);
|
||||
if (diffDays < 7)
|
||||
return diffDays === 1
|
||||
? I18n.tr("Last launched %1 day ago").arg(diffDays)
|
||||
: I18n.tr("Last launched %1 days ago").arg(diffDays);
|
||||
return diffDays === 1 ? I18n.tr("Last launched %1 day ago").arg(diffDays) : I18n.tr("Last launched %1 days ago").arg(diffDays);
|
||||
return I18n.tr("Last launched %1").arg(date.toLocaleDateString());
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
|
||||
Reference in New Issue
Block a user