diff options
Diffstat (limited to 'alacritty/src/display/window.rs')
-rw-r--r-- | alacritty/src/display/window.rs | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index 942b28ee..c7ad37c8 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -122,6 +122,9 @@ impl Window { config: &UiConfig, identity: &Identity, #[rustfmt::skip] + #[cfg(target_os = "macos")] + tabbing_id: &Option<String>, + #[rustfmt::skip] #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] x11_visual: Option<X11VisualInfo>, ) -> Result<Window> { @@ -131,6 +134,8 @@ impl Window { &config.window, #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] x11_visual, + #[cfg(target_os = "macos")] + tabbing_id, ); if let Some(position) = config.window.position { @@ -284,8 +289,16 @@ impl Window { } #[cfg(target_os = "macos")] - pub fn get_platform_window(_: &Identity, window_config: &WindowConfig) -> WindowBuilder { - let window = WindowBuilder::new().with_option_as_alt(window_config.option_as_alt()); + pub fn get_platform_window( + _: &Identity, + window_config: &WindowConfig, + tabbing_id: &Option<String>, + ) -> WindowBuilder { + let mut window = WindowBuilder::new().with_option_as_alt(window_config.option_as_alt()); + + if let Some(tabbing_id) = tabbing_id { + window = window.with_tabbing_identifier(tabbing_id); + } match window_config.decorations { Decorations::Full => window, @@ -406,6 +419,35 @@ impl Window { let _: id = msg_send![raw_window, setHasShadow: value]; } } + + /// Select tab at the given `index`. + #[cfg(target_os = "macos")] + pub fn select_tab_at_index(&self, index: usize) { + self.window.select_tab_at_index(index); + } + + /// Select the last tab. + #[cfg(target_os = "macos")] + pub fn select_last_tab(&self) { + self.window.select_tab_at_index(self.window.num_tabs() - 1); + } + + /// Select next tab. + #[cfg(target_os = "macos")] + pub fn select_next_tab(&self) { + self.window.select_next_tab(); + } + + /// Select previous tab. + #[cfg(target_os = "macos")] + pub fn select_previous_tab(&self) { + self.window.select_previous_tab(); + } + + #[cfg(target_os = "macos")] + pub fn tabbing_id(&self) -> String { + self.window.tabbing_identifier() + } } #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] |