-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Reclaim offscreen terminal renderer GPU memory (IOSurface) non-destructively #5857
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
157fa87
f827c53
a0bcc73
c6ceb19
b64af83
1851c92
731f22a
a071eb0
604e1ce
e327286
051e21d
6b26d0c
4730951
5fb0756
66572f6
e454320
aef6409
2d4975d
5af7b67
6a342e6
27cd310
3b3854c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,9 @@ public struct TerminalSection: View { | |
| @State private var hibernation: DefaultsValueModel<Bool> | ||
| @State private var idleSeconds: DefaultsValueModel<Double> | ||
| @State private var maxLive: DefaultsValueModel<Int> | ||
| @State private var rendererReclaim: DefaultsValueModel<Bool> | ||
| @State private var rendererIdleSeconds: DefaultsValueModel<Double> | ||
| @State private var rendererMaxWarm: DefaultsValueModel<Int> | ||
|
|
||
| public init( | ||
| defaultsStore: UserDefaultsSettingsStore, | ||
|
|
@@ -37,6 +40,9 @@ public struct TerminalSection: View { | |
| _hibernation = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.terminal.agentHibernationEnabled)) | ||
| _idleSeconds = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.terminal.agentHibernationIdleSeconds)) | ||
| _maxLive = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.terminal.agentHibernationMaxLiveTerminals)) | ||
| _rendererReclaim = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.terminal.rendererRealizationEnabled)) | ||
| _rendererIdleSeconds = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.terminal.rendererRealizationIdleSeconds)) | ||
| _rendererMaxWarm = State(initialValue: DefaultsValueModel(store: defaultsStore, key: catalog.terminal.rendererRealizationMaxWarmRenderers)) | ||
| } | ||
|
|
||
| public var body: some View { | ||
|
|
@@ -210,6 +216,49 @@ public struct TerminalSection: View { | |
| ) | ||
| .accessibilityIdentifier("SettingsTerminalAgentHibernationMaxLiveStepper") | ||
| } | ||
| SettingsCardDivider() | ||
| SettingsCardRow( | ||
| configurationReview: .json("terminal.rendererRealization.enabled"), | ||
| String(localized: "settings.terminal.rendererRealization", defaultValue: "Reclaim Offscreen Terminal Memory"), | ||
| subtitle: rendererReclaim.current | ||
| ? String(localized: "settings.terminal.rendererRealization.subtitleOn", defaultValue: "Off-screen terminals release their GPU renderer memory while idle and rebuild it instantly when you switch back. The process keeps running.") | ||
| : String(localized: "settings.terminal.rendererRealization.subtitleOff", defaultValue: "Every visited terminal keeps its full GPU renderer allocated until you close it, even when off-screen.") | ||
| ) { | ||
| Toggle("", isOn: Binding(get: { rendererReclaim.current }, set: { rendererReclaim.set($0) })) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When this toggle is changed in the Settings UI, Useful? React with 👍 / 👎. |
||
| .labelsHidden() | ||
| .controlSize(.small) | ||
| .accessibilityIdentifier("SettingsTerminalRendererRealizationToggle") | ||
| } | ||
| SettingsCardDivider() | ||
| SettingsCardRow( | ||
| configurationReview: .json("terminal.rendererRealization.idleSeconds"), | ||
| String(localized: "settings.terminal.rendererRealization.idleSeconds", defaultValue: "Reclaim After Idle Seconds"), | ||
| subtitle: String(localized: "settings.terminal.rendererRealization.idleSeconds.subtitle", defaultValue: "An off-screen terminal must stay off-screen this long before its renderer memory is reclaimed."), | ||
| controlWidth: 140 | ||
| ) { | ||
| Stepper( | ||
| "\(Int(rendererIdleSeconds.current))", | ||
| value: Binding(get: { rendererIdleSeconds.current }, set: { rendererIdleSeconds.set($0) }), | ||
| in: 5...604_800, | ||
| step: 10 | ||
| ) | ||
| .accessibilityIdentifier("SettingsTerminalRendererRealizationIdleSecondsStepper") | ||
| } | ||
| SettingsCardDivider() | ||
| SettingsCardRow( | ||
| configurationReview: .json("terminal.rendererRealization.maxWarmRenderers"), | ||
| String(localized: "settings.terminal.rendererRealization.maxWarmRenderers", defaultValue: "Max Warm Renderers"), | ||
| subtitle: String(localized: "settings.terminal.rendererRealization.maxWarmRenderers.subtitle", defaultValue: "The most recently visible terminals keep their renderer ready so switching stays instant. Extra off-screen renderers are reclaimed oldest first."), | ||
| controlWidth: 120 | ||
| ) { | ||
| Stepper( | ||
| "\(rendererMaxWarm.current)", | ||
| value: Binding(get: { rendererMaxWarm.current }, set: { rendererMaxWarm.set($0) }), | ||
| in: 1...256, | ||
| step: 1 | ||
| ) | ||
| .accessibilityIdentifier("SettingsTerminalRendererRealizationMaxWarmStepper") | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new curated entries feed
SettingsSearchIndex.Entry.title, whichSettingsSidebarEntryRowrenders as the user-facing Settings search result title; adding English literals here means the Japanese Settings search sidebar shows these renderer settings in English even though the actual rows were localized inLocalizable.xcstrings. Please use localized strings for the new titles (and add the corresponding catalog entries) so search results match the localized settings UI.Useful? React with 👍 / 👎.