KomorebiShellExtension
January 7, 2025 ยท View on GitHub
KomorebiShellExtension is a Python-based tool that extends the functionality of the Komorebi tiling window manager by integrating rule management directly into the Windows context menu. This extension allows users to easily add or remove "Manage" and "Ignore" rules for applications without manually editing the komorebi.json configuration file.
Features
- Context Menu Integration: Adds "Manage with Komorebi" and "Don't manage with Komorebi" options to the Windows context menu for files.
- Dynamic Rule Management: Updates Komorebi's configuration file (
komorebi.json) to include or exclude specified applications. - Automatic Restart: Restarts Komorebi to apply changes after rules are updated.
- Customizable Hotkey Handler: Reads settings from
settings.inito configure Komorebi's hotkey handler.
Requirements
- Python 3.x
- Komorebi installed and configured
- Windows operating system
Installation
Step 1: Clone the Repository
git clone https://github.com/Zira3l137/KomorebiShellExtension.git
cd KomorebiShellExtension
Step 2: Configure settings.ini
Create a settings.ini file in the same directory as KomorebiRuleManager.py with the following structure:
[settings]
hotkey_handler = "your-hotkey-handler"
use_bar = true
Replace your-hotkey-handler with your Komorebi hotkey handler. It's usually either ahk or whkd.
Decide whether or not to use the Komorebi bar by setting use_bar to true or false.
Note: This can be changed anytime.
Step 3: Run the PowerShell Installation Script
Run the included PowerShell script to set up the context menu entries:
.\KomorebiShell.ps1
This script:
- Locates
KomorebiRuleManager.pyand Python. - Adds registry entries to integrate context menu options.
Usage
-
Right-Click a File: Navigate to any file in File Explorer, right-click, and choose:
- "Manage this file with Komorebi"
- "Don't manage this file with Komorebi"
-
Command Line Options: You can also run the script manually:
python KomorebiRuleManager.py <id> <kind> [--manage | --ignore]<id>: Application ID (e.g., exe name, window title, or class).<kind>: Type of ID (exe,title, orclass).--manage: Add a manage rule.--ignore: Add an ignore rule.
How It Works
- The script parses
komorebi.jsonto updatemanage_rulesorignore_rules. - It removes conflicting rules to ensure consistency.
- Komorebi is stopped and restarted to apply the changes.
Troubleshooting
- Python Not Found: Ensure Python is installed and available in your system's PATH.
- Komorebi Configuration File Not Found: Verify that
komorebic configreturns the correct path tokomorebi.json. - Permissions: Run the PowerShell script with administrator privileges if registry modifications fail.
Contributing
Feel free to submit issues or pull requests to improve this project. Contributions are welcome!
Acknowledgments
- Komorebi for the tiling window manager.
- The Python and PowerShell communities for their tools and support.