jupytext icon indicating copy to clipboard operation
jupytext copied to clipboard

Refrain from changing file type icons

Open joelostblom opened this issue 4 years ago • 5 comments

What do you think of retaining the original file type icons instead of changing them? I find it somewhat confusing that Jupytext changes the icons of all available file types, as it has not changed the files to notebooks, merely granted us the possibility to open them as such. This added functionality is suitably made available through the right click menu, but the default double click behavior is still to open the file according to its file type. I think it would make sense for the icon to indicate to the file type and default opening behavior, rather than its optional capability to be opened as a notebook.

I believe people using jupytext are aware of which file types they want and are able to open as notebooks, and it is more informative to let the icon indicate the file type. Especially when there are many files in the same directory, it would be rather helpful to distinguish them via their icons.

I am currently using c.ContentsManager.notebook_extensions = "ipynb,Rmd" and create separate folders for ipynb and rmd files, which somewhat alleviates the issue, but I have to change the config when I occasionally want to open .md or .py files as notebooks.

joelostblom avatar Dec 12 '19 15:12 joelostblom

To clarify, I am mostly thinking about JupyterLab with the above. The behavior in the classic notebook seems to be a little different, but I don't use the classic notebook often and I am not sure what makes the most sense there.

joelostblom avatar Dec 12 '19 15:12 joelostblom

Hello @joelostblom , sure this makes sense. At the current stage we have too little control on how JupyterLab displays the different file types - we do not deliberately change the icon, all what we do is we return a file type notebook for files with extensions in c.ContentsManager.notebook_extensions.

Without this file type, as you noticed, Jupyter will not let you open the file as a notebook. I do agree that if we could find another way to let JupyterLab know that these files may be opened as a notebook, it would be better. Maybe @grst , who developed the 'Open With Notebook' context menu, may have an idea on how to do that?

mwouts avatar Dec 13 '19 08:12 mwouts

No idea, sorry. Getting the context menu to run was just a minimally invasive hack.

Back then I had the feeling that ideally the logic of how to open a file could be delegated to the jupytext extension, but I don't know how to do that.

grst avatar Dec 13 '19 10:12 grst

Back then I had the feeling that ideally the logic of how to open a file could be delegated to the jupytext extension

Yes, that's an interesting idea, thanks @grst . I'll think about that.

mwouts avatar Dec 13 '19 11:12 mwouts

Ah I see, thanks for the clarification. I noticed from grst's previous comment that opening files and setting the file icon are handled by separate functions in JupyterLab. Maybe that lowers the barrier for a change upstream in JupyterLab to set the icon based on the file extension instead of the registered file type? I can't think of scenarios where this would not be preferable, but maybe there are some critical ones that I am just not familiar with.

joelostblom avatar Dec 13 '19 23:12 joelostblom