All Projects → mnurzia → context-menu-maker

mnurzia / context-menu-maker

Licence: other
Make Windows Explorer context menus without COM

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to context-menu-maker

yaml-front-matter
A to the point yaml front matter parser
Stars: ✭ 200 (+769.57%)
Mutual labels:  yaml
dataconf
Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support.
Stars: ✭ 40 (+73.91%)
Mutual labels:  yaml
carvel-simple-app-on-kubernetes
K8s simple Go app example deployed with k14s tools
Stars: ✭ 23 (+0%)
Mutual labels:  yaml
website
Prometheus monitoring mixins
Stars: ✭ 91 (+295.65%)
Mutual labels:  yaml
online-resume
A Jekyll theme for resume / cv based on Markdown. Demo: https://tarrex.github.io/online-resume
Stars: ✭ 27 (+17.39%)
Mutual labels:  yaml
k8s-opa-boilerplate
Boilerplate example of managing OPA with kustomize
Stars: ✭ 14 (-39.13%)
Mutual labels:  yaml
yamlful
YAML-based HTTP client code generation
Stars: ✭ 77 (+234.78%)
Mutual labels:  yaml
yaml-frontmatter-loader
[DEPRECATED] Yaml frontmatter loader
Stars: ✭ 12 (-47.83%)
Mutual labels:  yaml
yajsv
Yet Another JSON Schema Validator [CLI]
Stars: ✭ 42 (+82.61%)
Mutual labels:  yaml
yaml-test-suite
Comprehensive, language independent Test Suite for YAML
Stars: ✭ 93 (+304.35%)
Mutual labels:  yaml
CoreFormatters
.NET Core Custom Formatter for Yaml
Stars: ✭ 21 (-8.7%)
Mutual labels:  yaml
PotentCodables
🧪 PotentCodables - A potent set of implementations and extensions to the Swift Codable system
Stars: ✭ 32 (+39.13%)
Mutual labels:  yaml
front
Frontmatter
Stars: ✭ 21 (-8.7%)
Mutual labels:  yaml
examples
Example Prismatic components and integrations
Stars: ✭ 23 (+0%)
Mutual labels:  yaml
yaml
A Laravel YAML parser and config loader
Stars: ✭ 100 (+334.78%)
Mutual labels:  yaml
counsel-jq
Traverse complex JSON and YAML structures with live feedback
Stars: ✭ 99 (+330.43%)
Mutual labels:  yaml
pyyaml-include
yaml include other yaml
Stars: ✭ 49 (+113.04%)
Mutual labels:  yaml
refmt
Reformat HCL ⇄ JSON ⇄ YAML.
Stars: ✭ 19 (-17.39%)
Mutual labels:  yaml
k8s-1abel
Kubernetes YAML/JSON survival kit
Stars: ✭ 21 (-8.7%)
Mutual labels:  yaml
conduit
Simplified Data Exchange for HPC Simulations
Stars: ✭ 114 (+395.65%)
Mutual labels:  yaml

context-menu-maker

A program that makes Windows context menus from YAML files. It's extremely customizable, and easy to use.

Demo Image

Install

Just download the contents of this repository and place them in a location that shouldn't change much. I used C:\Python36\Scripts\context-menu-maker.

Usage

Example

Consider the following snippet:

name: 'settings'
title: 'Settings'
exists: [^folder]
tree:
	control-panel:
    	title: 'Control Panel'
        icon:
        	handler: 'exefile'
            executable: 'control.exe'
        action: 'control.exe'
    other-options:
    	title: 'Other...'
        icon: 'C:\insert_icon_file_here.ico'
        tree:
        	reg:
            	title: 'Registry Editor'
                icon:
                	handler: 'exefile'
                    executable: 'regedit.exe'
                action: 'regedit.exe'

When installed, right clicking on a folder and then clicking on a button entitled "Settings" would produce a context menu that looks like this:

Example Image

Syntax

Header

Each menu descriptor file always includes a 'name', 'title', and 'exists' field at the top.

Name

The 'name' field describes the internal name that the menu shall assume in Windows. It's used for placing the correct registry keys. Give it a simple name (preferably without spaces)

Title

This field describes the external name (or, rather, 'verb' as given by MSDN) that your context menu will use. It's the name that shows up in Explorer's context menu.

Exists

This field is a bit more complicated. It describes if your context menu will show up depending on what you click on/where you click. For example: exists: [^allfiles] would tell Explorer that your context menu can be triggered off of any file (the context menu produced by right clicking a file will have your menu on it). This does not include directories.

There are multiple things that you can put in your exists section; here they are:

Name Location
^allfiles Every file type
^desktop Files on the desktop
^directory Not sure, but it's in the registry. Will have to figure out what this does.
^directoryba Same as above, but the background.
^folder Any folder
^folderba The background of an open folder window
^drive Any drive
^driveba The background of an open drive window
^everything All of the above

Additionally, you can specify single file types that you wish to include: exists: [doc, pdf, jpg]

Icon

This field provides an icon that will be shown in the context menu; note that it cannot use a handler (mentioned later); it must be a pointer to a file containing the icon that you wish to use.

Handlers

Handlers is a term I've used to describe a piece of code that modifies the menu in a specific way. Vague, I know. Here's an example:

icon:
	handler: exefile
    executable: 'C:\Windows\System32\regedit.exe'

It uses a handler called "exefile", which pulls an icon from an executable file. It has different functionality than the default icon field behavior, which normally loads an icon from a given file.

Handlers are useful when an action is more efficiently completed by using a method other than the default behavior.

Tree

Creating nested context menus is done by traversing the tree field in the .yml file. Items in the tree can have actions (an action object), or another tree (a submenu). You can name them whatever you want; the program doesn't use the name.

Objects

Objects in the tree have properties that must be fulfulled in order for the object to display correctly. These properties can use certain handlers that provide resources in certain ways. For example, an icon handler might take an icon from a provided .exe file. Using handlers helps create better customizability and gives the user a lot of power to create their own options easily.

In the tree, objects are defined as sub-fields:

tree:
	object-action:
    	...
    object-submenu:
    	tree:
        	object-action-nested:
            	...
            object-submenu-nested:
            	...
Action objects

These objects are displayed as buttons in the context menu; pressing them launches an action, as opposed to displaying a submenu. To make an action, one must add an object with a field entitled action:

tree:
	object-action:
    	action: 'C:\Windows\System32\regedit.exe'
        ...

An action can have a handler associated with it. For more information on handlers, jump to the "handlers" section above.

Submenu objects

Submenu objects are simpler. They must contain a tree field, which, in turn, includes other objects, be they actions or more submenus:

tree:
	object-submenu:
    	tree:
        	object-action:
            	...
            object-submenu:
            	tree:
                	...

Shared properties

The title field and the icon (optional) field can be used on both submenu and action objects. The title field gives an external name to the object (the name that the end user will see in the context menu), and the icon field obviously gives the icon to be used for that particular object.

Installation

Context menus are installed once, and can always be uninstalled.

To install a context menu from a .yml file, run at an administrative command prompt:

C:\path_to_python\python.exe C:\path_to_main.py C:\path_to_yml_file install

To install the example .yml, the command would be something like this (at least, for me):

C:\Python36\python.exe C:\Python36\Scripts\context-menu-maker\main.py C:\Users\me\context-menus\example.yml install

To uninstall a context menu, simply run the install command and substitute "install" with "remove".

C:\path_to_python\python.exe C:\path_to_main.py C:\path_to_yml_file remove

To test a context menu:

C:\path_to_python\python.exe C:\path_to_main.py C:\path_to_yml_file run
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].