| @@ -813,38 +813,40 @@ impl WindowManager { |
| 813 |
} |
813 |
} |
| 814 |
KeyAction::ViewNextTag => { |
814 |
KeyAction::ViewNextTag => { |
| 815 |
let monitor = self.get_selected_monitor(); |
815 |
let monitor = self.get_selected_monitor(); |
| 816 |
- let current_tag_mask = monitor.get_selected_tag(); |
816 |
+ let current_tag_index = unmask_tag(monitor.get_selected_tag()) as i32; |
| 817 |
- |
817 |
+ let len = self.config.tags.len() as i32; |
| 818 |
- let current_tag_index = unmask_tag(current_tag_mask); |
818 |
+ self.view_tag((current_tag_index + 1).rem_euclid(len) as usize)?; |
| 819 |
- self.view_tag(current_tag_index.saturating_add(1))?; |
|
|
| 820 |
} |
819 |
} |
| 821 |
KeyAction::ViewPreviousTag => { |
820 |
KeyAction::ViewPreviousTag => { |
| 822 |
let monitor = self.get_selected_monitor(); |
821 |
let monitor = self.get_selected_monitor(); |
| 823 |
- let current_tag_mask = monitor.get_selected_tag(); |
822 |
+ let current_tag_index = unmask_tag(monitor.get_selected_tag()) as i32; |
| 824 |
- |
823 |
+ let len = self.config.tags.len() as i32; |
| 825 |
- let current_tag_index = unmask_tag(current_tag_mask); |
824 |
+ self.view_tag((current_tag_index - 1).rem_euclid(len) as usize)?; |
| 826 |
- self.view_tag(current_tag_index.saturating_sub(1))?; |
|
|
| 827 |
} |
825 |
} |
| 828 |
KeyAction::ViewNextNonEmptyTag => { |
826 |
KeyAction::ViewNextNonEmptyTag => { |
| 829 |
let monitor = self.get_selected_monitor(); |
827 |
let monitor = self.get_selected_monitor(); |
| 830 |
- let current_tag_mask = monitor.get_selected_tag(); |
828 |
+ let current = unmask_tag(monitor.get_selected_tag()) as i32; |
| 831 |
- let current_tag_index = unmask_tag(current_tag_mask); |
829 |
+ let len = self.config.tags.len() as i32; |
| 832 |
- |
830 |
+ let mon_num = monitor.monitor_number; |
| 833 |
- for next_tag_index in (current_tag_index + 1)..self.config.tags.len() { |
831 |
+ |
| 834 |
- if self.has_windows_on_tag(monitor.monitor_number, next_tag_index) { |
832 |
+ for offset in 1..len { |
| 835 |
- self.view_tag(next_tag_index)?; |
833 |
+ let next = (current + offset).rem_euclid(len) as usize; |
|
|
834 |
+ if self.has_windows_on_tag(mon_num, next) { |
|
|
835 |
+ self.view_tag(next)?; |
| 836 |
break; |
836 |
break; |
| 837 |
} |
837 |
} |
| 838 |
} |
838 |
} |
| 839 |
} |
839 |
} |
| 840 |
KeyAction::ViewPreviousNonEmptyTag => { |
840 |
KeyAction::ViewPreviousNonEmptyTag => { |
| 841 |
let monitor = self.get_selected_monitor(); |
841 |
let monitor = self.get_selected_monitor(); |
| 842 |
- let current_tag_mask = monitor.get_selected_tag(); |
842 |
+ let current = unmask_tag(monitor.get_selected_tag()) as i32; |
| 843 |
- let current_tag_index = unmask_tag(current_tag_mask); |
843 |
+ let len = self.config.tags.len() as i32; |
| 844 |
- |
844 |
+ let mon_num = monitor.monitor_number; |
| 845 |
- for prev_tag_index in (0..current_tag_index).rev() { |
845 |
+ |
| 846 |
- if self.has_windows_on_tag(monitor.monitor_number, prev_tag_index) { |
846 |
+ for offset in 1..len { |
| 847 |
- self.view_tag(prev_tag_index)?; |
847 |
+ let prev = (current - offset).rem_euclid(len) as usize; |
|
|
848 |
+ if self.has_windows_on_tag(mon_num, prev) { |
|
|
849 |
+ self.view_tag(prev)?; |
| 848 |
break; |
850 |
break; |
| 849 |
} |
851 |
} |
| 850 |
} |
852 |
} |