Repository: jasonwoodland/iTerm2-borderless Branch: master Commit: 9be1653a96f7 Files: 7 Total size: 41.5 KB Directory structure: gitextract_vpokyewl/ ├── .gitignore ├── Makefile ├── README.md ├── com.googlecode.iterm2.plist ├── iTerm2-borderless.patch └── icons/ ├── AppIcon.psd └── generate.sh ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ .DS_Store ================================================ FILE: Makefile ================================================ .DEFAULT_GOAL := all all: clone patch build clone: @rm -rf iTerm2 git clone --depth=1 https://github.com/gnachman/iTerm2.git clean: cd iTerm2; git reset --hard HEAD; git clean -fd patch: cp -v icons/AppIcon.appiconset/* iTerm2/Media.xcassets/AppIcon.appiconset/ cd iTerm2; patch -p1 < ../iTerm2-borderless.patch update-patch: cd iTerm2; git diff > ../iTerm2-borderless.patch build: cd iTerm2; xcodebuild -project iTerm2.xcodeproj -configuration Deployment -target iTerm2 -parallelizeTargets open iTerm2/build/Deployment install-prefs: cp ~/Library/Preferences/com.googlecode.iterm2.plist com.googlecode.iterm2.plist~`date +%s` cp com.googlecode.iterm2.plist ~/Library/Preferences/com.googlecode.iterm2.plist ================================================ FILE: README.md ================================================

iTerm2 borderless

My custom iTerm2 patch and build. **DEPRECATED:** Consider using the latest iTerm as most the changes in this patch have been added/improved upon upstream. * Hides the standard window title bar * Modified tab bar * Moved the close tab button and new-output indicator to left of the tab label * New title format which shows either the title *or* the job name * New advanced options found under *Preferences > Advanced*: (Search for *“borderless”*) * ***Standard window buttons horizontal/vertical offset:*** Change the position of the window buttons and title bar. * ***Window title format:*** Set a custom title format * ***Set cursor foreground color:*** Set whether to change the cursor foreground color * ***Duration before cursor starts blinking:*** Set a duration for when the cursor should start blinking after it has moved * ~~***Vertical cursor width***~~ You can now change the cursor width by setting *Vertical bar cursor width* * ~~Extra window padding~~ You can now change the margins in *Preferences > Advanced > General* * ~~Reverted to slightly bolder font smoothing~~ Set *Preferences > Profiles > Text > Use thin strokes for anti-aliased text* to *Never* Download the [latest release](https://github.com/jasonwoodland/iTerm2-borderless/releases/latest) and copy `iTerm2.app` to `/Applications`, or apply the patch yourself. (Open an issue if it fails so I can update the patch) ## Patch it yourself ### 1. Get iTerm2-borderless ```sh git clone --depth=1 https://github.com/jasonwoodland/iTerm2-borderless.git ``` ### 2. Get iTerm2, patch and build ```sh cd iTerm2-borderless make ``` If building fails, you might need to set the development team in Xcode. Open the Xcode project file with the open command below, and change the team under *General > Signing > Team* ```sh open iTerm2/iTerm2.xcodeproj ``` Then try building again: ```sh make build ``` ### 3. Install Move the app to `/Applications` ### 4. Set preferences In the patched build, go to *Preferences > Appearance* and disable *Show line under title bar when the tab bar is not visible* Next, go to *Preferences > Advanced* #### Set the terminal margins * Height of top and bottom margins in terminal panes * Width of left and right margins in terminal panes #### Set the title bar margins * Standard window buttons horizontal offset * Standard window buttons vertical offset ## Still having trouble? If iTerm still doesn't look right, try copying over the sane plist file: (it creates a backup of your current prefs file) ```sh make install-prefs ``` Then restart iTerm. ## To do - [ ] Override preferences which break the patch for people (also override margin: 0) - [ ] Fix dragging tabs appearance - [ ] Fix title bar bug in fullscreen - [ ] Fix tabs disappearing after fullscreen ================================================ FILE: iTerm2-borderless.patch ================================================ diff --git a/ThirdParty/PSMTabBarControl/source/PSMDarkTabStyle.m b/ThirdParty/PSMTabBarControl/source/PSMDarkTabStyle.m index e197d37..4585eda 100644 --- a/ThirdParty/PSMTabBarControl/source/PSMDarkTabStyle.m +++ b/ThirdParty/PSMTabBarControl/source/PSMDarkTabStyle.m @@ -17,14 +17,18 @@ - (NSString *)name { } + (NSColor *)tabBarColorWhenKeyAndActive:(BOOL)keyAndActive { + // PATCH: (Added) transparent tab bar + return [NSColor clearColor]; if (@available(macOS 10.14, *)) { - return [NSColor colorWithSRGBRed:0 green:0 blue:0 alpha:0.25]; + return [NSColor colorWithSRGBRed:0 green:0 blue:0 alpha:0.0]; } else { - return [NSColor colorWithCalibratedWhite:0.12 alpha:1.00]; + return [NSColor colorWithCalibratedWhite:0.12 alpha:0.00]; } } - (NSColor *)tabBarColor { + // PATCH: (Added) transparent tab bar + return [NSColor clearColor]; return [PSMDarkTabStyle tabBarColorWhenKeyAndActive:self.tabBar.window.isKeyWindow && [NSApp isActive]]; } @@ -53,6 +57,8 @@ - (NSColor *)topLineColorSelected:(BOOL)selected { } - (NSColor *)bottomLineColorSelected:(BOOL)selected { + // PATCH: (Added) transparent tab bar bottom line + return [NSColor clearColor]; if (@available(macOS 10.14, *)) { return [NSColor colorWithWhite:0 alpha:0.1]; } else { @@ -61,6 +67,8 @@ - (NSColor *)bottomLineColorSelected:(BOOL)selected { } - (NSColor *)verticalLineColorSelected:(BOOL)selected { + // PATCH: (Added) transparent tab bar vertical line + return [NSColor clearColor]; if (@available(macOS 10.14, *)) { return [self topLineColorSelected:selected]; } else { @@ -69,6 +77,8 @@ - (NSColor *)verticalLineColorSelected:(BOOL)selected { } - (NSColor *)backgroundColorSelected:(BOOL)selected highlightAmount:(CGFloat)highlightAmount { + // PATCH: (Added) transparent tab bar + return [NSColor clearColor]; if (@available(macOS 10.14, *)) { CGFloat colors[3]; if (self.tabBar.window.isKeyWindow && [NSApp isActive]) { diff --git a/ThirdParty/PSMTabBarControl/source/PSMTabBarCell.m b/ThirdParty/PSMTabBarControl/source/PSMTabBarCell.m index 0d83568..fa513b9 100644 --- a/ThirdParty/PSMTabBarControl/source/PSMTabBarCell.m +++ b/ThirdParty/PSMTabBarControl/source/PSMTabBarCell.m @@ -400,6 +400,8 @@ - (CGFloat)highlightAmount { - (void)mouseEntered:(NSEvent *)theEvent { // check for which tag + // PATCH: (Added) Don't show close button if the indicator is visible + if (self.hasIcon) return; if ([theEvent trackingNumber] == _closeButtonTrackingTag) { _closeButtonOver = YES; } diff --git a/ThirdParty/PSMTabBarControl/source/PSMTabBarControl.m b/ThirdParty/PSMTabBarControl/source/PSMTabBarControl.m index 54b162d..1cdc983 100644 --- a/ThirdParty/PSMTabBarControl/source/PSMTabBarControl.m +++ b/ThirdParty/PSMTabBarControl/source/PSMTabBarControl.m @@ -1858,9 +1858,7 @@ - (NSTabViewItem *)tabView:(NSTabView *)tabView unknownObjectWasDropped:(id 0) { - NSRect labelRect; labelRect.origin.x = labelPosition; labelRect.size.width = cellFrame.size.width - (labelRect.origin.x - cellFrame.origin.x) - kPSMTabBarCellPadding; - if ([cell hasIcon]) { - // Reduce size of label if there is an icon or activity indicator - labelRect.size.width -= iconRect.size.width + kPSMTabBarCellIconPadding; - } else if (![[cell indicator] isHidden]) { - labelRect.size.width -= cell.indicator.frame.size.width + kPSMTabBarCellIconPadding; - } + // PATCH: (Removed) Don't mmove the label to the left if the indicator is visible labelRect.size.height = cellFrame.size.height; if ([cell count] > 0) { @@ -989,6 +991,19 @@ - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell [attributedString drawInRect:labelRect]; } + + // PATCH: (Added) modify the icon frame and draw it + if ([cell hasIcon]) { + iconRect.origin.x -= labelRect.size.width / 2 + attributedString.size.width / 2 - 13; + iconRect.origin.x -= iconRect.size.width; // Remove if we don't move the label over; + iconRect.origin.y += 1; + [icon drawInRect:iconRect + fromRect:NSZeroRect + operation:NSCompositingOperationSourceOver + fraction:1.0 + respectFlipped:YES + hints:nil]; + } } - (NSColor *)tabBarColor { @@ -1105,8 +1120,9 @@ - (void)drawTabBar:(PSMTabBarControl *)bar } else { insetRect = clipRect; } - [self drawHorizontalLineInFrame:NSIntersectionRect(clipRect, insetRect) y:0]; - + + // PATCH: (Removed) Don't draw horizontal lines for tabview + // no tab view == not connected if (![bar tabView]) { NSRect labelRect = rect; diff --git a/iTerm2.xcodeproj/project.pbxproj b/iTerm2.xcodeproj/project.pbxproj index 78ef8f4..0ee299e 100644 --- a/iTerm2.xcodeproj/project.pbxproj +++ b/iTerm2.xcodeproj/project.pbxproj @@ -9529,7 +9529,8 @@ DevelopmentTeam = H7V7XYVQ7D; }; 874206460564169600CFC3F1 = { - ProvisioningStyle = Manual; + DevelopmentTeam = 4688J3MK2P; + ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.HardenedRuntime = { enabled = 0; @@ -11972,11 +11973,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_INT_CONVERSION = YES; - CODE_SIGN_IDENTITY = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 4688J3MK2P; ENABLE_HARDENED_RUNTIME = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -12112,7 +12113,7 @@ CODE_SIGN_IDENTITY = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - DEVELOPMENT_TEAM = H7V7XYVQ7D; + DEVELOPMENT_TEAM = 4688J3MK2P; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)", @@ -12603,11 +12604,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_INT_CONVERSION = YES; - CODE_SIGN_IDENTITY = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 4688J3MK2P; ENABLE_HARDENED_RUNTIME = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -12779,7 +12780,7 @@ CODE_SIGN_IDENTITY = "Mac Developer"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - DEVELOPMENT_TEAM = H7V7XYVQ7D; + DEVELOPMENT_TEAM = 4688J3MK2P; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", "$(SRCROOT)", @@ -13644,12 +13645,12 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_INT_CONVERSION = YES; - CODE_SIGN_IDENTITY = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 4688J3MK2P; ENABLE_HARDENED_RUNTIME = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -13721,11 +13722,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_INT_CONVERSION = YES; - CODE_SIGN_IDENTITY = "-"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_IDENTITY = "Mac Developer"; + CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = 4688J3MK2P; ENABLE_HARDENED_RUNTIME = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/plists/iTerm2.plist b/plists/iTerm2.plist index bc2fc2b..7e80879 100644 --- a/plists/iTerm2.plist +++ b/plists/iTerm2.plist @@ -2,24 +2,6 @@ - NSAppTransportSecurity - - NSExceptionDomains - - 127.0.0.1 - - NSExceptionAllowsInsecureHTTPLoads - - - localhost - - NSExceptionAllowsInsecureHTTPLoads - - - - - NSHumanReadableCopyright - GPL v2 CFBundleDevelopmentRegion English CFBundleDocumentTypes @@ -42,12 +24,12 @@ Editor + CFBundleTypeName + Folders CFBundleTypeOSTypes fold - CFBundleTypeName - Folders CFBundleTypeRole Editor @@ -84,65 +66,6 @@ - NSAppleEventsUsageDescription - An application in iTerm2 wants to use AppleScript. - NSCalendarsUsageDescription - An application in iTerm2 wants to use Calendar data. - NSCameraUsageDescription - An application in iTerm2 wants to use the camera. - NSContactsUsageDescription - An application in iTerm2 wants to use your contacts. - NSLocationAlwaysUsageDescription - An application in iTerm2 wants to use your location information, even in the background. - NSLocationUsageDescription - An application in iTerm2 wants to use your location information. - NSLocationWhenInUseUsageDescription - An application in iTerm2 wants to use your location information while active. - NSMicrophoneUsageDescription - An application in iTerm2 wants to use your microphone. - NSRemindersUsageDescription - An application in iTerm2 wants to use your reminders. - NSServices - - - NSMenuItem - - default - New iTerm2 Tab Here - - NSMessage - openTab - NSRequiredContext - - NSTextContent - FilePath - - NSSendTypes - - NSFilenamesPboardType - public.plain-text - - - - NSMenuItem - - default - New iTerm2 Window Here - - NSMessage - openWindow - NSRequiredContext - - NSTextContent - FilePath - - NSSendTypes - - NSFilenamesPboardType - public.plain-text - - - CFBundleExecutable iTerm2 CFBundleGetInfoString @@ -154,7 +77,7 @@ CFBundleIconFile iTerm2.icns CFBundleIdentifier - com.googlecode.iterm2 + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -268,25 +191,102 @@ unknown LSApplicationCategoryType public.app-category.utilities + NSAppTransportSecurity + + NSExceptionDomains + + 127.0.0.1 + + NSExceptionAllowsInsecureHTTPLoads + + + localhost + + NSExceptionAllowsInsecureHTTPLoads + + + + + NSAppleEventsUsageDescription + An application in iTerm2 wants to use AppleScript. NSAppleScriptEnabled YES - OSAScriptingDefinition - iTerm2.sdef + NSCalendarsUsageDescription + An application in iTerm2 wants to use Calendar data. + NSCameraUsageDescription + An application in iTerm2 wants to use the camera. + NSContactsUsageDescription + An application in iTerm2 wants to use your contacts. NSExtensions + NSHumanReadableCopyright + GPL v2 + NSLocationAlwaysUsageDescription + An application in iTerm2 wants to use your location information, even in the background. + NSLocationUsageDescription + An application in iTerm2 wants to use your location information. + NSLocationWhenInUseUsageDescription + An application in iTerm2 wants to use your location information while active. NSMainNibFile MainMenu + NSMicrophoneUsageDescription + An application in iTerm2 wants to use your microphone. NSPrincipalClass iTermApplication - SUPublicDSAKeyFile - dsa_pub.pem + NSRemindersUsageDescription + An application in iTerm2 wants to use your reminders. + NSServices + + + NSMenuItem + + default + New iTerm2 Tab Here + + NSMessage + openTab + NSRequiredContext + + NSTextContent + FilePath + + NSSendTypes + + NSFilenamesPboardType + public.plain-text + + + + NSMenuItem + + default + New iTerm2 Window Here + + NSMessage + openWindow + NSRequiredContext + + NSTextContent + FilePath + + NSSendTypes + + NSFilenamesPboardType + public.plain-text + + + NSSupportsAutomaticGraphicsSwitching - SUFeedURLForTesting - https://iterm2.com/appcasts/testing.xml + OSAScriptingDefinition + iTerm2.sdef + SUFeedURL + https://iterm2.com/appcasts/final.xml SUFeedURLForFinal https://iterm2.com/appcasts/final.xml - SUFeedURL - https://iterm2.com/appcasts/final.xml + SUFeedURLForTesting + https://iterm2.com/appcasts/testing.xml + SUPublicDSAKeyFile + dsa_pub.pem diff --git a/sources/PTYSession.m b/sources/PTYSession.m index 624603c..2494f98 100644 --- a/sources/PTYSession.m +++ b/sources/PTYSession.m @@ -3583,7 +3583,9 @@ - (void)setPreferencesFromAddressBookEntry:(NSDictionary *)aePrefs { inBookmark:aDict]]; // transparency - [self setTransparency:[iTermProfilePreferences floatForKey:KEY_TRANSPARENCY inProfile:aDict]]; + // PATCH: (Modified) now the window appears semi-transparent, not the terminal + // So if it's not opaque, make the terminal fully transparent + [self setTransparency:[iTermProfilePreferences floatForKey:KEY_TRANSPARENCY inProfile:aDict] == 0 ? 0 : 1]; [self setBlend:[iTermProfilePreferences floatForKey:KEY_BLEND inProfile:aDict]]; [self setTransparencyAffectsOnlyDefaultBackgroundColor:[iTermProfilePreferences floatForKey:KEY_TRANSPARENCY_AFFECTS_ONLY_DEFAULT_BACKGROUND_COLOR inProfile:aDict]]; @@ -3981,10 +3983,7 @@ - (float)transparency - (void)setTransparency:(float)transparency { - // Limit transparency because fully transparent windows can't be clicked on. - if (transparency > 0.9) { - transparency = 0.9; - } + // PATCH: (Removed) ignore limit, make terminal fully transparent, they can still be clicked [_textview setTransparency:transparency]; [self useTransparencyDidChange]; [self.view setNeedsDisplay:YES]; diff --git a/sources/PTYTab.m b/sources/PTYTab.m index 54ddef3..95197c4 100644 --- a/sources/PTYTab.m +++ b/sources/PTYTab.m @@ -557,6 +557,16 @@ - (void)setState:(NSUInteger)flagsToSet reset:(NSUInteger)flagsToReset { } - (void)updateIcon { + NSArray *commands = [[iTermAdvancedSettingsModel disabledNewOutputIndicatorCommands] componentsSeparatedByString:@","]; + for (id command in commands) { + NSString *trimmedCommand = [command stringByTrimmingCharactersInSet: + [NSCharacterSet whitespaceAndNewlineCharacterSet]]; + if ([[self.activeSession.childJobNames lastObject] isEqualToString:trimmedCommand]) { + [self setIcon:nil]; + return; + } + } + if (_state & kPTYTabDeadState) { [self setIcon:[PTYTab deadImageWithAppearance:self.realParentWindow.window.effectiveAppearance]]; } else if (_state & kPTYTabBellState) { @@ -572,6 +582,30 @@ - (void)updateIcon { } } +/*- (void)updateIcon { + if (_state & kPTYTabDeadState) { + [self setIcon:[PTYTab deadImageWithAppearance:self.realParentWindow.window.effectiveAppearance]]; + } else if (_state & kPTYTabBellState) { + if ([iTermAdvancedSettingsModel showNewOutputIndicatorForBell]) { + [self setIcon:[PTYTab imageForNewOutputWithAppearance:self.realParentWindow.window.effectiveAppearance]]; + [self setState:kPTYTabNewOutputState reset:kPTYTabBellState]; + [self updateIcon]; + } else { + [self setIcon:[PTYTab bellImage]]; + } + } else if ([iTermPreferences boolForKey:kPreferenceKeyShowNewOutputIndicator] && + (_state & (kPTYTabNewOutputState))) { + if (![iTermAdvancedSettingsModel showNewOutputIndicatorForBell]) { + [self setIcon:[PTYTab imageForNewOutputWithAppearance:self.realParentWindow.window.effectiveAppearance]]; + } + } else if ([iTermPreferences boolForKey:kPreferenceKeyShowNewOutputIndicator] && + (_state & kPTYTabIdleState)) { + [self setIcon:[PTYTab idleImageWithAppearance:self.realParentWindow.window.effectiveAppearance]]; + } else { + [self setIcon:nil]; + } +}*/ + - (void)loadTitleFromSession { tabViewItem_.label = self.activeSession.name; } @@ -584,7 +618,8 @@ - (void)nameOfSession:(PTYSession *)session didChangeTo:(NSString*)newName { - (void)updateTabTitleForCurrentSessionName:(NSString *)newName { NSString *value = (self.evaluatedTitleOverride ?: newName) ?: @" "; - [tabViewItem_ setLabel:value]; // PSM uses bindings to bind the label to its title + // PATCH: (Modified) set tab view label to the window title if it's set + [tabViewItem_ setLabel:self.activeSession.windowTitle.length != 0 ? self.activeSession.windowTitle : value]; // PSM uses bindings to bind the label to its title [self.realParentWindow tabTitleDidChange:self]; } diff --git a/sources/PTYTextView.m b/sources/PTYTextView.m index 3359c5a..f3a6aaa 100644 --- a/sources/PTYTextView.m +++ b/sources/PTYTextView.m @@ -587,7 +587,8 @@ - (BOOL)isFlipped - (BOOL)isOpaque { - return YES; + // PATCH: (Modified) transparent so we can see our semi-transparent window + return NO; } - (void)setHighlightCursorLine:(BOOL)highlightCursorLine { diff --git a/sources/PseudoTerminal.m b/sources/PseudoTerminal.m index 04262b2..dea52c2 100644 --- a/sources/PseudoTerminal.m +++ b/sources/PseudoTerminal.m @@ -404,12 +404,12 @@ + (void)registerSessionsInArrangement:(NSDictionary *)arrangement { } + (void)updateDecorationsOfWindow:(NSWindow *)myWindow forType:(iTermWindowType)windowType { - const BOOL isCompact = (windowType == WINDOW_TYPE_COMPACT); - [myWindow setHasShadow:(windowType == WINDOW_TYPE_NORMAL || - isCompact)]; - // Chrome doesn't change titleVisibility so neither do we. - // Some truly dreadful hacks are used instead. See PTYWindow.m. - myWindow.titlebarAppearsTransparent = isCompact; + // PATCH: (Modified) Native macOS window shadow + [myWindow setHasShadow:YES]; + [myWindow setTitleVisibility:NSWindowTitleHidden]; + + // PATCH: (Modified) Hides title bar strip for our tab view instead + myWindow.titlebarAppearsTransparent = YES; } + (NSInteger)styleMaskForWindowType:(iTermWindowType)windowType @@ -418,6 +418,10 @@ + (NSInteger)styleMaskForWindowType:(iTermWindowType)windowType if (hotkeyWindowType == iTermHotkeyWindowTypeFloatingPanel) { mask = NSWindowStyleMaskNonactivatingPanel; } + + // PATCH: (Added) Always use full size content view + mask |= NSWindowStyleMaskFullSizeContentView; + switch (windowType) { case WINDOW_TYPE_TOP: case WINDOW_TYPE_BOTTOM: @@ -1853,7 +1857,8 @@ - (void)setWindowTitle { if (self.isShowingTransientTitle) { PTYSession *session = self.currentSession; NSString *aTitle; - if (self.window.frame.size.width < 250) { + // PATCH: (Modified) check tab width for displaying size when resizing + if (self.window.frame.size.width / (self.tabs.count) < 200) { aTitle = [NSString stringWithFormat:@"%d✕%d", session.columns, session.rows]; } else { aTitle = [NSString stringWithFormat:@"%@ \u2014 %d✕%d", @@ -3549,12 +3554,8 @@ - (NSEdgeInsets)tabBarInsets { } - (BOOL)tabBarAlwaysVisible { - if (@available(macOS 10.14, *)) { - if (togglingLionFullScreen_ || [self lionFullScreen]) { - return YES; - } - } - return ![iTermPreferences boolForKey:kPreferenceKeyHideTabBar]; + // PATCH: (Added) always show tab bar + return YES; } - (BOOL)anyFullScreen @@ -4157,8 +4158,7 @@ - (void)toggleTraditionalFullScreenMode { } PtyLog(@"toggleFullScreenMode - allocate new terminal"); } - [self.window setHasShadow:(windowType_ == WINDOW_TYPE_NORMAL || - windowType_ == WINDOW_TYPE_COMPACT)]; + [self.window setHasShadow:YES]; // PATCH: (Modified) always set window shadow if (!_fullScreen && [iTermPreferences boolForKey:kPreferenceKeyDisableFullscreenTransparencyByDefault]) { @@ -4277,7 +4277,7 @@ - (void)updateWindowShadow { if ([iTermAdvancedSettingsModel disableWindowShadowWhenTransparencyOnMojave]) { const BOOL haveTransparency = [self anySessionInCurrentTabHasTransparency]; DLog(@"%@: have transparency = %@ for sessions %@ in tab %@", self, @(haveTransparency), self.currentTab.sessions, self.currentTab); - self.window.hasShadow = !haveTransparency; + self.window.hasShadow = YES; // PATCH: (Modified) always has window shadow } } } @@ -5611,9 +5611,10 @@ - (void)updateTabColors { [_contentView.tabBarControl setTabColor:color forTabViewItem:tabViewItem]; if ([_contentView.tabView selectedTabViewItem] == tabViewItem) { NSColor* newTabColor = [_contentView.tabBarControl tabColorForTabViewItem:tabViewItem]; - if ([_contentView.tabView numberOfTabViewItems] == 1 && - [iTermPreferences boolForKey:kPreferenceKeyHideTabBar] && - newTabColor) { + if (YES) { // PATCH: (Modified) always use the tab color + // PATCH: (Added) set window title background so it renders properly + //NSTextView *titleView = [self.contentView.window standardWindowButton:NSWindowCloseButton].superview.subviews[3]; + //titleView.backgroundColor = [aSession.colorMap colorForKey:kColorMapBackground]; [self setBackgroundColor:newTabColor]; [_contentView setColor:newTabColor]; @@ -5656,7 +5657,11 @@ - (void)setMojaveBackgroundColor:(nullable NSColor *)backgroundColor NS_AVAILABL self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameDarkAqua]; break; } - self.window.backgroundColor = self.anyPaneIsTransparent ? [NSColor clearColor] : [NSColor windowBackgroundColor]; + // PATCH: (Modified) set window background color so our transparent title bar doesn't show behind the window + backgroundColor = [self.currentSession.colorMap colorForKey:kColorMapBackground]; + backgroundColor = [backgroundColor colorWithAlphaComponent:1 - [iTermProfilePreferences floatForKey:KEY_TRANSPARENCY inProfile:self.currentSession.profile]]; + + self.window.backgroundColor = backgroundColor; self.window.titlebarAppearsTransparent = NO; // Keep it from showing content from other windows behind it. Issue 7108. } @@ -5695,6 +5700,10 @@ - (void)setLegacyBackgroundColor:(nullable NSColor *)backgroundColor { } darkAppearance = (backgroundColor != nil && backgroundColor.perceivedBrightness < 0.5); } + + // PATCH: (Added) set window background color to terminal background color + backgroundColor = [self.currentSession.colorMap colorForKey:kColorMapBackground]; + [self.window setBackgroundColor:backgroundColor]; if (darkAppearance) { self.window.appearance = [NSAppearance appearanceNamed:NSAppearanceNameVibrantDark]; diff --git a/sources/iTermAdvancedSettingsModel.h b/sources/iTermAdvancedSettingsModel.h index f515a97..afca0be 100644 --- a/sources/iTermAdvancedSettingsModel.h +++ b/sources/iTermAdvancedSettingsModel.h @@ -189,6 +189,14 @@ extern NSString *const iTermAdvancedSettingsDidChange; + (int)slowPasteBytesPerCall; + (double)slowPasteDelayBetweenCalls; +// PATCH: (Added) iTerm2-borderless Features ++ (double)timeBeforeBlinks; ++ (BOOL)setCursorForegroundColor; ++ (NSString *)windowTitleFormat; ++ (int)standardWindowButtonsHorizontalOffset; ++ (int)standardWindowButtonsVerticalOffset; ++ (NSString *)disabledNewOutputIndicatorCommands; + // The cursor's background goes to the "most different" color from its neighbors if the difference // in brightness between the proposed background color and the neighbors' background color is less // than this threshold. diff --git a/sources/iTermAdvancedSettingsModel.m b/sources/iTermAdvancedSettingsModel.m index a1bfd21..b14a593 100644 --- a/sources/iTermAdvancedSettingsModel.m +++ b/sources/iTermAdvancedSettingsModel.m @@ -271,6 +271,19 @@ + (void)enumerateDictionaries:(void (^)(NSDictionary *))block { // `-----' : : DEFINE_FLOAT(fractionOfCharacterSelectingNextNeighbor, 0.35, SECTION_MOUSE @"Fraction of character’s width on its right side that can be used to select the character to its right."); +// PATCH: (Added) iTerm2-borderless Features + +#pragma mark iTerm2-borderless Features + +#define SECTION_BORDERLESS @"iTerm2-borderless Features: " + +DEFINE_FLOAT(timeBeforeBlinks, 0.5, SECTION_BORDERLESS @"Duration before cursor starts blinking after a keypress."); +DEFINE_BOOL(setCursorForegroundColor, YES, SECTION_BORDERLESS @"Set cursor foreground color."); +//DEFINE_STRING(windowTitleFormat, @"%@", SECTION_BORDERLESS @"Window title format\n“%@” represents the current session name, e.g. 'Terminal - %@'") +DEFINE_INT(standardWindowButtonsHorizontalOffset, 17, SECTION_BORDERLESS @"Standard window buttons horizontal offset") +DEFINE_INT(standardWindowButtonsVerticalOffset, 8, SECTION_BORDERLESS @"Standard window buttons vertical offset") +DEFINE_STRING(disabledNewOutputIndicatorCommands, @"vi,vim,top,htop", SECTION_BORDERLESS @"Comma-seperated list of commands to not show new-output indicator"); + #pragma mark Terminal #define SECTION_TERMINAL @"Terminal: " diff --git a/sources/iTermCursor.m b/sources/iTermCursor.m index a38fd56..c944dd6 100644 --- a/sources/iTermCursor.m +++ b/sources/iTermCursor.m @@ -209,9 +209,10 @@ - (void)drawWithRect:(NSRect)rect coord:coord]; } else { // Non-smart + // PATCH: (Modified) Set cursor foreground color [self.delegate cursorDrawCharacterAt:coord doubleWidth:doubleWidth - overrideColor:foregroundColor + overrideColor:[iTermAdvancedSettingsModel setCursorForegroundColor] == YES ? foregroundColor : nil context:ctx backgroundColor:backgroundColor]; } diff --git a/sources/iTermRootTerminalView.m b/sources/iTermRootTerminalView.m index b1d5a10..8d050c1 100644 --- a/sources/iTermRootTerminalView.m +++ b/sources/iTermRootTerminalView.m @@ -136,7 +136,7 @@ - (instancetype)initWithFrame:(NSRect)frameRect [self setTabBarControlAutoresizingMask:(NSViewHeightSizable | NSViewMaxXMargin)]; break; } - if (@available(macOS 10.14, *)) { + if (NO) { [self addSubview:_tabBarBacking]; [_tabBarBacking addSubview:_tabBarControl]; } else { @@ -695,7 +695,8 @@ - (void)layoutSubviewsTopTabBarVisible:(BOOL)topTabBarVisible forWindow:(NSWindo } - (void)setTabBarFrame:(NSRect)frame { - if (@available(macOS 10.14, *)) { + frame.origin.y -= 10; + if (NO) { assert(!_tabBarControlOnLoan); _tabBarBacking.frame = frame; self.tabBarControl.frame = _tabBarBacking.bounds; diff --git a/sources/iTermTabBarControlView.m b/sources/iTermTabBarControlView.m index 4be80cf..b4014de 100644 --- a/sources/iTermTabBarControlView.m +++ b/sources/iTermTabBarControlView.m @@ -13,7 +13,7 @@ #import "NSObject+iTerm.h" #import "NSView+iTerm.h" -CGFloat iTermTabBarControlViewDefaultHeight = 24; +CGFloat iTermTabBarControlViewDefaultHeight = 22; // PATCH: (Modified) hide tab bar @interface NSView (Private) - (NSRect)_opaqueRectForWindowMoveWhenInTitlebar; @@ -49,8 +49,8 @@ - (instancetype)initWithFrame:(NSRect)frameRect { - (void)drawRect:(NSRect)dirtyRect { if (@available(macOS 10.14, *)) { } else { - [[NSColor windowBackgroundColor] set]; - NSRectFill(dirtyRect); + [[NSColor clearColor] set]; + //NSRectFill(dirtyRect); } [super drawRect:dirtyRect]; @@ -245,7 +245,8 @@ - (void)setFlashState:(iTermTabBarFlashState)flashState { #pragma mark - Window Dragging - (BOOL)mouseDownCanMoveWindow { - return [self.itermTabBarDelegate iTermTabBarCanDragWindow] ? NO : [super mouseDownCanMoveWindow]; + // PATCH: (Modified) make it easier to drag the window without the tab bar getting in the way + return YES; } - (NSRect)_opaqueRectForWindowMoveWhenInTitlebar { diff --git a/sources/iTermTextDrawingHelper.m b/sources/iTermTextDrawingHelper.m index 49bbd96..9977aac 100644 --- a/sources/iTermTextDrawingHelper.m +++ b/sources/iTermTextDrawingHelper.m @@ -2586,10 +2586,11 @@ - (NSColor *)backgroundColorForCursor { } - (BOOL)shouldShowCursor { + // PATCH: (Modified) Blink delay after moving the cursor if (_cursorBlinking && self.isInKeyWindow && _textViewIsActiveSession && - [NSDate timeIntervalSinceReferenceDate] - _lastTimeCursorMoved > 0.5) { + [NSDate timeIntervalSinceReferenceDate] - _lastTimeCursorMoved > [iTermAdvancedSettingsModel timeBeforeBlinks]) { // Allow the cursor to blink if it is configured, the window is key, this session is active // in the tab, and the cursor has not moved for half a second. return _blinkingItemsVisible; diff --git a/sources/iTermWindowImpl.m b/sources/iTermWindowImpl.m index 235077c..bc66a5c 100644 --- a/sources/iTermWindowImpl.m +++ b/sources/iTermWindowImpl.m @@ -60,6 +60,48 @@ - (void)iterm_dealloc { } +// PATCH: (Added) Modify standard title bar +- (void)layoutIfNeeded { + NSButton *closeButton = [self.contentView.window standardWindowButton:NSWindowCloseButton]; + NSButton *miniaturizeButton = [self.contentView.window standardWindowButton:NSWindowMiniaturizeButton]; + NSButton *fullscreenButton = [self.contentView.window standardWindowButton:NSWindowZoomButton]; + + int horizOff = [iTermAdvancedSettingsModel standardWindowButtonsHorizontalOffset]; + int vertOff = [iTermAdvancedSettingsModel standardWindowButtonsVerticalOffset] + 20; + + [closeButton setFrameOrigin:NSMakePoint(0 + horizOff, 3)]; + [miniaturizeButton setFrameOrigin:NSMakePoint(20 + horizOff, 3)]; + [fullscreenButton setFrameOrigin:NSMakePoint(40 + horizOff, 3)]; + + NSView *lights = closeButton.superview.superview; + if (lights) { + NSRect newFrame = lights.frame; + newFrame.origin.y = self.contentView.frame.size.height - vertOff; + lights.frame = newFrame; + } + + + self.titlebarAppearsTransparent = true; + + + if (@available(macOS 10.14, *)) { + NSView *decorationView = closeButton.superview.superview.subviews[1]; + decorationView.layer.opacity = 0.0; + } + + /* + NSTextView *titleView = closeButton.superview.subviews[3]; + titleView.font = [NSFont systemFontOfSize:13]; + [titleView removeConstraints:titleView.constraints]; + CGRect frame = titleView.frame; + frame.size.width = 200; + frame.origin.y = 3; + titleView.frame = frame; + titleView.drawsBackground = true; + */ + [super layoutIfNeeded]; +} + - (BOOL)titleChangedRecently { NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate]; return (now > _timeOfLastWindowTitleChange && now - _timeOfLastWindowTitleChange < iTermWindowTitleChangeMinimumInterval); ================================================ FILE: icons/generate.sh ================================================ #!/usr/bin/env bash source="AppIcon.png" dest="AppIcon.appiconset" mkdir $dest sips -z 16 16 "$source" --out "$dest/icon_16x16.png" sips -z 32 32 "$source" --out "$dest/icon_16x16@2x.png" sips -z 32 32 "$source" --out "$dest/icon_32x32.png" sips -z 64 64 "$source" --out "$dest/icon_32x32@2x.png" sips -z 128 128 "$source" --out "$dest/icon_128x128.png" sips -z 256 256 "$source" --out "$dest/icon_128x128@2x.png" sips -z 256 256 "$source" --out "$dest/icon_256x256.png" sips -z 512 512 "$source" --out "$dest/icon_256x256@2x.png" sips -z 512 512 "$source" --out "$dest/icon_512x512.png" cp "$source" "$dest/icon_512x512@2x.png" iconutil -c icns "$dest"