Skip to content

[API Feature Request] A method that return the selected Finder items #153

@fturcheti

Description

@fturcheti

Describe the feature and the current behavior/state.

A method that return the selected items in Finder (files and folders). I've asked @thomaspaulmann about this on Slack and he suggested something like getSelectedFile, that would fit nicely with getSelectedText. I'm not completely convinced by the naming though because the method would ideally return an array of finder items, something like this:

interface FinderItem {
  path: string;
  isFile: boolean;
  isDirectory: boolean;
}

And that could be used like this:

const selection = getSelectedFiles();
const files = selection.filter(item => item.isFile);
files.forEach(file => { console.log(file.path) });

Will this change the current api? How?

No.

Who will benefit with this feature?

Extensions that act on the selected files and/or folders, like #147 – Open Finder Selection With…. Some examples:

  • an extension with commands to open the selection with specific applications, so you could assign a keyboard shortcut to open files with your code editor for example;
  • an extension to upload the selected file to an online file sharing service;
  • an extension to display the summed size of the selected files;
  • an extension to compress the selected files;
  • an extension to convert the format of the selected image files.

Any Other info.

Metadata

Metadata

Assignees

Labels

apiIssues related to APIfeature requestNew feature or improvementstatus: fixed in next releaseThe issue will be closed once next release is available

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions