config: introduce macos-window-shadow

This commit is contained in:
Mitchell Hashimoto
2024-06-07 12:46:14 -07:00
parent 5a026cf1a2
commit 550a9be241
3 changed files with 24 additions and 3 deletions

View File

@ -186,8 +186,7 @@ class TerminalController: NSWindowController, NSWindowDelegate,
// If we have window transparency then set it transparent. Otherwise set it opaque.
if (ghostty.config.backgroundOpacity < 1) {
window.isOpaque = false
window.hasShadow = false
// This is weird, but we don't use ".clear" because this creates a look that
// matches Terminal.app much more closer. This lets users transition from
// Terminal.app more easily.
@ -196,10 +195,11 @@ class TerminalController: NSWindowController, NSWindowDelegate,
ghostty_set_window_background_blur(ghostty.app, Unmanaged.passUnretained(window).toOpaque())
} else {
window.isOpaque = true
window.hasShadow = true
window.backgroundColor = .windowBackgroundColor
}
window.hasShadow = ghostty.config.macosWindowShadow
guard window.hasStyledTabs else { return }
// The titlebar is always updated. We don't need to worry about opacity

View File

@ -236,6 +236,14 @@ extension Ghostty {
return v
}
var macosWindowShadow: Bool {
guard let config = self.config else { return false }
var v = false;
let key = "macos-window-shadow"
_ = ghostty_config_get(config, &v, key, UInt(key.count))
return v
}
var backgroundColor: Color {
var rgb: UInt32 = 0
let bg_key = "background"
@ -268,6 +276,14 @@ extension Ghostty {
return v;
}
var backgroundBlurRadius: Int {
guard let config = self.config else { return 1 }
var v: Int = 0
let key = "background-blur-radius"
_ = ghostty_config_get(config, &v, key, UInt(key.count))
return v;
}
var unfocusedSplitOpacity: Double {
guard let config = self.config else { return 1 }
var opacity: Double = 0.85

View File

@ -985,6 +985,11 @@ keybind: Keybinds = .{},
/// This does not work with GLFW builds.
@"macos-option-as-alt": OptionAsAlt = .false,
/// Whether to enable the macOS window shadow. The default value is true.
/// With some window managers and window transparency settings, you may
/// find false more visually appealing.
@"macos-window-shadow": bool = true,
/// Put every surface (tab, split, window) into a dedicated Linux cgroup.
///
/// This makes it so that resource management can be done on a per-surface