launcher: add "Open with..." action to file search results (#3801)

This commit is contained in:
Guillem CANAL
2026-10-18 12:01:15 -04:00
committed by GitHub
parent 2592e2f33e
commit 5a480101c6
2 changed files with 18 additions and 2 deletions
+13 -1
View File
@@ -1885,7 +1885,7 @@ Item {
}
function transformFileResult(file) {
return Transform.transformFileResult(file, I18n.tr("Open"), I18n.tr("Open folder"), I18n.tr("Copy path"), I18n.tr("Open in terminal"));
return Transform.transformFileResult(file, I18n.tr("Open"), I18n.tr("Open folder"), I18n.tr("Copy path"), I18n.tr("Open in terminal"), I18n.tr("Open with") + "…");
}
function transformClipboardEntry(entry) {
@@ -2753,6 +2753,9 @@ Item {
case "open_folder":
openFolder(item.data.path);
break;
case "open_with":
openWith(item.data.path);
break;
case "copy_path":
copyToClipboard(item.data.path);
break;
@@ -2847,6 +2850,15 @@ Item {
SessionService.openPath(path.substring(0, path.lastIndexOf("/")));
}
function openWith(path) {
if (!path)
return;
// No mimeType: it would limit the picker to declared handlers, and any app must stay pickable.
DMSService.appPickerRequested({
target: path
});
}
function openTerminal(path) {
if (!path)
return;
@@ -215,7 +215,7 @@ function transformClipboardItem(entry, copyLabel, pasteLabel, primaryLabel, imag
};
}
function transformFileResult(file, openLabel, openFolderLabel, copyPathLabel, openTerminalLabel) {
function transformFileResult(file, openLabel, openFolderLabel, copyPathLabel, openTerminalLabel, openWithLabel) {
var filename = file.path ? file.path.split("/").pop() : "";
var dirname = file.path ? file.path.substring(0, file.path.lastIndexOf("/")) : "";
var isDir = file.is_dir || false;
@@ -240,6 +240,10 @@ function transformFileResult(file, openLabel, openFolderLabel, copyPathLabel, op
name: copyPathLabel,
icon: "content_copy",
action: "copy_path"
}, {
name: openWithLabel,
icon: "apps",
action: "open_with"
});
return {