mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-05-20 17:47:19 +00:00
feat(extensions): hide agent tabs for providers with no data
The All / Claude / Codex / Cursor / Copilot tab row was fixed regardless of which providers the user actually had installed, which made most of the tabs render as $0 for people who only run one tool. Scan the expected session directories on startup and only build tabs for providers that are present. If two or more are detected, show "All" plus those providers; if fewer than two are detected, skip the row entirely since there is nothing to filter. Paths checked: $HOME/.claude/projects (Claude Code) $HOME/.codex/sessions (Codex CLI) $HOME/.config/Cursor/User/globalStorage/state.vscdb (Cursor IDE) $HOME/.copilot/session-state (GitHub Copilot)
This commit is contained in:
parent
d47658c91d
commit
6e354c17ed
1 changed files with 36 additions and 1 deletions
|
|
@ -73,6 +73,7 @@ class CodeburnIndicator extends PanelMenu.Button {
|
|||
this._loading = false;
|
||||
this._timeout = null;
|
||||
this._payload = null;
|
||||
this._availableProviders = this._detectAvailableProviders();
|
||||
|
||||
this._themeSettings = new Gio.Settings({schema_id: 'org.gnome.desktop.interface'});
|
||||
this._themeSignal = this._themeSettings.connect('changed::color-scheme', () => this._applyThemeClass());
|
||||
|
|
@ -142,9 +143,24 @@ class CodeburnIndicator extends PanelMenu.Button {
|
|||
}
|
||||
|
||||
_buildAgentTabs() {
|
||||
// Only show the tab row when at least two providers have data on this
|
||||
// machine. A single provider (or none) means there's nothing to filter,
|
||||
// so we skip the row entirely and leave this._provider = 'all'.
|
||||
const detected = this._availableProviders;
|
||||
if (detected.length < 2) {
|
||||
this._agentTabs = new Map();
|
||||
return;
|
||||
}
|
||||
// Build tab list: "All" first, then every detected provider in our
|
||||
// preferred order.
|
||||
const tabs = [PROVIDERS[0]]; // 'All'
|
||||
for (const p of PROVIDERS.slice(1)) {
|
||||
if (detected.includes(p.id)) tabs.push(p);
|
||||
}
|
||||
|
||||
const row = new St.BoxLayout({style_class: 'codeburn-tab-row'});
|
||||
this._agentTabs = new Map();
|
||||
for (const p of PROVIDERS) {
|
||||
for (const p of tabs) {
|
||||
const btn = new St.Button({
|
||||
label: p.label,
|
||||
style_class: 'codeburn-tab',
|
||||
|
|
@ -163,6 +179,25 @@ class CodeburnIndicator extends PanelMenu.Button {
|
|||
this._updateAgentTabStyle();
|
||||
}
|
||||
|
||||
/// Scan the home directory for provider session stores so the agent tab row
|
||||
/// can only offer providers the user actually runs. Checks file/dir existence
|
||||
/// only; the CLI still owns real "has usable data" semantics.
|
||||
_detectAvailableProviders() {
|
||||
const home = GLib.get_home_dir();
|
||||
const paths = {
|
||||
claude: `${home}/.claude/projects`,
|
||||
codex: `${home}/.codex/sessions`,
|
||||
cursor: `${home}/.config/Cursor/User/globalStorage/state.vscdb`,
|
||||
copilot: `${home}/.copilot/session-state`,
|
||||
};
|
||||
const out = [];
|
||||
for (const [id, path] of Object.entries(paths)) {
|
||||
const file = Gio.File.new_for_path(path);
|
||||
if (file.query_exists(null)) out.push(id);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
_updateAgentTabStyle() {
|
||||
for (const [id, btn] of this._agentTabs) {
|
||||
if (id === this._provider) btn.add_style_class_name('codeburn-tab-active');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue