This project manages context menu plugins to extend functionality in various directories. It allows dynamic addition and removal of context menu items using Python scripts.
- Place plugin scripts in the
plugins
directory. - Run
main.py
to manage and load plugins.
- Plugin Development: Easily create plugins with metadata and functionality.
- Dynamic Menu Modification: Add or remove context menu items on the fly.
- Extensible: Customize and extend functionality by creating new plugins.
First make sure you have Python 3.12.2 or above installed. If not, you can download it from here.
- Clone the repository:
git clone https://github.com/abdbbdii/context-menu-plugin-manager.git
- Go inside the repository:
cd context-menu-plugin-manager
- Install the requirements
pip3 install -r requirements.txt
- Run the program
python main.py
- Create a new Python script in the
plugins
directory. - The script should contain the following structure:
plugin_info = {
"title": str,
"description": str,
"menu_name": str,
"type": ["FILES", "DIRECTORY", "DIRECTORY_BACKGROUND", "DRIVE"],
}
def driver(folders, params):
...
Define a variable named plugin_info
containing the following keys.
title
is the name of the script that is displayed as an item in context menu.description
(optional) is the description of the script.menu_name
is the name of the menu item that will be displayed in the context menu.type
is the type of the plugin. It is the list of one or more ofDIRECTORY
,DIRECTORY_BACKGROUND
,DRIVE
,FILES
. See the table below for more information.
Type | Description |
---|---|
DIRECTORY |
For opening on a directory. |
DIRECTORY_BACKGROUND |
For opening on the background of the directory. |
DRIVE |
For opening on the drives like USB drive. |
FILES |
For opening on a file. |
Implement the driver
function and pass two parameters:
folders
(selected directories)params
(additional parameters).
- Run
main.py
to load and manage plugins. - Test your plugin by right-clicking on an empty space within a folder.
plugin_info = {
"title": "My Plugin Title",
"description": "Description of my plugin.",
"menu_name": "My Plugin Menu",
"type": ["DIRECTORY_BACKGROUND"],
}
def driver(folders, params):
for folder in folders:
print("Processing folder:", folder)
- Remove Empty Folders: Recursively remove empty folders within directories.
- Unpack Files From Folder: Move files from subfolders to parent directories.
- Copy File Content: Copy the content of all files in the current directory to the clipboard.
- For more examples, see my other plugins.
This project is licensed under the BSD License.
Contributions are welcome! Feel free to open issues or submit pull requests to improve this project.
Shout out to @saleguas for making context-menu
python package.