Skip to content

Commit 2a1176f

Browse files
committed
Embeddable iTerm2Lib.framework + Demo App
1 parent d1be119 commit 2a1176f

36 files changed

+5613
-53
lines changed
Binary file not shown.
0 Bytes
Binary file not shown.

iTerm2.xcodeproj/project.pbxproj

Lines changed: 2192 additions & 44 deletions
Large diffs are not rendered by default.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1000"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "E7F22BEA213682A900664A10"
18+
BuildableName = "iTerm2Lib.framework"
19+
BlueprintName = "iTerm2Lib"
20+
ReferencedContainer = "container:iTerm2.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Library"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
<AdditionalOptions>
33+
</AdditionalOptions>
34+
</TestAction>
35+
<LaunchAction
36+
buildConfiguration = "Library"
37+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
38+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
39+
launchStyle = "0"
40+
useCustomWorkingDirectory = "NO"
41+
ignoresPersistentStateOnLaunch = "NO"
42+
debugDocumentVersioning = "YES"
43+
debugServiceExtension = "internal"
44+
allowLocationSimulation = "YES">
45+
<MacroExpansion>
46+
<BuildableReference
47+
BuildableIdentifier = "primary"
48+
BlueprintIdentifier = "E7F22BEA213682A900664A10"
49+
BuildableName = "iTerm2Lib.framework"
50+
BlueprintName = "iTerm2Lib"
51+
ReferencedContainer = "container:iTerm2.xcodeproj">
52+
</BuildableReference>
53+
</MacroExpansion>
54+
<AdditionalOptions>
55+
</AdditionalOptions>
56+
</LaunchAction>
57+
<ProfileAction
58+
buildConfiguration = "Library"
59+
shouldUseLaunchSchemeArgsEnv = "YES"
60+
savedToolIdentifier = ""
61+
useCustomWorkingDirectory = "NO"
62+
debugDocumentVersioning = "YES">
63+
<MacroExpansion>
64+
<BuildableReference
65+
BuildableIdentifier = "primary"
66+
BlueprintIdentifier = "E7F22BEA213682A900664A10"
67+
BuildableName = "iTerm2Lib.framework"
68+
BlueprintName = "iTerm2Lib"
69+
ReferencedContainer = "container:iTerm2.xcodeproj">
70+
</BuildableReference>
71+
</MacroExpansion>
72+
</ProfileAction>
73+
<AnalyzeAction
74+
buildConfiguration = "Library">
75+
</AnalyzeAction>
76+
<ArchiveAction
77+
buildConfiguration = "Library"
78+
revealArchiveInOrganizer = "YES">
79+
</ArchiveAction>
80+
</Scheme>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1000"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "E7F22E0D2136A29500664A10"
18+
BuildableName = "iTerm2LibDemo.app"
19+
BlueprintName = "iTerm2LibDemo"
20+
ReferencedContainer = "container:iTerm2.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Library"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
<MacroExpansion>
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "E7F22E0D2136A29500664A10"
36+
BuildableName = "iTerm2LibDemo.app"
37+
BlueprintName = "iTerm2LibDemo"
38+
ReferencedContainer = "container:iTerm2.xcodeproj">
39+
</BuildableReference>
40+
</MacroExpansion>
41+
<AdditionalOptions>
42+
</AdditionalOptions>
43+
</TestAction>
44+
<LaunchAction
45+
buildConfiguration = "Library"
46+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
47+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
48+
launchStyle = "0"
49+
useCustomWorkingDirectory = "NO"
50+
ignoresPersistentStateOnLaunch = "NO"
51+
debugDocumentVersioning = "YES"
52+
debugServiceExtension = "internal"
53+
allowLocationSimulation = "YES">
54+
<BuildableProductRunnable
55+
runnableDebuggingMode = "0">
56+
<BuildableReference
57+
BuildableIdentifier = "primary"
58+
BlueprintIdentifier = "E7F22E0D2136A29500664A10"
59+
BuildableName = "iTerm2LibDemo.app"
60+
BlueprintName = "iTerm2LibDemo"
61+
ReferencedContainer = "container:iTerm2.xcodeproj">
62+
</BuildableReference>
63+
</BuildableProductRunnable>
64+
<AdditionalOptions>
65+
</AdditionalOptions>
66+
</LaunchAction>
67+
<ProfileAction
68+
buildConfiguration = "Library"
69+
shouldUseLaunchSchemeArgsEnv = "YES"
70+
savedToolIdentifier = ""
71+
useCustomWorkingDirectory = "NO"
72+
debugDocumentVersioning = "YES">
73+
<BuildableProductRunnable
74+
runnableDebuggingMode = "0">
75+
<BuildableReference
76+
BuildableIdentifier = "primary"
77+
BlueprintIdentifier = "E7F22E0D2136A29500664A10"
78+
BuildableName = "iTerm2LibDemo.app"
79+
BlueprintName = "iTerm2LibDemo"
80+
ReferencedContainer = "container:iTerm2.xcodeproj">
81+
</BuildableReference>
82+
</BuildableProductRunnable>
83+
</ProfileAction>
84+
<AnalyzeAction
85+
buildConfiguration = "Library">
86+
</AnalyzeAction>
87+
<ArchiveAction
88+
buildConfiguration = "Library"
89+
revealArchiveInOrganizer = "YES">
90+
</ArchiveAction>
91+
</Scheme>

iTerm2Lib/Info.plist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>FMWK</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>$(CURRENT_PROJECT_VERSION)</string>
21+
</dict>
22+
</plist>

iTerm2Lib/NSWindow+iTermLib.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#import <Cocoa/Cocoa.h>
2+
3+
@interface NSWindow (iTermLib)
4+
5+
- (double)approximateFractionOccluded;
6+
7+
@end

iTerm2Lib/NSWindow+iTermLib.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#import "NSWindow+iTermLib.h"
2+
3+
@implementation NSWindow (iTermLib)
4+
5+
- (double)approximateFractionOccluded
6+
{
7+
return 0;
8+
}
9+
10+
@end

iTerm2Lib/SessionView+iTermLib.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#import <Cocoa/Cocoa.h>
2+
3+
#import "SessionView.h"
4+
5+
extern NSString* const iTermLibSessionViewDidMoveToWindowNotification;
6+
7+
@interface SessionView (iTermLib)
8+
9+
@end

iTerm2Lib/SessionView+iTermLib.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#import "SessionView+iTermLib.h"
2+
3+
NSString* const iTermLibSessionViewDidMoveToWindowNotification = @"iTermLibSessionViewDidMoveToWindowNotification";
4+
5+
@implementation SessionView (iTermLib)
6+
7+
- (void)viewDidMoveToWindow
8+
{
9+
[NSNotificationCenter.defaultCenter postNotificationName:iTermLibSessionViewDidMoveToWindowNotification object:self];
10+
}
11+
12+
@end

iTerm2Lib/iTerm2Lib.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#import <Cocoa/Cocoa.h>
2+
3+
#import "iTermLibApplication.h"
4+
#import "iTermLibController.h"
5+
#import "iTermLibSessionController.h"
6+
#import "SessionView+iTermLib.h"
7+
#import "NSWindow+iTermLib.h"

iTerm2Lib/iTermLibApplication.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#import <Cocoa/Cocoa.h>
2+
3+
@class iTermLibController;
4+
5+
@interface iTermLibApplication : NSObject
6+
7+
+ (instancetype)sharedApplication;
8+
9+
@property (readonly) iTermLibController *delegate;
10+
11+
@end

iTerm2Lib/iTermLibApplication.m

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#import "iTermLibApplication.h"
2+
3+
#import "iTermLibController.h"
4+
5+
static iTermLibApplication* _gSharedApplication;
6+
7+
@implementation iTermLibApplication
8+
9+
+ (instancetype)sharedApplication
10+
{
11+
static dispatch_once_t onceToken;
12+
dispatch_once(&onceToken, ^{
13+
_gSharedApplication = [[iTermLibApplication alloc] init];
14+
});
15+
16+
return _gSharedApplication;
17+
}
18+
19+
- (iTermLibController*)delegate
20+
{
21+
return iTermLibController.sharedController;
22+
}
23+
24+
@end

iTerm2Lib/iTermLibController.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#import <Cocoa/Cocoa.h>
2+
3+
#import "iTermLibSessionController.h"
4+
5+
@class PTYSession;
6+
@class iTermLibController;
7+
8+
@protocol iTermLibControllerDelegate<NSObject>
9+
10+
- (void)controller:(iTermLibController*)controller shouldRemoveSessionView:(iTermLibSessionController*)session;
11+
12+
@optional
13+
- (void)controller:(iTermLibController*)controller sessionDidClose:(iTermLibSessionController*)session;
14+
- (void)controller:(iTermLibController*)controller nameOfSession:(iTermLibSessionController*)session didChangeTo:(NSString*)newName;
15+
16+
@end
17+
18+
@interface iTermLibController : NSObject<iTermLibSessionDelegate>
19+
20+
+ (instancetype)sharedController;
21+
22+
@property (readonly, copy) NSArray<iTermLibSessionController*>* sessions;
23+
@property (readonly) iTermLibSessionController* activeSession;
24+
@property (assign) id<iTermLibControllerDelegate> delegate;
25+
@property (assign) BOOL broadcasting;
26+
27+
- (iTermLibSessionController*)createSessionWithProfile:(Profile*)profile command:(NSString*)command initialSize:(NSSize)initialSize;
28+
29+
@end

0 commit comments

Comments
 (0)