From 41e94cf0be3e8b053000089644cacc8c13e131e7 Mon Sep 17 00:00:00 2001 From: Troels Thomsen Date: Thu, 15 Feb 2024 23:38:32 +0100 Subject: [PATCH 1/4] Remove trailing whitespace --- macos/Sources/Features/Terminal/TerminalController.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index e2f423d07..5a934d67c 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -254,10 +254,10 @@ class TerminalController: NSWindowController, NSWindowDelegate, // Center the window to start, we'll move the window frame automatically // when cascading. window.center() - + // Set the background color of the window window.backgroundColor = NSColor(ghostty.config.backgroundColor) - + // Handle titlebar tabs config option. Something about what we do while setting up the // titlebar tabs interferes with the window restore process unless window.tabbingMode // is set to .preferred, so we set it, and switch back to automatic as soon as we can. @@ -269,7 +269,7 @@ class TerminalController: NSWindowController, NSWindowDelegate, window.tabbingMode = .automatic } } - + // Set a custom background on the titlebar - this is required for when // titlebar tabs is used in conjunction with a transparent background. window.setTitlebarBackground( @@ -278,7 +278,7 @@ class TerminalController: NSWindowController, NSWindowDelegate, .withAlphaComponent(ghostty.config.backgroundOpacity) .cgColor ) - + // Initialize our content view to the SwiftUI root window.contentView = NSHostingView(rootView: TerminalView( ghostty: self.ghostty, From 05fe0e830b5d9d8084d8211fe4f6e3b9c1cbf2c2 Mon Sep 17 00:00:00 2001 From: Troels Thomsen Date: Fri, 16 Feb 2024 21:52:46 +0100 Subject: [PATCH 2/4] Correct grammatical mistake --- macos/Sources/Features/Terminal/TerminalController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 5a934d67c..7afe5a6d7 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -271,7 +271,7 @@ class TerminalController: NSWindowController, NSWindowDelegate, } // Set a custom background on the titlebar - this is required for when - // titlebar tabs is used in conjunction with a transparent background. + // titlebar tabs are used in conjunction with a transparent background. window.setTitlebarBackground( window .backgroundColor From 3bf18560bbc48d5c895fa42abbac4317f0dc5fe9 Mon Sep 17 00:00:00 2001 From: Troels Thomsen Date: Thu, 15 Feb 2024 23:38:57 +0100 Subject: [PATCH 3/4] Set background color in title bar tab mode only --- .../Terminal/TerminalController.swift | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 7afe5a6d7..28f13276c 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -255,29 +255,29 @@ class TerminalController: NSWindowController, NSWindowDelegate, // when cascading. window.center() - // Set the background color of the window - window.backgroundColor = NSColor(ghostty.config.backgroundColor) - // Handle titlebar tabs config option. Something about what we do while setting up the // titlebar tabs interferes with the window restore process unless window.tabbingMode // is set to .preferred, so we set it, and switch back to automatic as soon as we can. if (ghostty.config.macosTitlebarTabs) { + // Set the background color of the window + window.backgroundColor = NSColor(ghostty.config.backgroundColor) + window.tabbingMode = .preferred window.titlebarTabs = true syncAppearance() DispatchQueue.main.async { window.tabbingMode = .automatic } - } - // Set a custom background on the titlebar - this is required for when - // titlebar tabs are used in conjunction with a transparent background. - window.setTitlebarBackground( - window - .backgroundColor - .withAlphaComponent(ghostty.config.backgroundOpacity) - .cgColor - ) + // Set a custom background on the titlebar - this is required for when + // titlebar tabs are used in conjunction with a transparent background. + window.setTitlebarBackground( + window + .backgroundColor + .withAlphaComponent(ghostty.config.backgroundOpacity) + .cgColor + ) + } // Initialize our content view to the SwiftUI root window.contentView = NSHostingView(rootView: TerminalView( From 9e4cd0b51c0c474cf1588fa437fbce24d644d010 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 16 Feb 2024 13:55:09 -0800 Subject: [PATCH 4/4] macos: minor reordering --- macos/Sources/Features/Terminal/TerminalController.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 28f13276c..5bb44f341 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -259,15 +259,15 @@ class TerminalController: NSWindowController, NSWindowDelegate, // titlebar tabs interferes with the window restore process unless window.tabbingMode // is set to .preferred, so we set it, and switch back to automatic as soon as we can. if (ghostty.config.macosTitlebarTabs) { - // Set the background color of the window - window.backgroundColor = NSColor(ghostty.config.backgroundColor) - window.tabbingMode = .preferred window.titlebarTabs = true syncAppearance() DispatchQueue.main.async { window.tabbingMode = .automatic } + + // Set the background color of the window + window.backgroundColor = NSColor(ghostty.config.backgroundColor) // Set a custom background on the titlebar - this is required for when // titlebar tabs are used in conjunction with a transparent background.