Skip to content

Commit

Permalink
feat: rename flag to MACOS_RESPECT_THEME_BACKGROUND
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay-Madden committed Jan 18, 2025
1 parent 663ff22 commit a7a4fca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions wezterm-input-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1976,7 +1976,7 @@ bitflags! {
const MACOS_FORCE_DISABLE_SHADOW = 4;
const MACOS_FORCE_ENABLE_SHADOW = 4|8;
const INTEGRATED_BUTTONS = 16;
const RESPECT_FRAME_BACKGROUND = 32;
const MACOS_RESPECT_THEME_BACKGROUND = 32;
}
}

Expand All @@ -1993,7 +1993,7 @@ impl Into<String> for &WindowDecorations {
s.push("INTEGRATED_BUTTONS");
}
if self.contains(WindowDecorations::INTEGRATED_BUTTONS) {
s.push("RESPECT_FRAME_BACKGROUND")
s.push("MACOS_RESPECT_THEME_BACKGROUND")
}
if self.contains(WindowDecorations::MACOS_FORCE_ENABLE_SHADOW) {
s.push("MACOS_FORCE_ENABLE_SHADOW");
Expand All @@ -2020,8 +2020,8 @@ impl TryFrom<String> for WindowDecorations {
flags = Self::NONE;
} else if ele == "RESIZE" {
flags |= Self::RESIZE;
} else if ele == "RESPECT_FRAME_BACKGROUND" {
flags |= Self::RESPECT_FRAME_BACKGROUND;
} else if ele == "MACOS_RESPECT_THEME_BACKGROUND" {
flags |= Self::MACOS_RESPECT_THEME_BACKGROUND;
} else if ele == "MACOS_FORCE_DISABLE_SHADOW" {
flags |= Self::MACOS_FORCE_DISABLE_SHADOW;
} else if ele == "MACOS_FORCE_ENABLE_SHADOW" {
Expand Down
1 change: 1 addition & 0 deletions window/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ url = "2"
wezterm-bidi = { path = "../bidi" }
wezterm-color-types = { path = "../color-types" }
wezterm-font = { path = "../wezterm-font" }
wezterm-term = { path = "../term" }
wezterm-input-types = { path = "../wezterm-input-types" }

[target."cfg(windows)".dependencies]
Expand Down
14 changes: 10 additions & 4 deletions window/src/os/macos/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1161,9 +1161,15 @@ impl WindowInner {
self.config.integrated_title_button_style,
);

//if self.config.window_decorations.contains(WindowDecorations::RESPECT_FRAME_BACKGROUND) {
self.update_titlebar_background(self.config.window_frame.active_titlebar_bg);
//}
// Set the titlebar background to the theme color falling back to the default if there
// is no specified theme
if self.config.window_decorations.contains(WindowDecorations::MACOS_RESPECT_THEME_BACKGROUND) {
if let Some(bkg) = self.config.resolved_palette.background {
self.update_titlebar_background(bkg);
} else {
self.update_titlebar_background(wezterm_term::color::ColorPalette::default().background.into());
}
}

self.window.makeKeyAndOrderFront_(nil)
}
Expand Down Expand Up @@ -1382,7 +1388,7 @@ fn apply_decorations_to_window(
});

if decorations.contains(WindowDecorations::INTEGRATED_BUTTONS)
|| decorations.contains(WindowDecorations::RESPECT_FRAME_BACKGROUND) {
|| decorations.contains(WindowDecorations::MACOS_RESPECT_THEME_BACKGROUND) {
window.setTitlebarAppearsTransparent_(YES);
} else {
window.setTitlebarAppearsTransparent_(hidden);
Expand Down

0 comments on commit a7a4fca

Please sign in to comment.