Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Icons for file:// urls #6

Open
playerofgames opened this issue Aug 5, 2022 · 2 comments
Open

Icons for file:// urls #6

playerofgames opened this issue Aug 5, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@playerofgames
Copy link

playerofgames commented Aug 5, 2022

For local file URLs, there is no favIcon, but there is a blank space.

I can think of a couple of options for this:

  1. no favicon (and no space)
  2. generic icon for file (or even look at the extension)

I've gone with the second option, using

function getIconSrc(href) {
    if (href.startsWith("file:")) {
        return "data:image/svg+xml,%3Csvg width='24' height='24' fill='none' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18.5 20a.5.5 0 0 1-.5.5H6a.5.5 0 0 1-.5-.5V4a.5.5 0 0 1 .5-.5h6V8a2 2 0 0 0 2 2h4.5v10Zm-5-15.379L17.378 8.5H14a.5.5 0 0 1-.5-.5V4.621Zm5.914 3.793-5.829-5.828c-.026-.026-.058-.046-.085-.07a2.072 2.072 0 0 0-.219-.18c-.04-.027-.086-.045-.128-.068-.071-.04-.141-.084-.216-.116a1.977 1.977 0 0 0-.624-.138C12.266 2.011 12.22 2 12.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9.828a2 2 0 0 0-.586-1.414Z' fill='%23808080'/%3E%3C/svg%3E";
    }
    const { hostname } = new URL(href);
    return `https://www.google.com/s2/favicons?domain=${hostname}&sz=32`;
}

with an embedded SVG outline icon from Fluent, but a local assets might be better.

Screenshot 2022-08-05 at 11 56 19

Screenshot 2022-08-05 at 11 56 15

@0x7b1
Copy link
Owner

0x7b1 commented Aug 9, 2022

Hey! thanks for the suggestion. I will definitely include it in the next release :)

@0x7b1 0x7b1 added the enhancement New feature or request label Aug 9, 2022
@cquwyz
Copy link

cquwyz commented Dec 14, 2022

Where can I use these codes to configure? Or do I just have to wait for the next version update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants