Repository navigation
Custom icons for extensions and commands #949
Replies: 7 comments 3 replies
|
Hey @BennoCrafter thanks for opening this. I wanted to do my own research first. I held off on this feature for a long time because I wanted it to look good and stay fast. I agree with your direction. Below is what I found, and where I'd go a bit further so we fix the base once instead of patching each spot. Some of this is already broken todayThe problem is bigger than "emoji only":
All of these have one root cause: there's no single place that turns an icon into something we can show. Every component and every scheme does its own thing. So I want to build that one place properly. The core: one typed icon, resolved in Rust
One
|
|
Removing 64px are enough for a 24px row at the launcher, but the settings detail panel render larger. The object forpm should be a tagged union. {source, dark, tint} and {glyph, color} exclude each other, so the schema needs to say so. The CLI should detect them and reject mixed forms. But mostly I agree with all of your points :) |
|
Hey @BennoCrafter, thanks, I went through each point in the code. CSP. You're right, removing
Because README images and user content can come from any host, I won't remove Icon size. Good catch, and it goes further than the Settings panel. Asyar also runs on Windows and Linux, where high-DPI screens often use 150–300% scaling. At 300%, a 22px launcher row needs 66px and the 28px Settings icon needs 84px, so 64px is too small there. I'll store a 128px copy instead. That covers every surface we have today at up to 300%, and it's still only about 64 KB in memory once decoded, compared to about 1 MB for a 512px original. It's made once at install, and the same file is used everywhere. SVGs stay as they are. Tagged union. Agreed. The manifest checks live in the CLI (
Mixing them (for example Updated order
Since we agree on the direction, step 1 is yours if you still want it. Tell me if you'd like to split it differently. |
|
@Xoshbin yeah great! I’ll start working asap on point 1 |
|
@Xoshbin assign yourself to step 2! When completed I can work on step 3 |
|
Hey @BennoCrafter Step 2 is implemented, let me know if you can assign yourself for step 3. |
Uh oh!
There was an error while loading. Please reload this page.
Following up on the Discord chat about custom icons. I took a look at how asyar is currently handling icons and it's mostly implemented.
Proposal
When extensions are discovered, turn relative
manifest.iconandcommands[].iconintoasyar-extension://{id}/{path}. Reject..and absolute paths, and fall back to the default icon. Remove the duplicated resolution inextensionStateManager. Emoji andicon:keep working, so existing extensions don't deprecaete.Apply the same normalization to commands registered at runtime,
ActionType.iconandNotificationType.icon.Replace the repeated emoji/
icon:/image branching inLauncherListRow,ActionListPopup,SearchHeader,InformationPanelandExtensionDetailPanelwith one component.monochrome icons can be recolored with CSS
mask-imagefilled withcurrentColor. Detect them with e.g.*-template.svgor atintflag later.extension SVGs only go through
<img>or a CSS mask, never{@html}, so scripts inside an SVG never run.files live in
public/assets/. Vite copies them intodist/, and the existing zip step packages them.Take the extension icon out of the package during publish, or upload it separately, so the store page can show it.
The CSP allows
https://**, so an extension icon can be a remote URL. Every launcher search would then contact a third-party server, which leaks the user's IP address. I'd suggest allowing only bundled files,data:andicon:for extension icons.I'm happy to start there if this direction sounds good.
All reactions