explorerplusplus
explorerplusplus copied to clipboard
Allow keyboard shortcuts to be customised
There are a few different ways this could be implemented:
- Allow a list of shortcut items to be updated, where each shortcut functions globally. This is essentially unworkable, since at least some shortcuts need to be scoped. For example, pressing backspace within a listview navigates up, but backspace needs to work normally elsewhere.
- Associate shortcuts with one or more scopes. This fixes the issue described in point 1 and is similar to the system in Visual Studio.
- Add a system more like the one in Visual Studio Code. There would be both custom
commandandwhenclauses. The big advantage here would be flexibility. For example, a shortcut could invoke a custom command only when a particular folder is opened in the current tab. The downside would be a potentially steeper learning curve. If implemented this way, thecommandandwhenclauses could be written in Lua and leverage the plugins API.
In any case, the implementation will require a number of changes:
- [ ] Generate menu item shortcut text dynamically. At the moment, the text is fixed.
- [ ] The text will also need to be updated whenever a shortcut is updated.
- [ ] Handle scoped shortcuts in the same way global shortcuts are handled. At the moment, scoped shortcuts like backspace are handled by the control.
- [ ] Allow custom commands to be invoked, likely via the plugins API, as described in #292.
- [ ] If the plugins API is used, the API needs to be documented first.
- [ ] The API will likely need to be expanded - e.g. to add methods that allow the focused control and current tab to be retrieved.
- [ ] Replace
TranslateAccelerator. Using a custom method will make it easier to execute custom commands and check constraints. - [ ] Update the existing
shortcut_keysfunctionality available to plugins.- [ ] As noted in https://github.com/derceg/explorerplusplus/issues/153#issuecomment-543341249, documentation needs to be added on the structure and contents of the
shortcut_keysfield.
- [ ] As noted in https://github.com/derceg/explorerplusplus/issues/153#issuecomment-543341249, documentation needs to be added on the structure and contents of the
- [ ] Allow the user to update shortcuts dynamically.
- [ ] As an initial implementation, it may be easier to allow only plugins to update shortcuts, since shortcuts wouldn't have to be saved and there wouldn't have to be any UI.
- [ ] A UI will need to be added that lists existing shortcuts and allows them to be changed.
- [ ] If going with implementation 3 above, it's likely that the UI will need documentation, to explain custom commands and
whenclauses.
- [ ] If going with implementation 3 above, it's likely that the UI will need documentation, to explain custom commands and
- [ ] Custom shortcuts will need to be saved. Either a list of all shortcuts should be saved, or a list of user-customized shortcuts. The advantage of just saving the user shortcuts is that user shortcuts and system shortcuts could be clearly differentiated, as they are in Visual Studio Code.
Is the LUA plugin functionality still available though, while this is being worked on?
Just asking, because I have the following file/directory-layout for EPP (Version 1.5.0.2485, latest dev-build at the time of writing this):
C:\BIN\ExplorerPP\config.xml
C:\BIN\ExplorerPP\Explorer++.exe
C:\BIN\ExplorerPP\ExplorerPP with Plugins.lnk
C:\BIN\ExplorerPP\History.txt
C:\BIN\ExplorerPP\License.txt
C:\BIN\ExplorerPP\Readme.txt
C:\BIN\ExplorerPP\plugins\AcceleratorMappings.h
C:\BIN\ExplorerPP\plugins\Readme.txt
C:\BIN\ExplorerPP\plugins\update_accelerators\empty.lua
C:\BIN\ExplorerPP\plugins\update_accelerators\plugin.json
C:\BIN\ExplorerPP\plugins\update_theme_colors\plugin.json
C:\BIN\ExplorerPP\plugins\update_theme_colors\update_theme_colors.lua
So, as you can see I have the plugins folder inside the main installation directory, and inside that folder are the individual plugin folders, for both update_accelerators and update_theme_colors.
~~The shortcut ExplorerPP with Plugins.lnk executes C:\BIN\ExplorerPP\Explorer++.exe --enable-plugins.~~
The shortcut ExplorerPP with Plugins.lnk executes C:\BIN\ExplorerPP\Explorer++.exe -enable_plugins.
EDIT / UPDATE: According to: Load plugins on application startup the command-line switch is actually called -enable_plugins, and not --enable-plugins as stated in the Readme.txt
For testing, the file C:\BIN\ExplorerPP\plugins\update_accelerators\plugin.json contains:
{
"name": "Update accelerators",
"description": "Remaps the rename command accelerator and adds a new accelerator to switch the view mode to icons.",
"file": "empty.lua",
"version": "1.0",
"std_libs_required": [],
"author": "David Erceg",
"shortcut_keys": [
{
"command": "auto_arrange",
"keys": [
"Alt+Shift+R"
]
},
{
"command": "auto_arrange",
"keys": [
"Ctrl+NumpadAdd"
]
},
{
"command": "view_mode_details",
"keys": [
"Alt+Shift+D"
]
}
]
}
However, EPP just doesn't pick up any of this, and none of those accelerators defined in the plugin.json are doing anything. I've tried to reference C:\BIN\ExplorerPP\plugins\AcceleratorMappings.h to the best of my ability, but, sadly, no go with the keyboard shortcuts.
So, either I'm doing something wrong, or this functionality is not currently available in the latest dev builds.
Any help and additional tips on how to enable the plugin functionality for keyboard accelerators (keyboard shortcuts), would be greatly appreciated.
Cheers, Sam
Sorry, the command line in Plugins/Readme.txt was out of date. The relevant option was changed a year ago to make enabling non-default features more consistent. It should be:
explorer++.exe --enable-features Plugins
I've updated Plugins/Readme.txt so that it contains the correct command.
Is the LUA plugin functionality still available though, while this is being worked on?
I haven't done much work on the plugins system for a while, but it should still work.
Edit:
Just to add, you can also view a full list of command line options by running explorer++.exe --help in a terminal.
Thanks! All of the above was super helpful!
I will take further plugin related discussion to the appropriate location, presumably either to the official "Explorer++" forums or to the Github sections indended for discussion or issues.
Just throwing out an idea. Notepad++ (https://github.com/notepad-plus-plus/notepad-plus-plus) has a shortcut mapper, which allows to customize practically any keyboard shortcut. Maybe that can be used for some inspiration to be able to remap keyboard shortcuts in Explorer++.