diff options
| author | 2026-05-06 17:48:34 -0700 | |
|---|---|---|
| committer | 2026-05-06 17:49:09 -0700 | |
| commit | 2ac4ea5192111ebcca025885d1451c09ddfe25bd (patch) | |
| tree | bacb8cbd3721ce472ea26947415071da09b83ff2 /glide | |
| parent | 7526a5d3de84422cdf1489e2ed568b486fcc3a07 (diff) | |
| download | new-dotfiles-2ac4ea5192111ebcca025885d1451c09ddfe25bd.tar.gz new-dotfiles-2ac4ea5192111ebcca025885d1451c09ddfe25bd.zip | |
glide: Add tab group functions
Diffstat (limited to 'glide')
| -rw-r--r-- | glide/.config/glide/glide.ts | 40 | ||||
| -rw-r--r-- | glide/.config/glide/tabbar.glide.ts | 8 |
2 files changed, 47 insertions, 1 deletions
diff --git a/glide/.config/glide/glide.ts b/glide/.config/glide/glide.ts index d508405..295c590 100644 --- a/glide/.config/glide/glide.ts +++ b/glide/.config/glide/glide.ts @@ -371,6 +371,46 @@ glide.keymaps.set('normal', '<C-x>1', 'keep_window'); glide.keymaps.set('normal', '<C-x>0', 'delete_window'); glide.keymaps.set('normal', '<A-o>', 'other_window'); +// Groups + +const group_tab = glide.excmds.create({ + name: 'group_tab', + description: 'Add the current tab to a group.' +}, async ({ tab_id }) => { + const groups = await browser.tabGroups.query({}); + glide.commandline.show({ + title: "group", + options: groups.map((group) => ({ + label: group.title, + async execute({ input }) { + if (group.title.indexOf(input) >= 0) { + await browser.tabs.group({ + groupId: group.id, + tabIds: [tab_id], + }); + } else { + const groupId = await browser.tabs.group({ + tabIds: [tab_id], + }); + await browser.tabGroups.update(groupId, { + title: input, + }); + } + }, + })), + }); +}); + +const ungroup_tab = glide.excmds.create({ + name: 'ungroup_tab', + description: 'Remove the current tab from any group.' +}, async ({ tab_id }) => { + await browser.tabs.ungroup([ tab_id ]); +}); + +glide.keymaps.set('normal', 'ag', 'group_tab'); +glide.keymaps.set('normal', 'kg', 'ungroup_tab'); + glide.include('sitesearch.glide.ts'); glide.include('tabbar.glide.ts'); diff --git a/glide/.config/glide/tabbar.glide.ts b/glide/.config/glide/tabbar.glide.ts index dd4cf27..5cc6647 100644 --- a/glide/.config/glide/tabbar.glide.ts +++ b/glide/.config/glide/tabbar.glide.ts @@ -134,6 +134,12 @@ async function update_status_bar() { const url = active_tab.url; const title = active_tab.title || "Untitled"; + let groupDisplay = ""; + if (active_tab.groupId >= 0) { + const group = await browser.tabGroups.get(active_tab.groupId); + groupDisplay = `[${group.title}] | `; + } + let display_url = url || "about:blank"; if (display_url.length > 50) { @@ -141,7 +147,7 @@ async function update_status_bar() { } tabs_container.textContent = `${mode} [${tab_index + 1}/${tabs.length}]`; - right.textContent = `${title} | ${display_url}`; + right.textContent = `${groupDisplay}${title} | ${display_url}`; } catch (e) { tabs_container.textContent = e; right.textContent = "Error loading tabs" |
