mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Add independent controls for TUI visual effects (#46832)
## What changed Replace `tui.whimsy` with `[tui.effects]` preferences for `starfield`, `shimmer`, `welcome`, `effort`, `progress`, and `title`. Each defaults to `true` and remains subordinate to the `tui.animations` master switch. Wire the preferences into composer effects, welcome artwork, status and loading text, progress indicators, and terminal-title animations. For example, disable shimmering text while keeping progress animations: ```toml [tui.effects] shimmer = false ``` Keep retired `tui.whimsy` entries loadable but ignore their value. Update the configuration schema to expose the new preferences. ## Testing Add and extend coverage for independent shimmer and progress effects, master-switch precedence, welcome and starfield controls, terminal-title blinking, and strict configuration loading with the retired setting. GitOrigin-RevId: 28b37ba52872133b8954543cabe9ff424147f1c5
This commit is contained in:
@@ -182,7 +182,7 @@
|
||||
//! focus loss hide the field without restarting that deadline. Rendering runs after the textarea,
|
||||
//! placeholder, effort ignition, and voice strip, and draws only in eligible blank cells without
|
||||
//! overwriting the placeholder or normal cursor. Hidden frames do not schedule animation redraws;
|
||||
//! motion settings, whimsy settings, and true-color support also gate the effect.
|
||||
//! motion settings, the starfield preference, and true-color support also gate the effect.
|
||||
//!
|
||||
//! # Large Paste Placeholders
|
||||
//!
|
||||
|
||||
@@ -30,6 +30,7 @@ fn draft_and_voice_composer_snapshots() {
|
||||
speaker_history: vec![255, 146, 110, 73, 37, 0],
|
||||
activity: "listening",
|
||||
animations: false,
|
||||
progress: true,
|
||||
}),
|
||||
FrameRequester::test_dummy(),
|
||||
);
|
||||
|
||||
@@ -97,7 +97,7 @@ impl BottomPane {
|
||||
SparkleDraft::Untouched | SparkleDraft::Command
|
||||
) && self.composer.sparkle.phase.get() == Phase::Unarmed
|
||||
&& settings.animations
|
||||
&& settings.whimsy
|
||||
&& settings.effects.starfield
|
||||
&& Self::is_sparkle_model(model)
|
||||
{
|
||||
self.composer.sparkle.phase.set(Phase::Waiting);
|
||||
@@ -112,7 +112,7 @@ impl BottomPane {
|
||||
}
|
||||
|
||||
pub(crate) fn stop_ineligible_sparkle(&self, model: &str, settings: &Tui) {
|
||||
if !settings.animations || !settings.whimsy || !Self::is_sparkle_model(model) {
|
||||
if !settings.animations || !settings.effects.starfield || !Self::is_sparkle_model(model) {
|
||||
self.composer.stop_visible_sparkle();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ fn pane() -> BottomPane {
|
||||
placeholder_text: "Ask Codex to do anything".into(),
|
||||
disable_paste_burst: true,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: None,
|
||||
})
|
||||
}
|
||||
@@ -43,7 +44,7 @@ fn palette<T>(render: impl FnOnce() -> T) -> T {
|
||||
fn enabled() -> Tui {
|
||||
Tui {
|
||||
animations: true,
|
||||
whimsy: true,
|
||||
effects: Default::default(),
|
||||
..Tui::default()
|
||||
}
|
||||
}
|
||||
@@ -1055,7 +1056,10 @@ fn focus_startup_work_and_configuration_do_not_extend_a_started_deadline() {
|
||||
|
||||
for settings in [
|
||||
Tui {
|
||||
whimsy: false,
|
||||
effects: codex_config::types::TuiEffects {
|
||||
starfield: false,
|
||||
..Default::default()
|
||||
},
|
||||
..enabled()
|
||||
},
|
||||
Tui {
|
||||
|
||||
@@ -291,6 +291,7 @@ pub(crate) struct BottomPane {
|
||||
is_task_running: bool,
|
||||
esc_backtrack_hint: bool,
|
||||
animations_enabled: bool,
|
||||
effects: codex_config::types::TuiEffects,
|
||||
|
||||
/// Inline status indicator shown above the composer while a task is running.
|
||||
status: Option<StatusIndicatorWidget>,
|
||||
@@ -321,6 +322,7 @@ pub(crate) struct BottomPaneParams {
|
||||
pub(crate) placeholder_text: String,
|
||||
pub(crate) disable_paste_burst: bool,
|
||||
pub(crate) animations_enabled: bool,
|
||||
pub(crate) effects: codex_config::types::TuiEffects,
|
||||
pub(crate) skills: Option<Vec<SkillMetadata>>,
|
||||
}
|
||||
|
||||
@@ -342,6 +344,7 @@ impl BottomPane {
|
||||
placeholder_text,
|
||||
disable_paste_burst,
|
||||
animations_enabled,
|
||||
effects,
|
||||
skills,
|
||||
} = params;
|
||||
let mut composer = ChatComposer::new_with_config(
|
||||
@@ -379,6 +382,7 @@ impl BottomPane {
|
||||
pending_thread_approvals: PendingThreadApprovals::new(),
|
||||
esc_backtrack_hint: false,
|
||||
animations_enabled,
|
||||
effects,
|
||||
context_window_percent: None,
|
||||
context_window_used_tokens: None,
|
||||
keymap,
|
||||
@@ -402,7 +406,7 @@ impl BottomPane {
|
||||
/// visible frame can play a one-shot Max/Ultra effect.
|
||||
pub(crate) fn set_active_reasoning_effort(&mut self, effort: Option<&ReasoningEffort>) {
|
||||
let animations_enabled = effort_ignition::effort_animation_enabled(
|
||||
self.animations_enabled,
|
||||
self.animations_enabled && self.effects.effort,
|
||||
effective_stdout_color_level(),
|
||||
);
|
||||
if self
|
||||
@@ -1283,6 +1287,7 @@ impl BottomPane {
|
||||
self.app_event_tx.clone(),
|
||||
self.frame_requester.clone(),
|
||||
self.animations_enabled,
|
||||
self.effects,
|
||||
));
|
||||
}
|
||||
if let Some(status) = self.status.as_mut() {
|
||||
@@ -1319,6 +1324,7 @@ impl BottomPane {
|
||||
self.app_event_tx.clone(),
|
||||
self.frame_requester.clone(),
|
||||
self.animations_enabled,
|
||||
self.effects,
|
||||
)
|
||||
});
|
||||
if let Some(status) = self.status.as_mut() {
|
||||
@@ -2107,7 +2113,7 @@ impl BottomPane {
|
||||
/*flex*/ 0,
|
||||
RenderableItem::Owned(Box::new(hook_status::HookStatus {
|
||||
message,
|
||||
animations_enabled: self.animations_enabled,
|
||||
animations_enabled: self.animations_enabled && self.effects.shimmer,
|
||||
})),
|
||||
);
|
||||
}
|
||||
@@ -2362,6 +2368,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
})
|
||||
}
|
||||
@@ -2623,6 +2630,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: true,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
pane.push_approval_request(exec_request(), &features);
|
||||
@@ -2643,6 +2651,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: true,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
pane.insert_str("draft");
|
||||
@@ -2676,6 +2685,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3001,6 +3011,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3068,6 +3079,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3142,6 +3154,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3173,6 +3186,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3196,6 +3210,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3225,6 +3240,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3262,6 +3278,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3294,6 +3311,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3325,6 +3343,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3354,6 +3373,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3377,6 +3397,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(vec![SkillMetadata {
|
||||
name: "test-skill".to_string(),
|
||||
description: "test skill".to_string(),
|
||||
@@ -3425,6 +3446,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3493,6 +3515,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3529,6 +3552,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3577,6 +3601,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3702,6 +3727,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3750,6 +3776,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
@@ -3828,6 +3855,7 @@ mod tests {
|
||||
placeholder_text: "Ask Codex to do anything".to_string(),
|
||||
disable_paste_burst: false,
|
||||
animations_enabled: true,
|
||||
effects: Default::default(),
|
||||
skills: Some(Vec::new()),
|
||||
});
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ pub(crate) struct VoiceStripState {
|
||||
pub(crate) speaker_history: Vec<u8>,
|
||||
pub(crate) activity: &'static str,
|
||||
pub(crate) animations: bool,
|
||||
pub(crate) progress: bool,
|
||||
}
|
||||
|
||||
pub(super) struct VoiceStrip {
|
||||
@@ -84,7 +85,8 @@ impl Renderable for VoiceStrip {
|
||||
return;
|
||||
}
|
||||
let connecting = self.state.phase == VoiceStripPhase::Connecting;
|
||||
let mode = MotionMode::from_animations_enabled(self.state.animations);
|
||||
let mode =
|
||||
MotionMode::from_animations_enabled(self.state.animations && self.state.progress);
|
||||
if connecting && mode == MotionMode::Animated {
|
||||
self.frame_requester
|
||||
.schedule_frame_in(Duration::from_millis(100));
|
||||
|
||||
@@ -20,6 +20,7 @@ fn active_strip() -> VoiceStrip {
|
||||
speaker_history: vec![0, 37, 73, 110, 146, 219],
|
||||
activity: "listening",
|
||||
animations: true,
|
||||
progress: true,
|
||||
},
|
||||
FrameRequester::test_dummy(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user