mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-20 18:24:02 -04:00
launcher: add "Open with..." action to file search results (#3801)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user