Giter Site home page Giter Site logo

shell-x's Introduction

Shell-X

Dynamic customizable file context menu solution for Windows. Allows creating context menus of any complexity without the need to compile COM shell extensions. The solution is based on the same concept as Windows Explorer native "Send to" context menu.

Overview

In Windows Explorer context menus are an extremely important part of the User Experience (UX). Just a single right-click on the file allows a convenient access to the file type specific operations.

Unfortunately creation and customization context menus were always a pain point. The problem is that Windows implements explorer context menus as so called Shell Extensions. They are a heavy weight COM servers that is not trivial to implement. And what is even more important they are components that must be rebuild/recompiled every time user wants to change the menu structure or the associated menu action. And this in turn dramatically affects the user adoption of context menus as an operating system feature.

Interestingly enough Windows has introduces an alternative light way for managing very specific context menu - "Send to".

image

The customisation of the "Send to" is dead simple. User simply goes to the special folder and creates there shortcut(s) to the desired application. Then at runtime the shortcut name will become the content menu item. And shortcut itself will be invoked (with the selected file path passed as an argument) when user selects this menu item.

image

This means that creation and customization of the "Send to" context menu is a simple file creation/editing activity that does not even require user to be an admin (elevated).

Shell-X applies the same simplified approach but extends it by allowing creation of any context menu for any file type.

Below are the some of Shell-X features that extend Windows "Send to" approach:

  • Support for complex nested context menus.
  • Support for console and windows menu actions.
  • Support for both batch files and PowerShell scripts as an action associated with a menu item.
  • Support for custom icons in the menu items.
  • The action definition is no longer a shortcut but a batch file so a menu action can have multiple steps.
  • Definitive menu items order thanks to the use of the sortable prefixes in the file names.
  • Individual context menu definitions for file types based on the file extension.

Installation

With Chocolatey

Install package Shell-X:

choco install shell-x

Manually

  • Download the release package and unzip its content in any location.
  • Execute the following two commands in the command prompt
    shell-x -r
    shell-x -init
    

Configuration

After the installation the sample context menu (as described in the next section) will be created. Do modify and extend it as you wish by creating properly name batch files in the configuration folder as described in the next section.

You can open configuration folder any time by executing the open command in command prompt:

shell-x -open

How it works

Shell-X maintains a global directory, which file tree structure defines the complex context menu tree to be displayed at runtime on right click.

The root folders are named according the file extension that the context menu is for. Thus the folder txt contains context menu definition for all text files, the dll folder is for all DLLs. And there are two special folder names:

  • [any] that defines the context menu for any file type.
  • [folder] that defines the context menu for a folder.

Below is the example of the configuration for two separate context menus for text files and for any file.

image

And this is how the menus look at runtime.

image

In the example above the context menu for txt files has a complex structure containing sub-menus for opening selected file with Notepad and other file handling operations.

The content of 00.Notepad.cmd file is an ordinary batch file content:

notepad.exe %*

Since the menu items are composed according the configuration folder file structure naming the files it is vital the proper naming convention is followed:

  • File name

    <two_digits_order_prefix>.<menu_item_name>[.c].<cmd|bat|ps1>
    
  • By default the batch file is executed with the console window hidden. If you prefer console being visible include .c suffix before the batch file extension.

  • If you want the menu item to have the icon then place the icon file in the same folder where the corresponding batch file is and give it the same file name as the batch file but with the ".ico" extension:

    05.Shell-X configure.cmd
    05.Shell-X configure.ico
    

Limitations

  • When user right-click a file and the plugin is loaded for the very first time there is a noticable delay (~3-5 seconds) before the menu pops up. This is a Windows Explorer one off limititation and any subsequent right-clicks bring context menu instantly.

shell-x's People

Contributors

lbs-contributor avatar oleg-shilo avatar jameswilliamknight avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.