Open AndrienkoAleksandr opened 5 years ago
Not only that, we need a icon on the left pane just like Gitpod Theia.
@kittaakos can you perhaps share on how gitpod achieved this? The only way I could see updating the icon in the menu-bar was by editing the css (theia-icon
) from core.
can you perhaps share on how gitpod achieved this
I do not know.
I was able to test and add a custom favicon
to the main application by updating
the frontend-generator.ts
. Where we generate the <head></head>
portion, I included the following link tag.
<link rel="icon" href={url} type="image/x-icon">
The only issue I had was getting the image served by the server. When using an external image (such as one hosted already) the icon was displayed correctly.
The next step would be to find out how to properly serve internal icons as a favicon
and make it much easier for extenders to update it.
Thank you for opening this issue. Has there been any update on making it easy for extensions to set a favicon?
For anyone that is desperate for a favicon, here's a little command you can run to add a favicon to your theia web ide:
cd your_theia_folder/lib && wget https://raw.githubusercontent.com/theia-ide/theia-apps/master/theia-electron/resources/icon.ico && sed -i 's/<meta charset/<link rel="icon" href=".\/icon.ico" type="image\/x-icon">\n <meta charset=/' index.html
It work for me in this method preloadTemplate
.
In package.json
"theia": {
"generator": {
"config": {
"preloadTemplate": "preloadTemplate.html"
}
}
}
in preloadTemplate.html
<div>Loading view.......</div>
<script>
if (document.head) {
let faviconLinkTag = document.createElement('link');
faviconLinkTag.rel = 'icon';
faviconLinkTag.href = 'http://your_favicon.ico';
document.head.appendChild(faviconLinkTag);
}
</script>
@vince-fugnitto Do you have a preferred way to add a favicon to a custom product? If so, we should document it.
@JonasHelming probably a good way to document it would be to include it as an example in theia-blueprint
? It currently does not make use of the favicon
(as can be seen in the browser's tab):
Yes, that makes sense. I was more interest in your view, which of the above described options to customize it you prefer as the officially documented one?
Hello everyone! Any news about favicon?
@capsulated This topic has been effectively resolved in this comment.
It work for me in this method
preloadTemplate
. In package.json"theia": { "generator": { "config": { "preloadTemplate": "preloadTemplate.html" } } }
in
preloadTemplate.html
<div>Loading view.......</div> <script> if (document.head) { let faviconLinkTag = document.createElement('link'); faviconLinkTag.rel = 'icon'; faviconLinkTag.href = 'http://your_favicon.ico'; document.head.appendChild(faviconLinkTag); } </script>
Just to make sure: there is supposedly more in the preloadTemplate.html? I can't seem to get this to work... Would be very thankful for a helping hand for a Theia novice...
@capsulated This topic has been effectively resolved in this comment.
@msujew Thanks, that is works!
Branding: Theia should has favicon icon.