shell-x icon indicating copy to clipboard operation
shell-x copied to clipboard

Is it possible to implement context menu for the same type of files?

Open Ahernz opened this issue 10 months ago • 13 comments

For example, if you configure an [Image] folder, you can use the context menu as long as it is an image format file.

Or can a folder support multiple suffixes at the same time? For example, if you configure the "jpg/tif/png" folder, files in *.jpg *.tif *.png format can use the context menu.

Ahernz avatar Apr 17 '24 09:04 Ahernz

Yes, it is possible already.

You just need to name the folder containing the handler for your image files with a special name that indicates all the extensions the image file can have. In your case, the folder name should be [jpg,tif,png].

Apologies for not reflecting it in the documentation. I just overlooked it when was preparing the documentation. Addressed now: https://github.com/oleg-shilo/shell-x/tree/master?tab=readme-ov-file#how-it-works

oleg-shilo avatar Apr 18 '24 02:04 oleg-shilo

I tried setting the folder name to [jpg,tif,png] but this resulted in the context menu being available for all files.

Ahernz avatar Apr 18 '24 03:04 Ahernz

Let me check. No, it's not what I observe if I use a standard config folder (just initialized during the install). A
I assume when you say "all files", you mean "any file" not "all image files". Am I right

You can share your config folder content here and I can repeat a local test.

oleg-shilo avatar Apr 18 '24 03:04 oleg-shilo

Your understanding is correct, but I didn't express it clearly. I have now configured a folder named [jpg, tif, png], but this folder has the same effect as the [file] folder, allowing any file to use the context menu.

Ahernz avatar Apr 18 '24 03:04 Ahernz

I found the problem, I reinstalled shell-x and restarted the explorer, and now it works normally. Thanks for your reply.

Ahernz avatar Apr 18 '24 05:04 Ahernz

At the same time, I discovered a bug, that is, when setting the folder name to [png], the context menu does not take effect for files with the suffix ".PNG". You need to configure a name in uppercase format at the same time, such as [png, PNG] for normal use.

Ahernz avatar Apr 18 '24 06:04 Ahernz

Thank you. I will lcheck.

oleg-shilo avatar Apr 18 '24 07:04 oleg-shilo

Ah, I see the problem.

For a single file extension, you need to use the file extension as is:

txt file extension => txt folder name txt and md file extensions => [txt,md] folder name

The only allowed content between square brackets is: any, folder and comma-delimited list of multiple files.

Thus in your case you need to name your folder png not [png]. And adding extra extension as you did solve the problem for you. [png,png] would also do the trick.

Nevertheless, I will consider allowing a single extension in square brackets option in the next release.

oleg-shilo avatar Apr 18 '24 09:04 oleg-shilo

To make it easier I have added the corresponding section to the CLI help and this site readme (https://github.com/oleg-shilo/shell-x/blob/master/README.md#naming-convention)

oleg-shilo avatar Apr 18 '24 10:04 oleg-shilo

Sorry, I couldn't express myself clearly, So I made two images. My computer seems to be case sensitive about file extension.

Picture 1: When I configure the [txt,jpg] folder, the context menu cannot be used for files with the suffix ".TXT". Snipaste_2024-04-19_01-50-05

Picture 2: I have to configure the [txt, jpg, TXT] folder so that files with the ".TXT" suffix can use the context menu normally. Snipaste_2024-04-19_01-50-21

Ahernz avatar Apr 18 '24 18:04 Ahernz

I tested it in Windows 11 and it works, but not in Windows 10.

Ahernz avatar Apr 30 '24 10:04 Ahernz

You are right. Indeed somehow it is case-sensitive. It's not your computer problem but the problem with the way [txt,jpg] is handled. It works correctly for both upper and lower case extensions if the config folder is for one extension only - txt. But becomes case sensitive for config folders for multiple extensions like yours [txt,jpg]. There is a mistake somewhere in my code.

I will start working on it right away.

Thank you for reporting it.

oleg-shilo avatar Apr 30 '24 13:04 oleg-shilo

Done. Release can be found here: https://github.com/oleg-shilo/shell-x/releases/tag/v1.5.6.0

It will take a little time before it hits Chocolatey

oleg-shilo avatar May 01 '24 12:05 oleg-shilo