end2endzone / ShellAnything

ShellAnything is a C++ open-source software which allow one to easily customize and add new options to *Windows Explorer* context menu. Define specific actions when a user right-click on a file or a directory.
MIT License
183 stars 27 forks source link

Need to distinguish between `Directory\Background` and `Folder` #152

Open Vzz1c opened 3 months ago

Vzz1c commented 3 months ago

class="directory" or maxfolders="1", we need to differentiate between Directory\Background\shell and Folder\shell, let's say I customize a 7zip, we don't want to have a menu command to compress a folder when we haven't selected a folder yet! I'd like to add this feature, thanks!

end2endzone commented 3 months ago

class="directory" or maxfolders="1", we need to differentiate between Directory\Background\shell and Folder\shell.

ShellAnything does not differentiate between right-clicking a directory background or the right-clicking the directory itself. If you right-click on any of the following :

it does not matter for ShellAnything. All these events are evaluated as the same event for ShellAnything : "a directory was selected, now show the menus when a single directory was clicked".

The code in the shell extension can detect that but this information is not used.

let's say I customize a 7zip, we don't want to have a menu command to compress a folder when we haven't selected a folder yet!

I am uncertain of what you mean. Are you referring to the menu that is shown when right-clicking a file/directory, dragging to another location and then releasing your mouse?

In File Explorer, if you right-click the white area after the last file on the right-pane, you will see menus that are related to this directory. A directory is selected even though you did not made any selection. This is not a feature of ShellAnything, it is baked-in File Explorer. For example, try the following :

Notice the option "Open PowerShell window here". This menu will open a PowerShell prompt located in this directory. Also, if you select menu "Properties", you will see properties of the Temp directory. This white area is referenced as the "directory background".

I'd like to add this feature, thanks!

Sure I would gladly accept a pull request to help improve ShellAnything. This feature would allow showing a menu only when the user right-click a white background or a directory. That would be great! Could you please elaborate on how you plan to implement this feature? Maybe setting a property selection.background to true or false ?