From 6a7c8fcfd529ec31d274b347f4a591ad40366c09 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 15 Dec 2024 10:30:32 +0300 Subject: floating: Implement directional focus --- src/layout/workspace.rs | 60 ++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'src/layout/workspace.rs') diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index 3b3e28ee..baae33c8 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -747,35 +747,35 @@ impl Workspace { } pub fn focus_left(&mut self) -> bool { - // TODO if self.floating_is_active { - return true; + self.floating.focus_left() + } else { + self.scrolling.focus_left() } - self.scrolling.focus_left() } pub fn focus_right(&mut self) -> bool { - // TODO if self.floating_is_active { - return true; + self.floating.focus_right() + } else { + self.scrolling.focus_right() } - self.scrolling.focus_right() } pub fn focus_column_first(&mut self) { - // TODO if self.floating_is_active { - return; + self.floating.focus_leftmost(); + } else { + self.scrolling.focus_column_first(); } - self.scrolling.focus_column_first(); } pub fn focus_column_last(&mut self) { - // TODO if self.floating_is_active { - return; + self.floating.focus_rightmost(); + } else { + self.scrolling.focus_column_last(); } - self.scrolling.focus_column_last(); } pub fn focus_column_right_or_first(&mut self) { @@ -791,51 +791,51 @@ impl Workspace { } pub fn focus_down(&mut self) -> bool { - // TODO if self.floating_is_active { - return true; + self.floating.focus_down() + } else { + self.scrolling.focus_down() } - self.scrolling.focus_down() } pub fn focus_up(&mut self) -> bool { - // TODO if self.floating_is_active { - return true; + self.floating.focus_up() + } else { + self.scrolling.focus_up() } - self.scrolling.focus_up() } pub fn focus_down_or_left(&mut self) { - // TODO if self.floating_is_active { - return; + self.floating.focus_down(); + } else { + self.scrolling.focus_down_or_left(); } - self.scrolling.focus_down_or_left(); } pub fn focus_down_or_right(&mut self) { - // TODO if self.floating_is_active { - return; + self.floating.focus_down(); + } else { + self.scrolling.focus_down_or_right(); } - self.scrolling.focus_down_or_right(); } pub fn focus_up_or_left(&mut self) { - // TODO if self.floating_is_active { - return; + self.floating.focus_up(); + } else { + self.scrolling.focus_up_or_left(); } - self.scrolling.focus_up_or_left(); } pub fn focus_up_or_right(&mut self) { - // TODO if self.floating_is_active { - return; + self.floating.focus_up(); + } else { + self.scrolling.focus_up_or_right(); } - self.scrolling.focus_up_or_right(); } pub fn move_left(&mut self) -> bool { -- cgit