-
Notifications
You must be signed in to change notification settings - Fork 6.3k
-
Is it possible to customise the "Go Home" link in the application menu?
Screenshot 2020年10月28日 at 12 19 51
Currently it leads to the github page of vscode. I would like to instead forward to my web application from which the editor was opened.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
This has been added and should be available in the next release!
See the upcoming docs to learn how you'll be able to utilize it.
Thanks @ykazakov for starting this discussion!
PR #2435
Replies: 5 comments 16 replies
-
Beta Was this translation helpful? Give feedback.
All reactions
-
How would you customize it? As command-line options or in some application settings?
Looking for something similar/related noticed that on the welcome screen (Menu>Help>Welcome) many links below Help are non-functional:
- Printable keyboard cheatsheet
- Introductory videos
- Tips and tricks
- Product documentation
Are they hardcoded as well or can they be configured?
I just think that adding lots of command-line options is not the best solution to customize something like this.
Beta Was this translation helpful? Give feedback.
All reactions
-
Good catch, all those welcome links are supposed to work so I think we'd
categorize them as bugs and get them fixed.
A --home command-line flag could work, and that would also make it
possible to specify home in ~/.config/code-server/config.yaml.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
-
I was looking for exactly such option, so definitely a +1 here
Beta Was this translation helpful? Give feedback.
All reactions
-
Maybe the links did not suppose to work because they are specific to vscode?
The --home flag seems a reasonable option, I was just wondering how (other) links are set in vscode and to what extent are they customisable.
Beta Was this translation helpful? Give feedback.
All reactions
-
Fair question. I'm not completely sure so we'll need to poke around and see. If we do end up needing to customize additional links maybe we can use our config file instead of command line flags.
Beta Was this translation helpful? Give feedback.
All reactions
-
@code-asher any prospect of moving forward on this? I am happy to contribute a PR but I could use some pointers on where to look for the values
Beta Was this translation helpful? Give feedback.
All reactions
-
I don't think it'll be on my radar for a while yet. A PR would definitely be welcome!
In the patch there is an initialize method in lib/vscode/vs/server/node/server.ts that returns an object with a workbenchWebConfiguration property. That fulfills an interface which is a partial copy of VS Code's IWorkbenchConstructionOptions. In IWorkbenchConstructionOptions there is a homeIndicator property we could copy to our interface then add to workbenchWebConfiguration.
Unfortunately VS Code then overrides that with a hardcoded home indicator in lib/vscode/src/vs/code/browser/workbench/workbench.ts#L458 so we'll also need to remove that override.
Assuming that works, from there we'd just need to add home to our CLI options and related interfaces.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
This has been added and should be available in the next release!
See the upcoming docs to learn how you'll be able to utilize it.
Thanks @ykazakov for starting this discussion!
PR #2435
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 3 -
❤️ 3 -
🚀 2
-
OK, that should at least fix the broken link.
However, it will probably not handle logout in our case. As I mentioned, the cookie is always set by the web server (tornado used by JupyterHub), even if it gets deleted by code-server. I can possibly add some handler to the web server for the /login path, but I cannot distinguish based on this path whether the user wants to login or logout.
A bit better solution, from my opinion, would be to add another path, say /logout which handles cookie delete and other cleanup, and redirects to /login. Then I can handle this path from the web server and redirect to whatever I want.
Of course, if the logout path could be configured then it would be even easier to handle for us. But I can see that adding another command line option might be not the cleanest solution.
Beta Was this translation helpful? Give feedback.
All reactions
-
going back to the original topic of Go Home menu item, is there any chance for this to make a comeback at some point? We're running code-server in JupyterHub and it was very useful to be able to go back to the main hub menu.
Beta Was this translation helpful? Give feedback.
All reactions
-
@ykazakov That's perfect! I wanted us to redirect to a /logout page so we could do the cleanup on the server instead of via JavaScript. We'll do that as part of #2984.
@bruwozniak I think at the moment we don't have any plans for that, we mostly only make patches to VS Code for bug fixes. But we did plan on having some kind of overlay at some point, maybe that would be a good place to add a home link.
Or...actually, we soon plan on shipping a built-in extension with VS Code to provide some helpful functionality much like the remote extensions do. So we could probably add a menu item through the extension that way we don't need to mess with VS Code itself.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
That sounds valid, I suppose it would be quite easy to use the extension API to add such menu item. Looking forward to the extension code release then 👍
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 2
-
Excellent plan! I guess for now I can handle /logout. Look forward to the extension as well!
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1 -
🎉 1
-
What is the progress of this issue? This is a feature I need!
Beta Was this translation helpful? Give feedback.
All reactions
-
The "Go Home" link seems to be gone now, so I do not think we will be patching anything here.
I think it is possible to add menu items via an extension, so that might be the best way to implement, if someone wants to try.
Beta Was this translation helpful? Give feedback.