简体   繁体   中英

Electron internal or external method to create own right click context menu - Windows

Hello Stack Community :) I have an Electron project and was wondering if it is possible to add an own row to the windows right click context menu. As example here cmder does the same.

right click context menu

Edit:From the comment below it worked with registry editor to create an own row. But it will only open when you make right click into an empty area of the folder window. But for my Electron project I need to make right click on a folder/file as example and then I need the path structure of the file/folder sended to the terminal and executed as echo example that I can match the path via stdout in node.js. Also an alternative way would be if the path structure gets saved in an external file .txt as example. Any ideas for this without c++, c#, .net experience? I´am only familiar with web languages. Thank you for any help!

Hey there you could use atoms implementation of this.

Basicaly you use the package winreg to register/unregister the information.

The registry entries and how Atom does this can be found in atoms win-shell.js file at https://github.com/atom/atom/blob/master/src/main-process/win-shell.js

  • exports.fileHandler is the open with ... one (option 1)
  • exports.fileContextMenu is option 2 for all files on your system
  • exports.folderContextMenu is option 2 for all folders on your system
  • exports.folderBackgroundContextMenu is option 2 when you right-click inside a folder not on any specific file.

Depending on the context you then need to parse the arguments etc. normally this would be the filepath(s).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM