Skip to content

feat: add custom workspace icons#922

Open
jakehwll wants to merge 1 commit intomainfrom
jakehwll/workspace-icons
Open

feat: add custom workspace icons#922
jakehwll wants to merge 1 commit intomainfrom
jakehwll/workspace-icons

Conversation

@jakehwll
Copy link
Copy Markdown

@jakehwll jakehwll commented Apr 29, 2026

Updated workspace tree items to resolve app/workspace icon strings into VS Code URIs and restored the default logo fallback when the icon is missing or invalid.

  • Added URL resolution for workspace template icons and app icons.
  • Preserved the original default logo-black.svg / logo-white.svg fallback.
  • Kept tree items using the default icon only when no valid custom icon is available.
image

Co-authored-by: Copilot <copilot@github.com>
@jakehwll jakehwll requested a review from EhabY April 29, 2026 03:36
@jakehwll jakehwll changed the title fix: add custom workspace icons feat: add custom workspace icons Apr 29, 2026
Comment on lines +268 to +270
icon: app.icon,
},
this.client.getAxiosInstance().defaults.baseURL,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should pass the resolved icon instead of the baseUrl here (esp. since it should always be defined). That way we do not leak abstraction into the AppStatusTreeItem which shouldn't be aware of those details

Comment on lines +374 to +381
const trimmed = icon.trim();
if (/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(trimmed)) {
return vscode.Uri.parse(trimmed);
}

if (!baseUrl) {
return undefined;
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed, the URL implements WHATWG resolution semantics, so:

new URL("https://x/y.svg", "https://base/").toString() // "https://x/y.svg"
new URL("/icon.svg",      "https://base/").toString() // "https://base/icon.svg"                                                      
new URL("data:image/png;base64,...", "https://base/").toString() // unchanged

} {
return {
light: vscode.Uri.file(
path.join(__dirname, "..", "..", "media", "logo-black.svg"),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong now, it used to be __filename then traversing up by two levels but now it's __dirname but by two levels as well

Comment on lines +417 to +419
super(app.name, vscode.TreeItemCollapsibleState.None);
this.id = app.id;
this.description = app.name;
this.description = app.workspace_name;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly name here is confusing, this is status.message which is why it was rendered in the description (to make it less prominent). How would this currently look like actually?

If we want the status to be more prominent here then maybe we just show app.display_name ?? app.slug in the description? Since the workspace name is already the parent (or grandparent) so no need to repeat it

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants