win-ctx

A Rust library for managing Windows context menu entries.
Installation
Features
- Create and edit context menu entries and sub-entries
- Toggle the pre-Windows 11 context menu
Basic example
The following code creates a top-level context menu entry that appears on right-clicked folders and opens the target folder in the terminal.
use *;
new_with_options?;
Advanced example
The following code creates a context menu entry with child entries that each open the target folder in the selected program.
To reduce line count, the more basic non-options functions can be used, and individual values are then set on the resulting entries.
use ;
let mut parent = new?;
let mut child_1 = parent.new_child?;
child_1.set_command?;
child_1.set_icon?;
let mut child_2 = parent.new_child?;
child_2.set_command?;
child_2.set_icon?;
Errors
Because this library manipulates the Windows registry, code must be executed as administrator or any user with sufficient privileges.
Errors will have an ErrorKind of either:
PermissionDeniedfor insufficient privileges, orNotFoundfor operations on missing keys and values.