1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-02 03:28:28 -04:00

launcher: don't select pre-filled queries, exclude from memory

port 1.5
This commit is contained in:
bbedward
2026-07-13 10:31:17 -04:00
parent 06c0ea2afb
commit ea66b136ba
9 changed files with 107 additions and 16 deletions
+3 -2
View File
@@ -1252,10 +1252,11 @@ Singleton {
saveSettings(); saveSettings();
} }
function addLauncherHistory(query) { function addLauncherHistory(query, skipLastQuery) {
let q = query.trim(); let q = query.trim();
setLauncherLastQuery(q); if (!skipLastQuery)
setLauncherLastQuery(q);
if (!q) if (!q)
return; return;
@@ -36,6 +36,7 @@ Item {
property int viewModeVersion: 0 property int viewModeVersion: 0
property string viewModeContext: "spotlight" property string viewModeContext: "spotlight"
property bool forceLinearNavigation: false property bool forceLinearNavigation: false
property bool explicitQuerySession: false
signal itemExecuted signal itemExecuted
signal searchCompleted signal searchCompleted
@@ -54,7 +55,7 @@ Item {
if (active) if (active)
return; return;
SessionData.addLauncherHistory(searchQuery); SessionData.addLauncherHistory(searchQuery, explicitQuerySession);
sections = []; sections = [];
flatModel = []; flatModel = [];
selectedItem = null; selectedItem = null;
@@ -1940,7 +1941,7 @@ Item {
if (!item) if (!item)
return; return;
SessionData.addLauncherHistory(searchQuery); SessionData.addLauncherHistory(searchQuery, explicitQuerySession);
if (item.type === "plugin_browse") { if (item.type === "plugin_browse") {
var browsePluginId = item.data?.pluginId; var browsePluginId = item.data?.pluginId;
@@ -370,6 +370,7 @@ Item {
} }
if (spotlightContent.controller) { if (spotlightContent.controller) {
var targetMode = mode || SessionData.getLauncherRestoreMode(); var targetMode = mode || SessionData.getLauncherRestoreMode();
spotlightContent.controller.explicitQuerySession = !!query;
spotlightContent.controller.searchMode = targetMode; spotlightContent.controller.searchMode = targetMode;
spotlightContent.controller.activePluginId = ""; spotlightContent.controller.activePluginId = "";
spotlightContent.controller.activePluginName = ""; spotlightContent.controller.activePluginName = "";
@@ -430,7 +431,10 @@ Item {
root.keyboardActive = true; root.keyboardActive = true;
if (root.spotlightContent && root.spotlightContent.searchField) { if (root.spotlightContent && root.spotlightContent.searchField) {
root.spotlightContent.searchField.forceActiveFocus(); root.spotlightContent.searchField.forceActiveFocus();
root.spotlightContent.searchField.selectAll(); if (query)
root.spotlightContent.searchField.cursorPosition = root.spotlightContent.searchField.text.length;
else
root.spotlightContent.searchField.selectAll();
} }
}); });
}); });
@@ -161,6 +161,7 @@ Item {
} }
if (spotlightContent.controller) { if (spotlightContent.controller) {
spotlightContent.controller.reset(); spotlightContent.controller.reset();
spotlightContent.controller.explicitQuerySession = !!query;
spotlightContent.controller.searchMode = targetMode; spotlightContent.controller.searchMode = targetMode;
spotlightContent.controller.historyIndex = -1; spotlightContent.controller.historyIndex = -1;
if (targetQuery.length > 0) if (targetQuery.length > 0)
@@ -171,7 +172,10 @@ Item {
} }
if (spotlightContent.searchField) { if (spotlightContent.searchField) {
spotlightContent.searchField.forceActiveFocus(); spotlightContent.searchField.forceActiveFocus();
spotlightContent.searchField.selectAll(); if (query)
spotlightContent.searchField.cursorPosition = targetQuery.length;
else
spotlightContent.searchField.selectAll();
} }
} }
@@ -154,10 +154,14 @@ Item {
if (spotlightContent.searchField) { if (spotlightContent.searchField) {
spotlightContent.searchField.text = targetQuery; spotlightContent.searchField.text = targetQuery;
spotlightContent.searchField.selectAll(); if (query)
spotlightContent.searchField.cursorPosition = targetQuery.length;
else
spotlightContent.searchField.selectAll();
} }
if (spotlightContent.controller) { if (spotlightContent.controller) {
var targetMode = mode || SessionData.getLauncherRestoreMode(); var targetMode = mode || SessionData.getLauncherRestoreMode();
spotlightContent.controller.explicitQuerySession = !!query;
spotlightContent.controller.searchMode = targetMode; spotlightContent.controller.searchMode = targetMode;
spotlightContent.controller.activePluginId = ""; spotlightContent.controller.activePluginId = "";
spotlightContent.controller.activePluginName = ""; spotlightContent.controller.activePluginName = "";
@@ -70,6 +70,7 @@ DankPopout {
lc.searchField.forceActiveFocus(); lc.searchField.forceActiveFocus();
} }
if (lc.controller) { if (lc.controller) {
lc.controller.explicitQuerySession = !!query;
lc.controller.searchMode = mode; lc.controller.searchMode = mode;
lc.controller.pluginFilter = ""; lc.controller.pluginFilter = "";
lc.controller.searchQuery = ""; lc.controller.searchQuery = "";
+1
View File
@@ -22,6 +22,7 @@ StyledRect {
} }
property alias text: textInput.text property alias text: textInput.text
property alias cursorPosition: textInput.cursorPosition
property string placeholderText: "" property string placeholderText: ""
property string labelText: "" property string labelText: ""
property alias font: textInput.font property alias font: textInput.font
@@ -306,21 +306,45 @@ def extract_property(block, prop_name):
return None return None
def find_settings_components(content, filename): def load_wrapper_components(root_dir):
widgets_dir = Path(root_dir) / "Modules" / "Settings" / "Widgets"
wrappers = {}
for qml_file in sorted(widgets_dir.glob("*.qml")):
if qml_file.stem in SEARCHABLE_COMPONENTS:
continue
with open(qml_file, "r", encoding="utf-8") as f:
content = f.read()
root_match = re.search(r"^(\w+)\s*\{", content, re.MULTILINE)
if not root_match or root_match.group(1) not in SEARCHABLE_COMPONENTS:
continue
wrappers[qml_file.stem] = {
prop: extract_property(content, prop)
for prop in ("settingKey", "title", "text", "description", "iconName", "tags")
}
return wrappers
def find_settings_components(content, filename, wrappers):
results = [] results = []
file_tab_index = TAB_INDEX_MAP.get(filename, -1) file_tab_index = TAB_INDEX_MAP.get(filename, -1)
if file_tab_index == -1: if file_tab_index == -1:
return results return results
for component in SEARCHABLE_COMPONENTS: for component in SEARCHABLE_COMPONENTS + sorted(wrappers):
defaults = wrappers.get(component, {})
pattern = rf"\b{component}\s*\{{" pattern = rf"\b{component}\s*\{{"
for match in re.finditer(pattern, content): for match in re.finditer(pattern, content):
block = parse_component_block(content, match.start(), component) block = parse_component_block(content, match.start(), component)
if not block: if not block:
continue continue
setting_key = extract_property(block, "settingKey") setting_key = extract_property(block, "settingKey") or defaults.get("settingKey")
if setting_key: if setting_key:
setting_key = setting_key.strip("\"'") setting_key = setting_key.strip("\"'")
@@ -332,8 +356,8 @@ def find_settings_components(content, filename):
if tab_raw and tab_raw.strip("\"'") == "appearance": if tab_raw and tab_raw.strip("\"'") == "appearance":
tab_index = 6 tab_index = 6
title_raw = extract_property(block, "title") title_raw = extract_property(block, "title") or defaults.get("title")
text_raw = extract_property(block, "text") text_raw = extract_property(block, "text") or defaults.get("text")
label = None label = None
if title_raw: if title_raw:
label = extract_i18n_string(title_raw) label = extract_i18n_string(title_raw)
@@ -343,19 +367,19 @@ def find_settings_components(content, filename):
if not label: if not label:
continue continue
icon_raw = extract_property(block, "iconName") icon_raw = extract_property(block, "iconName") or defaults.get("iconName")
icon = None icon = None
if icon_raw: if icon_raw:
icon = icon_raw.strip("\"'") icon = icon_raw.strip("\"'")
if icon.startswith("{") or "?" in icon: if icon.startswith("{") or "?" in icon:
icon = None icon = None
tags_raw = extract_property(block, "tags") tags_raw = extract_property(block, "tags") or defaults.get("tags")
tags = [] tags = []
if tags_raw: if tags_raw:
tags = extract_tags(tags_raw) tags = extract_tags(tags_raw)
desc_raw = extract_property(block, "description") desc_raw = extract_property(block, "description") or defaults.get("description")
description = None description = None
if desc_raw: if desc_raw:
description = extract_i18n_string(desc_raw) description = extract_i18n_string(desc_raw)
@@ -509,6 +533,7 @@ def generate_tab_entries(sidebar_file, settings_entries=None):
def extract_settings_index(root_dir): def extract_settings_index(root_dir):
settings_dir = Path(root_dir) / "Modules" / "Settings" settings_dir = Path(root_dir) / "Modules" / "Settings"
wrappers = load_wrapper_components(root_dir)
all_entries = [] all_entries = []
seen_keys = set() seen_keys = set()
@@ -519,7 +544,7 @@ def extract_settings_index(root_dir):
with open(qml_file, "r", encoding="utf-8") as f: with open(qml_file, "r", encoding="utf-8") as f:
content = f.read() content = f.read()
entries = find_settings_components(content, qml_file.name) entries = find_settings_components(content, qml_file.name, wrappers)
for entry in entries: for entry in entries:
key = entry["section"] key = entry["section"]
if key not in seen_keys: if key not in seen_keys:
@@ -2898,6 +2898,19 @@
"icon": "search", "icon": "search",
"description": "Show All, Apps, Files, and Plugins chips beside the Spotlight Bar input." "description": "Show All, Apps, Files, and Plugins chips beside the Spotlight Bar input."
}, },
{
"section": "terminalOverride",
"label": "Terminal",
"tabIndex": 9,
"category": "Launcher",
"keywords": [
"drawer",
"launcher",
"menu",
"start",
"terminal"
]
},
{ {
"section": "dankLauncherV2BorderThickness", "section": "dankLauncherV2BorderThickness",
"label": "Thickness", "label": "Thickness",
@@ -4835,6 +4848,27 @@
], ],
"description": "Automatically lock the screen when the system prepares to suspend" "description": "Automatically lock the screen when the system prepares to suspend"
}, },
{
"section": "lockScreenFontFamily",
"label": "Lock screen font",
"tabIndex": 11,
"category": "Lock Screen",
"keywords": [
"clock",
"date",
"font",
"lock",
"lockscreen",
"login",
"password",
"screen",
"security",
"time",
"typography",
"watch"
],
"description": "Font used for the clock and date on the lock screen"
},
{ {
"section": "lockScreenNotificationMode", "section": "lockScreenNotificationMode",
"label": "Notification Display", "label": "Notification Display",
@@ -7839,6 +7873,22 @@
], ],
"icon": "info" "icon": "info"
}, },
{
"section": "greeterFontFamily",
"label": "Greeter font",
"tabIndex": 31,
"category": "Greeter",
"keywords": [
"display manager",
"font",
"greetd",
"greeter",
"login",
"screen",
"typography"
],
"description": "Font used on the login screen"
},
{ {
"section": "greeterAuth", "section": "greeterAuth",
"label": "Login Authentication", "label": "Login Authentication",