files-community / Files

A modern file manager that helps users organize their files and folders.
https://files.community
MIT License
34.33k stars 2.19k forks source link

Feature: Keyboard shortcut or programmatic way to open file in specific app #11314

Open reidprichard opened 1 year ago

reidprichard commented 1 year ago

What feature or improvement do you think would benefit Files?

As part of my workflow, I have a macropad with buttons dedicated to open files I've selected in Explorer in the app of my choosing. This is accomplished by AutoHotkey tapping into the COM interface to get the paths of selected files. In PowerShell, a simplified version of this would look like (New-Object -ComObject Shell.Application).Windows()[0].Document.SelectedItems() | Select-Object Path (gets path of first selected item in first open Explorer window).

I have no idea if this is a realistic request, but would it be possible to register a COM object to allow programmatic interaction with Files? Alternatively, it would accomplish my current goals to have customizable keyboard shortcuts for "Open selected file(s) with ____ application".

My knowledge of the Windows APIs is pretty limited, so it's possible that there's already a way to do this?

Requirements

Either:

  1. A COM object will allow programmatic interaction with Files OR
  2. A keyboard shortcut will open selected file(s) with the specified .exe

Files Version

2.4.33.0

Windows Version

10.0.22621.1265

Comments

No response

yaira2 commented 1 year ago

I'm not sure if we can add official support but depending on the action, you can already use auto hot key to trigger keyboard shortucts. See this comment https://github.com/files-community/Files/issues/2355#issuecomment-927377572

reidprichard commented 1 year ago

Fair enough. Yeah, I think it should be doable by sending F2, Ctrl+A, Ctrl+C to get the name of the selected item, though that wouldn't work for multiple files. Just thought I'd ask!

yaira2 commented 1 year ago

Perhaps we can implement this natively when we add support for custom actions.

yaira2 commented 1 year ago

@cinqmilleans do you think we can support this with custom actions?

cinqmilleans commented 1 year ago

This is something that will be very easy to do with actions. In a next iteration, there will be a mechanism to add/remove custom actions in CommandManager. It will be enough to create an Action class, instantiate it with the parameters (software, hotkey, ...), add it to the commands and the shortcut will work. It will be necessary to provide a repository to store custom hotkeys and actions, but it is an overlay to CommandManager.