diff --git a/web-launcher/README.md b/web-launcher/README.md index 2bf55ef..f8bd1d1 100644 --- a/web-launcher/README.md +++ b/web-launcher/README.md @@ -26,6 +26,7 @@ You can customize the list and order of websites in settings. | --- | --- | --- | --- | | `links` | `string_list` | `see below` | Websites list and order. | | `notify` | `bool` | `false` | Toggle notification when launching website. | +| `icon_provider` | `select` | `google` | Icon download source. | Default links: ``` diff --git a/web-launcher/launcher.luau b/web-launcher/launcher.luau index 63c5dce..7da4214 100644 --- a/web-launcher/launcher.luau +++ b/web-launcher/launcher.luau @@ -29,13 +29,25 @@ local function extractDomain(url) end local function faviconUrl(domain) - return "https://www.google.com/s2/favicons?sz=64&domain=" .. noctalia.string.urlEncode(domain) + local provider = noctalia.getConfig("icon_provider") + local encoded = noctalia.string.urlEncode(domain) + + if provider == "duckduckgo" then + return "https://icons.duckduckgo.com/ip3/" .. encoded .. ".ico" + elseif provider == "direct" then + return "https://" .. domain .. "/favicon.ico" + else + return "https://www.google.com/s2/favicons?sz=64&domain=" .. encoded + end end local function faviconCachePath(domain) + local provider = noctalia.getConfig("icon_provider") + local dir = noctalia.pluginDir() .. "/cache" local safe = domain:gsub("[^%w%.%-]", "_") - local path = dir .. "/" .. safe .. ".png" + + local path = dir .. "/" .. safe .. "_" .. provider .. ".png" return path, dir end diff --git a/web-launcher/plugin.toml b/web-launcher/plugin.toml index a4f8068..6e43d45 100644 --- a/web-launcher/plugin.toml +++ b/web-launcher/plugin.toml @@ -33,3 +33,15 @@ type = "bool" label_key = "settings.notify.label" description_key = "settings.notify.description" default = true + +[[setting]] +key = "icon_provider" +type = "select" +label_key = "settings.icon_provider.label" +description_key = "settings.icon_provider.description" +default = "google" +options = [ + { value = "google", label_key = "settings.icon_provider.google" }, + { value = "duckduckgo", label_key = "settings.icon_provider.duckduckgo" }, + { value = "direct", label_key = "settings.icon_provider.direct" }, +] diff --git a/web-launcher/translations/en.json b/web-launcher/translations/en.json index a64023c..486fc3f 100644 --- a/web-launcher/translations/en.json +++ b/web-launcher/translations/en.json @@ -7,6 +7,13 @@ "notify": { "label": "Notify", "description": "Notify when opening link." + }, + "icon_provider": { + "label": "Icon Provider", + "description": "Icon download source.", + "google": "Google", + "duckduckgo": "DuckDuckGo", + "direct": "Site's own favicon.ico" } } }