diff --git a/macos/ONLYOFFICE/Code/Controllers/Common/ASCExternalController.h b/macos/ONLYOFFICE/Code/Controllers/Common/ASCExternalController.h index 7ca5fe7d6..61866aace 100644 --- a/macos/ONLYOFFICE/Code/Controllers/Common/ASCExternalController.h +++ b/macos/ONLYOFFICE/Code/Controllers/Common/ASCExternalController.h @@ -45,6 +45,7 @@ NS_ASSUME_NONNULL_BEGIN @protocol ASCExternalDelegate @optional - (NSString *)onApplicationName; +- (NSString *)onApplicationNameShort; - (NSString *)onAppInfo:(NSString *)key; - (NSString *)onAppPreferredLanguage; - (NSString *)onCommercialInfo; diff --git a/macos/ONLYOFFICE/Code/TouchBar/Controllers/ASCTouchBarController.m b/macos/ONLYOFFICE/Code/TouchBar/Controllers/ASCTouchBarController.m index d44b08da7..e2142d311 100644 --- a/macos/ONLYOFFICE/Code/TouchBar/Controllers/ASCTouchBarController.m +++ b/macos/ONLYOFFICE/Code/TouchBar/Controllers/ASCTouchBarController.m @@ -244,7 +244,7 @@ NSString *tabScrubberItemIdentifier = @"tabItem"; self.onItemTap(self.startPageButton, kStartPageButtonIdentifier); } }]; - _startPageButton = [NSButton buttonWithTitle:[ASCHelper appName] + _startPageButton = [NSButton buttonWithTitle:[ASCHelper appNameShort] image:[NSImage imageNamed:@"touchbar-tab-startpage"] target:blockHolder action:@selector(invoke:)]; diff --git a/macos/ONLYOFFICE/Code/Utils/ASCHelper.h b/macos/ONLYOFFICE/Code/Utils/ASCHelper.h index 2061bd7bc..21608ecc9 100644 --- a/macos/ONLYOFFICE/Code/Utils/ASCHelper.h +++ b/macos/ONLYOFFICE/Code/Utils/ASCHelper.h @@ -53,4 +53,5 @@ + (NSString *)licensePath; + (void)createCloudPath; + (NSString *)appName; ++ (NSString *)appNameShort; @end diff --git a/macos/ONLYOFFICE/Code/Utils/ASCHelper.m b/macos/ONLYOFFICE/Code/Utils/ASCHelper.m index b1a5a7953..a8df6a551 100644 --- a/macos/ONLYOFFICE/Code/Utils/ASCHelper.m +++ b/macos/ONLYOFFICE/Code/Utils/ASCHelper.m @@ -145,4 +145,25 @@ static NSMutableDictionary * localSettings; } } ++ (NSString *)appNameShort { + id externalDelegate = [[ASCExternalController shared] delegate]; + + if (externalDelegate && [externalDelegate respondsToSelector:@selector(onApplicationNameShort)]) { + return [externalDelegate onApplicationNameShort]; + } else { + CFBundleRef localInfoBundle = CFBundleGetMainBundle(); + NSDictionary * localInfoDict = (NSDictionary *)CFBundleGetLocalInfoDictionary(localInfoBundle); + + if (localInfoDict) { + NSString * productName = [localInfoDict objectForKey:@"CFBundleName"]; + + if (productName && productName.length > 0) { + return productName; + } + } + + return [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleNameKey]; + } +} + @end