Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Customizing "Go Home" #2245

Answered by jsjoeio
ykazakov asked this question in Ideas
Oct 28, 2020 · 5 comments · 16 replies
Discussion options

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.

You must be logged in to vote

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

Comment options

It appears to be hardcoded. I was going to remove it but we could definitely make it customizable instead.
You must be logged in to vote
3 replies
Comment options

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.

Comment options

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.

Comment options

I was looking for exactly such option, so definitely a +1 here

Comment options

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.

You must be logged in to vote
1 reply
Comment options

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.

Comment options

@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

You must be logged in to vote
1 reply
Comment options

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.

Comment options

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

You must be logged in to vote
10 replies
Comment options

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.

Comment options

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.

Comment options

@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.

Comment options

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 👍

Comment options

Excellent plan! I guess for now I can handle /logout. Look forward to the extension as well!

Answer selected by jsjoeio
Comment options

What is the progress of this issue? This is a feature I need!

You must be logged in to vote
1 reply
Comment options

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /