Add scrolling layout animations
Browse files
+7 −2 src/window_manager.rs
| @@ -867,7 +867,9 @@ impl WindowManager { | ||
| 867 | 867 | |
| 868 | 868 | let tiled_count = tiled_windows.len(); |
| 869 | 869 | if tiled_count <= visible_count { |
| 870 | - if let Some(m) = self.monitors.get_mut(monitor_index) { | |
| 870 | + if animate && monitor.scroll_offset != 0 { | |
| 871 | + self.scroll_animation.start(monitor.scroll_offset, 0, &self.animation_config); | |
| 872 | + } else if let Some(m) = self.monitors.get_mut(monitor_index) { | |
| 871 | 873 | m.scroll_offset = 0; |
| 872 | 874 | } |
| 873 | 875 | return Ok(()); |
| @@ -2313,7 +2315,7 @@ impl WindowManager { | ||
| 2313 | 2315 | } |
| 2314 | 2316 | |
| 2315 | 2317 | if self.layout.name() == "scrolling" { |
| 2316 | - self.scroll_to_window(window, false)?; | |
| 2318 | + self.scroll_to_window(window, true)?; | |
| 2317 | 2319 | } |
| 2318 | 2320 | |
| 2319 | 2321 | self.apply_layout()?; |
| @@ -4721,6 +4723,9 @@ impl WindowManager { | ||
| 4721 | 4723 | let visible = self.visible_windows_on_monitor(self.selected_monitor); |
| 4722 | 4724 | if let Some(&new_win) = visible.last() { |
| 4723 | 4725 | self.focus(Some(new_win))?; |
| 4726 | + if self.layout.name() == "scrolling" { | |
| 4727 | + self.scroll_to_window(new_win, true)?; | |
| 4728 | + } | |
| 4724 | 4729 | } else if let Some(monitor) = self.monitors.get_mut(self.selected_monitor) { |
| 4725 | 4730 | monitor.selected_client = None; |
| 4726 | 4731 | } |