commit b07c5ca4dd1e8868fafc679dc867e71ae75f7ada
parent c2ceac16054602fd29eeb9945d130432eac1000d
Author: Martti Malmi <sirius@iki.fi>
Date: Wed, 5 Nov 2025 15:51:52 +0200
allow to disable transition animation
Diffstat:
4 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/crates/notedeck/src/persist/settings_handler.rs b/crates/notedeck/src/persist/settings_handler.rs
@@ -36,6 +36,12 @@ pub struct Settings {
pub show_source_client: String,
pub show_replies_newest_first: bool,
pub note_body_font_size: f32,
+ #[serde(default = "default_animate_nav_transitions")]
+ pub animate_nav_transitions: bool,
+}
+
+fn default_animate_nav_transitions() -> bool {
+ true
}
impl Default for Settings {
@@ -47,6 +53,7 @@ impl Default for Settings {
show_source_client: DEFAULT_SHOW_SOURCE_CLIENT.to_string(),
show_replies_newest_first: DEFAULT_SHOW_REPLIES_NEWEST_FIRST,
note_body_font_size: DEFAULT_NOTE_BODY_FONT_SIZE,
+ animate_nav_transitions: default_animate_nav_transitions(),
}
}
}
@@ -191,6 +198,11 @@ impl SettingsHandler {
self.try_save_settings();
}
+ pub fn set_animate_nav_transitions(&mut self, value: bool) {
+ self.get_settings_mut().animate_nav_transitions = value;
+ self.try_save_settings();
+ }
+
pub fn update_batch<F>(&mut self, update_fn: F)
where
F: FnOnce(&mut Settings),
diff --git a/crates/notedeck_columns/src/nav.rs b/crates/notedeck_columns/src/nav.rs
@@ -299,6 +299,9 @@ fn process_nav_resp(
}
NavAction::Navigated => {
+ handle_navigating_edit_profile(ctx.ndb, ctx.accounts, app, col);
+ handle_navigating_timeline(ctx.ndb, ctx.note_cache, ctx.pool, ctx.accounts, app, col);
+
let cur_router = app
.columns_mut(ctx.i18n, ctx.accounts)
.column_mut(col)
@@ -315,9 +318,7 @@ fn process_nav_resp(
NavAction::Returning(_) => {}
NavAction::Resetting => {}
NavAction::Navigating => {
- // explicitly update the edit profile state when navigating
handle_navigating_edit_profile(ctx.ndb, ctx.accounts, app, col);
- // open timeline in cache when navigating to timeline routes
handle_navigating_timeline(ctx.ndb, ctx.note_cache, ctx.pool, ctx.accounts, app, col);
}
}
@@ -1144,6 +1145,7 @@ pub fn render_nav(
.router_mut()
.returning,
)
+ .animate_transitions(ctx.settings.get_settings_mut().animate_nav_transitions)
.show_mut(ui, |ui, render_type, nav| match render_type {
NavUiType::Title => {
let action = NavTitle::new(
diff --git a/crates/notedeck_columns/src/ui/search/mod.rs b/crates/notedeck_columns/src/ui/search/mod.rs
@@ -318,6 +318,12 @@ fn search_box(
.frame(false),
);
+ if response.has_focus() {
+ if ui.input(|i| i.key_pressed(Key::ArrowUp) || i.key_pressed(Key::ArrowDown)) {
+ response.surrender_focus();
+ }
+ }
+
input_context(ui, &response, clipboard, input, PasteBehavior::Append);
let mut requested_focus = false;
diff --git a/crates/notedeck_columns/src/ui/settings.rs b/crates/notedeck_columns/src/ui/settings.rs
@@ -35,6 +35,7 @@ pub enum SettingsAction {
SetLocale(LanguageIdentifier),
SetRepliestNewestFirst(bool),
SetNoteBodyFontSize(f32),
+ SetAnimateNavTransitions(bool),
OpenRelays,
OpenCacheFolder,
ClearCacheFolder,
@@ -89,6 +90,9 @@ impl SettingsAction {
settings.set_note_body_font_size(size);
}
+ Self::SetAnimateNavTransitions(value) => {
+ settings.set_animate_nav_transitions(value);
+ }
}
route_action
}
@@ -474,6 +478,25 @@ impl<'a> SettingsView<'a> {
));
}
});
+
+ ui.horizontal_wrapped(|ui| {
+ ui.label(richtext_small(
+ "Animate view transitions:",
+ ));
+
+ if ui
+ .toggle_value(
+ &mut self.settings.animate_nav_transitions,
+ RichText::new("On")
+ .text_style(NotedeckTextStyle::Small.text_style()),
+ )
+ .changed()
+ {
+ action = Some(SettingsAction::SetAnimateNavTransitions(
+ self.settings.animate_nav_transitions,
+ ));
+ }
+ });
});
action