-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuring jupyterlab launcher category #453
Conversation
I guess I should add (and probably document) that for obscure jupyterlab reasons, the |
Apologies for the late review! I haven't tested this, but if we add another line to the docs about the icon limitation, I think this is ready to go as is. |
Just pass through to launcher.add, defaulting to Notebook
Non-kernel icons in more recent jupyter clients are SVG so that they can be themed e.g. a black icon on a dark theme would disappear. It's certainly possible to generate new SVG icons that answer the contract on the fly. Even PNG/JPEG/etc. can be encapsulated when the command is registered; very naively: commands.addCommand(CommandIDs.open, {
label: (args) => (args as IOpenArgs).title,
icon: new LabIcon({
svgstr: `<svg><foreignObject><img src="${launcher_entry.icon_url}"/></foreignObject></svg>`
}),
...
}) ...though they won't somehow magically be theme-aware. Some gotchas:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into the other icons a little, and it seemed more complicated. I think @bollwyvl's suggestion could be made to work in a generic way. I can try to take a look at some point, but probably not for this PR. I also just noticed there was an old draft PR #244 to provide this same functionality in a similar way -- hopefully not stepping on anyone's toes! |
Hello! This is exactly what I was looking for! :) Plus I also wanted to add rank and make the SVG icon work. You can find that here: https://github.com/imcovangent/jupyter-server-proxy/tree/category_and_rank I'm not sure what the proper way is to include this. I have now forked dylex:category and created a new branch that builds upon this PR, but adds the rank argument as well. And it includes a fix for the icons. What is best? I make this a PR on dylex or make it directly a (new?) PR here? Or do I wait for this PR to complete and then make a new PR? Please advice @dylex @yuvipanda |
Any feedback on this @dylex or @yuvipanda ? Else I will open a new PR here from my branch. I'd love to see my additions in the next release. |
I just tested this, and it works. It has the limitation that the icon doesn't show up if you don't put it in |
@imcovangent I opened a PR from your fork in #477, will test that too |
@imcovangent if we can make the SVG setup from you work, I'm happy to review, merge it and then get a new release out. |
This lets you set which row of the launcher the icon ends up on (Notebook, Console, or Other). Just pass a configured launcher_entry.category through to launcher.add, defaulting to Notebook. Also adds documentation for existing
path_info
which was missing.