diff options
| author | 2026-02-12 09:30:11 -0800 | |
|---|---|---|
| committer | 2026-02-12 09:30:11 -0800 | |
| commit | 24d3e7199488eef8a94a66a6bf48443cc72e2cab (patch) | |
| tree | df10f94509b633b359c6ad89259f7545812cf740 | |
| parent | 478b5ce29973160d13fecf6b93c58897258c97b4 (diff) | |
| download | new-dotfiles-24d3e7199488eef8a94a66a6bf48443cc72e2cab.tar.gz new-dotfiles-24d3e7199488eef8a94a66a6bf48443cc72e2cab.zip | |
glide: Fix ‘open_or_activate’ for specific urls
If the hostname is found, but the rest of the path is not, then open a new tab.
Before it would assume that if we found the hostname we would also find the
path, because when there is no path this is always true, but when we get
open_or_activate for (for example) ‘https://github.com/ryuslash/yoshi-theme’ and
there is another tab open on ‘https://github.com/emacs-slack/emacs-slack’ we can
find the host, but not the path.
| -rw-r--r-- | glide/.config/glide/glide.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/glide/.config/glide/glide.ts b/glide/.config/glide/glide.ts index 644df7a..9579c06 100644 --- a/glide/.config/glide/glide.ts +++ b/glide/.config/glide/glide.ts @@ -99,10 +99,10 @@ async function open_or_activate(url) { const tabs = await glide.tabs.query({url: `*://${url.hostname}/*`}); const tab = tabs.find(t => t.url.startsWith(url.href)); - if (tabs.length === 0) { - glide.excmds.execute(`tab_new ${url}`); - } else { + if (tab) { await browser.tabs.update(tab.id, { active: true }); + } else { + glide.excmds.execute(`tab_new ${url}`); } } |
