diff --git a/atom/browser/ui/cocoa/atom_touch_bar.mm b/atom/browser/ui/cocoa/atom_touch_bar.mm index 0613b2afc3b3..469160c5a587 100644 --- a/atom/browser/ui/cocoa/atom_touch_bar.mm +++ b/atom/browser/ui/cocoa/atom_touch_bar.mm @@ -61,6 +61,16 @@ static NSTouchBarItemIdentifier SliderIdentifier = @"com.electron.touchbar.slide [identifiers addObject:[NSString stringWithFormat:@"%@%@", PopOverIdentifier, base::SysUTF8ToNSString(item_id)]]; } else if (type == "group") { [identifiers addObject:[NSString stringWithFormat:@"%@%@", GroupIdentifier, base::SysUTF8ToNSString(item_id)]]; + } else if (type == "spacer") { + std::string size; + item.Get("size", &size); + if (size == "large") { + [identifiers addObject:NSTouchBarItemIdentifierFixedSpaceLarge]; + } else if (size == "flexible") { + [identifiers addObject:NSTouchBarItemIdentifierFlexibleSpace]; + } else { + [identifiers addObject:NSTouchBarItemIdentifierFixedSpaceSmall]; + } } } } @@ -270,8 +280,6 @@ static NSTouchBarItemIdentifier SliderIdentifier = @"com.electron.touchbar.slide item.colorList = color_list; } - item.showsAlpha = NO; - [self updateColorPicker:item withSettings:settings]; return item; } diff --git a/atom/browser/ui/cocoa/touch_bar_forward_declarations.h b/atom/browser/ui/cocoa/touch_bar_forward_declarations.h index e4e2bc15a5dd..68693cb593ba 100644 --- a/atom/browser/ui/cocoa/touch_bar_forward_declarations.h +++ b/atom/browser/ui/cocoa/touch_bar_forward_declarations.h @@ -27,6 +27,9 @@ typedef NSString* NSTouchBarCustomizationIdentifier; static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFixedSpaceSmall = @"NSTouchBarItemIdentifierFixedSpaceSmall"; +static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFixedSpaceLarge = + @"NSTouchBarItemIdentifierFixedSpaceLarge"; + static const NSTouchBarItemIdentifier NSTouchBarItemIdentifierFlexibleSpace = @"NSTouchBarItemIdentifierFlexibleSpace"; diff --git a/lib/browser/api/touch-bar.js b/lib/browser/api/touch-bar.js index 62008b70d88d..dd8e89f4c293 100644 --- a/lib/browser/api/touch-bar.js +++ b/lib/browser/api/touch-bar.js @@ -153,6 +153,14 @@ TouchBar.Label = class TouchBarLabel extends TouchBarItem { } } +TouchBar.Spacer = class TouchBarSpacer extends TouchBarItem { + constructor (config) { + super(config) + this.type = 'spacer' + this.size = config.size + } +} + TouchBar.Popover = class TouchBarPopover extends TouchBarItem { constructor (config) { super(config)