Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

1.1 KB
Raw Blame
package gui

import "time"

// Lightweight mode (settings.Lightweight, #580): a window closed — the
// panel or the main window — has its webview let go once it has stayed
// closed a while, and is made again the next time it is opened. Its web
// content process (a hundred MB or so on a Mac) ends with it; the next open
// draws the page from the start, a moment's wait.

// lightEvery is how often the closed windows are looked at, and lightTicks
// how many looks in a row have to find one closed before it goes: a window
// is let go 30 to 60 s after it was closed, so a panel opened again soon
// after is the same one, at once.
const (
	lightEvery = 30 * time.Second
	lightTicks = 2
)

// lightStep is one look at a window: ticks is how many looks in a row have
// found it closed before this one. It says that count now and whether the
// window's webview is to go. With the mode off, or the window shown, the
// count starts over.
func lightStep(on, shown bool, ticks int) (int, bool) {
	if !on || shown {
		return 0, false
	}
	ticks++
	return ticks, ticks >= lightTicks
}