Skip to content

Commit 5243969

Browse files
committed
Tweak compact stoplight button insets. 12721
1 parent 8a62d9d commit 5243969

File tree

4 files changed

+27
-5
lines changed

4 files changed

+27
-5
lines changed

sources/PseudoTerminal.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5027,7 +5027,10 @@ - (NSEdgeInsets)tabBarInsets {
50275027
}
50285028

50295029
- (NSEdgeInsets)tabBarInsetsForCompactWindow NS_AVAILABLE_MAC(10_14) {
5030-
const CGFloat stoplightButtonsWidth = 75;
5030+
CGFloat stoplightButtonsWidth = 75;
5031+
if (@available(macOS 26, *)) {
5032+
stoplightButtonsWidth += 3;
5033+
}
50315034
switch ([iTermPreferences intForKey:kPreferenceKeyTabPosition]) {
50325035
case PSMTab_TopTab: {
50335036
const CGFloat extraSpace = MAX(0, [iTermAdvancedSettingsModel extraSpaceBeforeCompactTopTabBar]);

sources/iTermRootTerminalView.m

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ - (CGFloat)leftInsetForWindowButtons {
479479
case TAB_STYLE_MINIMAL:
480480
return 2.5;
481481
case TAB_STYLE_COMPACT:
482+
return 6 + 3;
482483
case TAB_STYLE_DARK:
483484
case TAB_STYLE_LIGHT:
484485
case TAB_STYLE_AUTOMATIC:
@@ -490,6 +491,24 @@ - (CGFloat)leftInsetForWindowButtons {
490491
return 6;
491492
}
492493

494+
- (CGFloat)widthForStandardButtonsView {
495+
if (@available(macOS 26, *)) {
496+
const iTermPreferencesTabStyle preferredStyle = [iTermPreferences intForKey:kPreferenceKeyTabStyle];
497+
switch (preferredStyle) {
498+
case TAB_STYLE_COMPACT:
499+
return iTermStandardButtonsViewWidth + 3;
500+
case TAB_STYLE_MINIMAL:
501+
case TAB_STYLE_DARK:
502+
case TAB_STYLE_LIGHT:
503+
case TAB_STYLE_AUTOMATIC:
504+
case TAB_STYLE_DARK_HIGH_CONTRAST:
505+
case TAB_STYLE_LIGHT_HIGH_CONTRAST:
506+
break;
507+
}
508+
}
509+
return iTermStandardButtonsViewWidth;
510+
}
511+
493512
- (CGFloat)strideForWindowButtons {
494513
if (@available(macOS 26, *)) {
495514
const iTermPreferencesTabStyle preferredStyle = [iTermPreferences intForKey:kPreferenceKeyTabStyle];
@@ -537,7 +556,7 @@ - (NSEdgeInsets)insetsForStoplightHotbox {
537556
return insets;
538557
}
539558

540-
const CGFloat hotboxSideInset = (iTermStoplightHotboxWidth - iTermStandardButtonsViewWidth) / 2.0;
559+
const CGFloat hotboxSideInset = (iTermStoplightHotboxWidth - [self widthForStandardButtonsView]) / 2.0;
541560
const CGFloat hotboxVerticalInset = (iTermStoplightHotboxHeight - iTermStandardButtonsViewHeight) / 2.0;
542561
return NSEdgeInsetsMake(hotboxVerticalInset, hotboxSideInset, hotboxVerticalInset, hotboxSideInset);
543562
}
@@ -552,7 +571,7 @@ - (NSRect)frameForStandardWindowButtons {
552571
}
553572
NSRect frame = NSMakeRect(insets.left,
554573
self.frame.size.height - height + insets.bottom + 1,
555-
iTermStandardButtonsViewWidth,
574+
[self widthForStandardButtonsView],
556575
iTermStandardButtonsViewHeight);
557576
return [self retinaRoundRect:frame];
558577
}

0 commit comments

Comments
 (0)