1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-30 06:03:39 +03:00

integrated-title-bar: Add option to remove useless buttons

This commit is contained in:
YuraIz 2022-11-09 11:37:44 +03:00 committed by Wez Furlong
parent 2333046e1b
commit d39bccca10
No known key found for this signature in database
GPG Key ID: 7A7F66A31EC9B387
2 changed files with 14 additions and 4 deletions

View File

@ -241,7 +241,13 @@ impl TabBarState {
},
);
let button_order = if config.fancy_window_decorations.is_left {
let window::FancyWindowDecorations {
is_left,
remove_hide_button,
remove_maximize_button,
} = config.fancy_window_decorations;
let button_order = if is_left {
['X', '.', '-']
} else {
['.', '-', 'X']
@ -250,7 +256,7 @@ impl TabBarState {
for button in button_order {
let (title, item) = match button {
// Window hide button
'.' => {
'.' if !remove_hide_button => {
let hover = is_tab_hover(mouse_x, *x, window_hide_hover.len());
let window_hide_button = if hover {
@ -261,7 +267,7 @@ impl TabBarState {
(window_hide_button, TabBarItem::WindowHideButton)
}
'-' => {
'-' if !remove_maximize_button => {
// Window maximize button
let hover = is_tab_hover(mouse_x, *x, window_maximize_hover.len());
@ -285,7 +291,7 @@ impl TabBarState {
(window_close_button, TabBarItem::WindowCloseButton)
}
_ => unreachable!(),
_ => continue,
};
// let button_start = *x;

View File

@ -1455,6 +1455,10 @@ impl Default for WindowDecorations {
pub struct FancyWindowDecorations {
#[dynamic(default)]
pub is_left: bool,
#[dynamic(default)]
pub remove_hide_button: bool,
#[dynamic(default)]
pub remove_maximize_button: bool,
}
/// Map c to its Ctrl equivalent.