mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
Terminalfont: add Apple Terminal support ( macOS )
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef FASTFETCH_INCLUDED_osascript
|
||||
#define FASTFETCH_INCLUDED_osascript
|
||||
|
||||
#include "fastfetch.h"
|
||||
|
||||
bool ffOsascript(const char* input, FFstrbuf* result);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,17 @@
|
||||
#include "osascript.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
bool ffOsascript(const char* input, FFstrbuf* result) {
|
||||
NSString* appleScript = [NSString stringWithUTF8String: input];
|
||||
NSAppleScript* script = [[NSAppleScript alloc] initWithSource:appleScript];
|
||||
NSDictionary* errInfo = nil;
|
||||
NSAppleEventDescriptor* descriptor = [script executeAndReturnError:&errInfo];
|
||||
if (errInfo)
|
||||
return false;
|
||||
|
||||
ffStrbufSetS(result, [[descriptor stringValue] cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user