I'm building an app which should be integrated through an option in the context menu of Windows explorer and Mac finder. I couldn't find a relevant option in Electron's documentation.
我正在构建一个应该通过Windows资源管理器和Mac查找器的上下文菜单中的选项集成的应用程序。我在Electron的文档中找不到相关选项。
For example, when I right-click a file in Windows explorer / Mac finder, I want this option from my Electron app to appear in that menu. Is it possible?
例如,当我右键单击Windows资源管理器/ Mac查找器中的文件时,我希望我的Electron应用程序中的此选项出现在该菜单中。可能吗?
2 个解决方案
#1
1
This question is not actually related to Electron. It can be divided into two parts:
这个问题实际上与Electron无关。它可以分为两部分:
- Creating custom dynamic context menu entries during installation passing the respective selected file as command line argument to its target
- 在安装期间创建自定义动态上下文菜单条目,将相应的选定文件作为命令行参数传递给其目标
- Node.js command line argument parsing
- Node.js命令行参数解析
Creating custom dynamic context menu entries during installation
Windows:
视窗:
- Adding context menu entries during installation using WiX
- 使用WiX在安装期间添加上下文菜单条目
- Since it boils down to adding registry keys, this more general SO post about adding context menu entries for specific file types may also interest you.
- 由于它归结为添加注册表项,因此关于为特定文件类型添加上下文菜单条目的更一般的SO帖子也可能对您感兴趣。
OSX:
OSX:
- I really can't tell.
- 我实在说不出来。
Node.js command line argument parsing
Multiple options exist for command line argument parsing in Node.js, here is just a handful I've been using in the past:
在Node.js中存在命令行参数解析的多个选项,这里只是我过去使用过的一些选项:
- Minimist
- Minimist
- command-line-args
- 命令行-ARGS
- and my current favourite, Yargs
- 和我现在最喜欢的,Yargs
#2
0
For the OS X / macOS case, one (the?) way is to make a service (in ~/Library/Services/
or /System/Library/Services/
) that can receive the folder item(s) in question.
对于OS X / macOS情况,一种(?)方式是创建一个服务(在〜/ Library / Services /或/ System / Library / Services /中),它可以接收有问题的文件夹项。
(Footnote 1: Note that services can be individually enabled/disabled in System Preferences, and the whole experience seems a little bit buggy during development sometimes.)
(脚注1:请注意,可以在“系统偏好设置”中单独启用/禁用服务,并且有时在开发过程中整个体验似乎有点错误。)
(Footnote 2: I've only done this via the Automator but I hope at least it gives you some pointer as to where to get started.)
(脚注2:我只是通过Automator完成了这个,但我希望至少它会给你一些关于从哪里开始的指针。)
#1
1
This question is not actually related to Electron. It can be divided into two parts:
这个问题实际上与Electron无关。它可以分为两部分:
- Creating custom dynamic context menu entries during installation passing the respective selected file as command line argument to its target
- 在安装期间创建自定义动态上下文菜单条目,将相应的选定文件作为命令行参数传递给其目标
- Node.js command line argument parsing
- Node.js命令行参数解析
Creating custom dynamic context menu entries during installation
Windows:
视窗:
- Adding context menu entries during installation using WiX
- 使用WiX在安装期间添加上下文菜单条目
- Since it boils down to adding registry keys, this more general SO post about adding context menu entries for specific file types may also interest you.
- 由于它归结为添加注册表项,因此关于为特定文件类型添加上下文菜单条目的更一般的SO帖子也可能对您感兴趣。
OSX:
OSX:
- I really can't tell.
- 我实在说不出来。
Node.js command line argument parsing
Multiple options exist for command line argument parsing in Node.js, here is just a handful I've been using in the past:
在Node.js中存在命令行参数解析的多个选项,这里只是我过去使用过的一些选项:
- Minimist
- Minimist
- command-line-args
- 命令行-ARGS
- and my current favourite, Yargs
- 和我现在最喜欢的,Yargs
#2
0
For the OS X / macOS case, one (the?) way is to make a service (in ~/Library/Services/
or /System/Library/Services/
) that can receive the folder item(s) in question.
对于OS X / macOS情况,一种(?)方式是创建一个服务(在〜/ Library / Services /或/ System / Library / Services /中),它可以接收有问题的文件夹项。
(Footnote 1: Note that services can be individually enabled/disabled in System Preferences, and the whole experience seems a little bit buggy during development sometimes.)
(脚注1:请注意,可以在“系统偏好设置”中单独启用/禁用服务,并且有时在开发过程中整个体验似乎有点错误。)
(Footnote 2: I've only done this via the Automator but I hope at least it gives you some pointer as to where to get started.)
(脚注2:我只是通过Automator完成了这个,但我希望至少它会给你一些关于从哪里开始的指针。)