From 70ba6490006edc85c6577dc9e11f9f1140913738 Mon Sep 17 00:00:00 2001
From: Bernd Ohr <dev5@7zz.de>
Date: Mon, 7 Sep 2009 16:56:39 +0200
Subject: [PATCH] Add a 'Open in Terminal' toolbar item

---
 GitX.xcodeproj/project.pbxproj |    8 ++
 Images/OpenInTerminal.png      |  Bin 0 -> 505 bytes
 PBGitHistoryController.h       |    1 +
 PBGitHistoryController.m       |   11 +++
 PBGitHistoryView.xib           |  122 +++++++++++++++++++++++++++---
 Terminal.h                     |  159 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 289 insertions(+), 12 deletions(-)
 create mode 100644 Images/OpenInTerminal.png
 create mode 100644 Terminal.h

diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj
index db13f30..0ca78b4 100644
--- a/GitX.xcodeproj/project.pbxproj
+++ b/GitX.xcodeproj/project.pbxproj
@@ -43,6 +43,8 @@
 		91B103CC0E898EC300C84364 /* PBIconAndTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 91B103CB0E898EC300C84364 /* PBIconAndTextCell.m */; };
 		93CB42C20EAB7B2200530609 /* PBGitDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 93CB42C10EAB7B2200530609 /* PBGitDefaults.m */; };
 		93F7857F0EA3ABF100C1F443 /* PBCommitMessageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 93F7857E0EA3ABF100C1F443 /* PBCommitMessageView.m */; };
+		9CB3D501105554A300D3AE74 /* ScriptingBridge.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CB3D500105554A300D3AE74 /* ScriptingBridge.framework */; };
+		9CB3D58A10557D8700D3AE74 /* OpenInTerminal.png in Resources */ = {isa = PBXBuildFile; fileRef = 9CB3D58910557D8700D3AE74 /* OpenInTerminal.png */; };
 		D26DC6450E782C9000C777B2 /* gitx.icns in Resources */ = {isa = PBXBuildFile; fileRef = D26DC6440E782C9000C777B2 /* gitx.icns */; };
 		EB2A734A0FEE3F09006601CF /* PBCollapsibleSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = EB2A73490FEE3F09006601CF /* PBCollapsibleSplitView.m */; };
 		F50A411F0EBB874C00208746 /* mainSplitterBar.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F50A411D0EBB874C00208746 /* mainSplitterBar.tiff */; };
@@ -190,6 +192,8 @@
 		93F7857D0EA3ABF100C1F443 /* PBCommitMessageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCommitMessageView.h; sourceTree = "<group>"; };
 		93F7857E0EA3ABF100C1F443 /* PBCommitMessageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCommitMessageView.m; sourceTree = "<group>"; };
 		93FCCBA80EA8AF450061B02B /* PBGitConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitConfig.m; sourceTree = "<group>"; };
+		9CB3D500105554A300D3AE74 /* ScriptingBridge.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ScriptingBridge.framework; path = /System/Library/Frameworks/ScriptingBridge.framework; sourceTree = "<absolute>"; };
+		9CB3D58910557D8700D3AE74 /* OpenInTerminal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = OpenInTerminal.png; path = Images/OpenInTerminal.png; sourceTree = "<group>"; };
 		D26DC6440E782C9000C777B2 /* gitx.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = gitx.icns; sourceTree = "<group>"; };
 		EB2A73480FEE3F09006601CF /* PBCollapsibleSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBCollapsibleSplitView.h; sourceTree = "<group>"; };
 		EB2A73490FEE3F09006601CF /* PBCollapsibleSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBCollapsibleSplitView.m; sourceTree = "<group>"; };
@@ -302,6 +306,7 @@
 				F580E6AE0E733276009E2D3F /* Sparkle.framework in Frameworks */,
 				F5E4DBFB0EAB58D90013FAFC /* SystemConfiguration.framework in Frameworks */,
 				F5C580E50EDA250900995434 /* libgit2.a in Frameworks */,
+				9CB3D501105554A300D3AE74 /* ScriptingBridge.framework in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -334,6 +339,7 @@
 		1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				9CB3D500105554A300D3AE74 /* ScriptingBridge.framework */,
 				F5E4DBFA0EAB58D90013FAFC /* SystemConfiguration.framework */,
 				F580E6AD0E733276009E2D3F /* Sparkle.framework */,
 				F56526230E03D85900F03B52 /* WebKit.framework */,
@@ -389,6 +395,7 @@
 				3BC07F4A0ED5A5C5009A7768 /* HistoryViewTemplate.png */,
 				3BC07F4B0ED5A5C5009A7768 /* CommitViewTemplate.png */,
 				F56ADDD70ED19F9E002AC78F /* AddBranchTemplate.png */,
+				9CB3D58910557D8700D3AE74 /* OpenInTerminal.png */,
 				F56ADDD80ED19F9E002AC78F /* AddLabelTemplate.png */,
 				056438B60ED0C40B00985397 /* DetailViewTemplate.png */,
 				F57240BA0E9678EA00D8EE66 /* deleted_file.png */,
@@ -743,6 +750,7 @@
 				47DBDB6A0E94EF6500671A1E /* Preferences.xib in Resources */,
 				47DBDBB10E94F6CA00671A1E /* Updates.png in Resources */,
 				F569AE930F2CBD7C00C2FFA7 /* Credits.html in Resources */,
+				9CB3D58A10557D8700D3AE74 /* OpenInTerminal.png in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/Images/OpenInTerminal.png b/Images/OpenInTerminal.png
new file mode 100644
index 0000000000000000000000000000000000000000..ed7999a6246b00686e21a007a641f9676603b5b8
GIT binary patch
diff --git a/PBGitHistoryController.h b/PBGitHistoryController.h
index fadb6cd..89a07a6 100644
--- a/PBGitHistoryController.h
+++ b/PBGitHistoryController.h
@@ -43,6 +43,7 @@
 - (IBAction) toggleQuickView: sender;
 - (IBAction) openSelectedFile: sender;
 - (void) updateQuicklookForce: (BOOL) force;
+- (IBAction) openInTerminal: sender;
 
 // Context menu methods
 - (NSMenu *)contextMenuForTreeView;
diff --git a/PBGitHistoryController.m b/PBGitHistoryController.m
index f8ad04a..6a46157 100644
--- a/PBGitHistoryController.m
+++ b/PBGitHistoryController.m
@@ -11,6 +11,7 @@
 #import "PBGitGrapher.h"
 #import "PBGitRevisionCell.h"
 #import "PBCommitList.h"
+#import "Terminal.h"
 #define QLPreviewPanel NSClassFromString(@"QLPreviewPanel")
 
 
@@ -176,6 +177,16 @@ - (IBAction) refresh: sender
 	[repository.revisionList reload];
 }
 
+- (IBAction) openInTerminal: sender
+{
+    TerminalApplication *term = [SBApplication applicationWithBundleIdentifier: @"com.apple.Terminal"];
+	NSString *workingDirectory = [[repository workingDirectory] stringByAppendingString:@"/"];
+    NSString *cmd = [NSString stringWithFormat: @"cd %@; clear; echo '# Opened by GitX:'; git status", workingDirectory];
+    [term doScript: cmd in: nil];
+    [NSThread sleepForTimeInterval: 0.1];
+    [term activate];
+}
+
 - (void) updateView
 {
 	[self refresh:nil];
diff --git a/PBGitHistoryView.xib b/PBGitHistoryView.xib
index ef4df1e..47294d9 100644
--- a/PBGitHistoryView.xib
+++ b/PBGitHistoryView.xib
@@ -2,14 +2,15 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.03">
 	<data>
 		<int key="IBDocument.SystemTarget">1050</int>
-		<string key="IBDocument.SystemVersion">9L30</string>
+		<string key="IBDocument.SystemVersion">9J61</string>
 		<string key="IBDocument.InterfaceBuilderVersion">677</string>
-		<string key="IBDocument.AppKitVersion">949.54</string>
+		<string key="IBDocument.AppKitVersion">949.46</string>
 		<string key="IBDocument.HIToolboxVersion">353.00</string>
 		<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
 			<bool key="EncodedWithXMLCoder">YES</bool>
-			<integer value="46"/>
+			<integer value="113"/>
 			<integer value="237"/>
+			<integer value="46"/>
 		</object>
 		<object class="NSArray" key="IBDocument.PluginDependencies">
 			<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1152,6 +1153,7 @@
 						<string>1E431E79-1591-49E7-9E17-49497CA4622A</string>
 						<string>7FFB691C-2D2F-49A9-997F-AE1AE8BFF3F1</string>
 						<string>86360841-A2B1-4802-845A-AE424521FE99</string>
+						<string>97389D7A-8D85-43E3-9E5B-E2A6EC91695C</string>
 						<string>99C2C9EB-AE16-42A9-BE52-46CE903E9AF9</string>
 						<string>NSToolbarFlexibleSpaceItem</string>
 						<string>NSToolbarSeparatorItem</string>
@@ -1166,9 +1168,10 @@
 							<string key="NSToolbarItemPaletteLabel">View selector</string>
 							<nil key="NSToolbarItemToolTip"/>
 							<object class="NSSegmentedControl" key="NSToolbarItemView" id="764711234">
-								<nil key="NSNextResponder"/>
+								<reference key="NSNextResponder"/>
 								<int key="NSvFlags">268</int>
 								<string key="NSFrame">{{0, 14}, {87, 25}}</string>
+								<reference key="NSSuperview"/>
 								<int key="NSTag">3</int>
 								<bool key="NSEnabled">YES</bool>
 								<object class="NSSegmentedCell" key="NSCell" id="266464607">
@@ -1225,9 +1228,10 @@
 							</object>
 							<nil key="NSToolbarItemToolTip"/>
 							<object class="NSSearchField" key="NSToolbarItemView" id="845792858">
-								<nil key="NSNextResponder"/>
+								<reference key="NSNextResponder"/>
 								<int key="NSvFlags">265</int>
 								<string key="NSFrame">{{0, 14}, {183, 22}}</string>
+								<reference key="NSSuperview"/>
 								<bool key="NSEnabled">YES</bool>
 								<object class="NSSearchFieldCell" key="NSCell" id="449521666">
 									<int key="NSCellFlags">343014976</int>
@@ -1304,9 +1308,10 @@
 							<string key="NSToolbarItemPaletteLabel">Create Branch</string>
 							<nil key="NSToolbarItemToolTip"/>
 							<object class="NSButton" key="NSToolbarItemView" id="733802043">
-								<nil key="NSNextResponder"/>
+								<reference key="NSNextResponder"/>
 								<int key="NSvFlags">268</int>
 								<string key="NSFrame">{{21, 14}, {40, 25}}</string>
+								<reference key="NSSuperview"/>
 								<bool key="NSEnabled">YES</bool>
 								<object class="NSButtonCell" key="NSCell" id="596537926">
 									<int key="NSCellFlags">-2080244224</int>
@@ -1337,6 +1342,48 @@
 							<bool key="NSToolbarIsUserRemovable">YES</bool>
 							<int key="NSToolbarItemVisibilityPriority">0</int>
 						</object>
+						<object class="NSToolbarItem" id="36111979">
+							<object class="NSMutableString" key="NSToolbarItemIdentifier">
+								<characters key="NS.bytes">97389D7A-8D85-43E3-9E5B-E2A6EC91695C</characters>
+							</object>
+							<string key="NSToolbarItemLabel">Open Terminal</string>
+							<string key="NSToolbarItemPaletteLabel">Open Terminal</string>
+							<nil key="NSToolbarItemToolTip"/>
+							<object class="NSButton" key="NSToolbarItemView" id="727118407">
+								<reference key="NSNextResponder"/>
+								<int key="NSvFlags">268</int>
+								<string key="NSFrame">{{24, 14}, {40, 25}}</string>
+								<reference key="NSSuperview"/>
+								<bool key="NSEnabled">YES</bool>
+								<object class="NSButtonCell" key="NSCell" id="627102411">
+									<int key="NSCellFlags">-2080244224</int>
+									<int key="NSCellFlags2">134217728</int>
+									<string key="NSContents"/>
+									<reference key="NSSupport" ref="924107556"/>
+									<reference key="NSControlView" ref="727118407"/>
+									<int key="NSButtonFlags">-2033434369</int>
+									<int key="NSButtonFlags2">163</int>
+									<object class="NSCustomResource" key="NSNormalImage" id="146601623">
+										<string key="NSClassName">NSImage</string>
+										<string key="NSResourceName">OpenInTerminal</string>
+									</object>
+									<string key="NSAlternateContents"/>
+									<string key="NSKeyEquivalent"/>
+									<int key="NSPeriodicDelay">400</int>
+									<int key="NSPeriodicInterval">75</int>
+								</object>
+							</object>
+							<reference key="NSToolbarItemImage" ref="146601623"/>
+							<nil key="NSToolbarItemTarget"/>
+							<nil key="NSToolbarItemAction"/>
+							<string key="NSToolbarItemMinSize">{40, 25}</string>
+							<string key="NSToolbarItemMaxSize">{40, 25}</string>
+							<bool key="NSToolbarItemEnabled">YES</bool>
+							<bool key="NSToolbarItemAutovalidates">YES</bool>
+							<int key="NSToolbarItemTag">0</int>
+							<bool key="NSToolbarIsUserRemovable">YES</bool>
+							<int key="NSToolbarItemVisibilityPriority">0</int>
+						</object>
 						<object class="NSToolbarItem" id="455812118">
 							<object class="NSMutableString" key="NSToolbarItemIdentifier">
 								<characters key="NS.bytes">99C2C9EB-AE16-42A9-BE52-46CE903E9AF9</characters>
@@ -1345,9 +1392,10 @@
 							<string key="NSToolbarItemPaletteLabel">Branch</string>
 							<nil key="NSToolbarItemToolTip"/>
 							<object class="NSPopUpButton" key="NSToolbarItemView" id="630469851">
-								<nil key="NSNextResponder"/>
+								<reference key="NSNextResponder"/>
 								<int key="NSvFlags">268</int>
 								<string key="NSFrame">{{0, 14}, {134, 26}}</string>
+								<reference key="NSSuperview"/>
 								<bool key="NSEnabled">YES</bool>
 								<object class="NSPopUpButtonCell" key="NSCell" id="265884357">
 									<int key="NSCellFlags">-2076049856</int>
@@ -1417,8 +1465,8 @@
 							<nil key="NSToolbarItemImage"/>
 							<nil key="NSToolbarItemTarget"/>
 							<nil key="NSToolbarItemAction"/>
-							<string key="NSToolbarItemMinSize">{134, 25}</string>
-							<string key="NSToolbarItemMaxSize">{134, 25}</string>
+							<string key="NSToolbarItemMinSize">{134, 26}</string>
+							<string key="NSToolbarItemMaxSize">{134, 26}</string>
 							<bool key="NSToolbarItemEnabled">YES</bool>
 							<bool key="NSToolbarItemAutovalidates">YES</bool>
 							<int key="NSToolbarItemTag">0</int>
@@ -1481,7 +1529,7 @@
 						</object>
 					</object>
 				</object>
-				<object class="NSArray" key="NSToolbarIBAllowedItems">
+				<object class="NSMutableArray" key="NSToolbarIBAllowedItems">
 					<bool key="EncodedWithXMLCoder">YES</bool>
 					<reference ref="215578734"/>
 					<reference ref="776753395"/>
@@ -1489,6 +1537,7 @@
 					<reference ref="633367776"/>
 					<reference ref="479447135"/>
 					<reference ref="608989609"/>
+					<reference ref="36111979"/>
 				</object>
 				<object class="NSMutableArray" key="NSToolbarIBDefaultItems">
 					<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2101,6 +2150,14 @@
 					</object>
 					<int key="connectionID">275</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBActionConnection" key="connection">
+						<string key="label">openInTerminal:</string>
+						<reference key="source" ref="1001"/>
+						<reference key="destination" ref="727118407"/>
+					</object>
+					<int key="connectionID">292</int>
+				</object>
 			</object>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<object class="NSArray" key="orderedObjects">
@@ -2566,6 +2623,7 @@
 							<reference ref="215578734"/>
 							<reference ref="608989609"/>
 							<reference ref="455812118"/>
+							<reference ref="36111979"/>
 						</object>
 						<reference key="parent" ref="1002"/>
 						<string key="objectName">History Toolbar</string>
@@ -2716,6 +2774,29 @@
 						<reference key="object" ref="217429948"/>
 						<reference key="parent" ref="27300806"/>
 					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">287</int>
+						<reference key="object" ref="36111979"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="727118407"/>
+						</object>
+						<reference key="parent" ref="65173285"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">288</int>
+						<reference key="object" ref="727118407"/>
+						<object class="NSMutableArray" key="children">
+							<bool key="EncodedWithXMLCoder">YES</bool>
+							<reference ref="627102411"/>
+						</object>
+						<reference key="parent" ref="36111979"/>
+					</object>
+					<object class="IBObjectRecord">
+						<int key="objectID">289</int>
+						<reference key="object" ref="627102411"/>
+						<reference key="parent" ref="727118407"/>
+					</object>
 				</object>
 			</object>
 			<object class="NSMutableDictionary" key="flattenedProperties">
@@ -2798,6 +2879,10 @@
 					<string>273.IBPluginDependency</string>
 					<string>28.IBPluginDependency</string>
 					<string>28.IBShouldRemoveOnLegacySave</string>
+					<string>287.IBPluginDependency</string>
+					<string>288.IBAttributePlaceholdersKey</string>
+					<string>288.IBPluginDependency</string>
+					<string>289.IBPluginDependency</string>
 					<string>29.IBPluginDependency</string>
 					<string>29.IBShouldRemoveOnLegacySave</string>
 					<string>3.IBPluginDependency</string>
@@ -2843,7 +2928,7 @@
 					<string>com.apple.InterfaceBuilderKit</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
-					<string>{{312, 366}, {616, 227}}</string>
+					<string>{{472, 263}, {616, 227}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<string>{{132, 614}, {616, 0}}</string>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -2930,6 +3015,17 @@
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<reference ref="9"/>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<object class="NSMutableDictionary">
+						<string key="NS.key.0">ToolTip</string>
+						<object class="IBToolTipAttribute" key="NS.object.0">
+							<string key="name">ToolTip</string>
+							<reference key="object" ref="727118407"/>
+							<string key="toolTip">Create Branch</string>
+						</object>
+					</object>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<reference ref="9"/>
 					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
 					<reference ref="9"/>
@@ -2996,7 +3092,7 @@
 				</object>
 			</object>
 			<nil key="sourceID"/>
-			<int key="maxID">286</int>
+			<int key="maxID">292</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -3040,6 +3136,7 @@
 						<object class="NSMutableArray" key="dict.sortedKeys">
 							<bool key="EncodedWithXMLCoder">YES</bool>
 							<string>openFilesAction:</string>
+							<string>openInTerminal:</string>
 							<string>openSelectedFile:</string>
 							<string>refresh:</string>
 							<string>setDetailedView:</string>
@@ -3060,6 +3157,7 @@
 							<string>id</string>
 							<string>id</string>
 							<string>id</string>
+							<string>id</string>
 						</object>
 					</object>
 					<object class="NSMutableDictionary" key="outlets">
diff --git a/Terminal.h b/Terminal.h
new file mode 100644
index 0000000..8050370
--- /dev/null
+++ b/Terminal.h
@@ -0,0 +1,159 @@
+/*
+ * Terminal.h
+ */
+
+#import <AppKit/AppKit.h>
+#import <ScriptingBridge/ScriptingBridge.h>
+
+
+@class TerminalApplication, TerminalWindow, TerminalSettingsSet, TerminalTab;
+
+typedef enum {
+	TerminalSaveOptionsYes = 'yes ' /* Save the file. */,
+	TerminalSaveOptionsNo = 'no  ' /* Do not save the file. */,
+	TerminalSaveOptionsAsk = 'ask ' /* Ask the user whether or not to save the file. */
+} TerminalSaveOptions;
+
+typedef enum {
+	TerminalPrintingErrorHandlingStandard = 'lwst' /* Standard PostScript error handling */,
+	TerminalPrintingErrorHandlingDetailed = 'lwdt' /* print a detailed report of PostScript errors */
+} TerminalPrintingErrorHandling;
+
+
+
+/*
+ * Standard Suite
+ */
+
+// The application‘s top-level scripting object.
+@interface TerminalApplication : SBApplication
+
+- (SBElementArray *) windows;
+
+@property (copy, readonly) NSString *name;  // The name of the application.
+@property (readonly) BOOL frontmost;  // Is this the frontmost (active) application?
+@property (copy, readonly) NSString *version;  // The version of the application.
+
+- (void) open:(NSArray *)x;  // Open a document.
+- (void) print:(id)x withProperties:(NSDictionary *)withProperties printDialog:(BOOL)printDialog;  // Print a document.
+- (void) quitSaving:(TerminalSaveOptions)saving;  // Quit the application.
+- (TerminalTab *) doScript:(NSString *)x in:(id)in_;  // Runs a UNIX shell script or command.
+
+@end
+
+// A window.
+@interface TerminalWindow : SBObject
+
+- (SBElementArray *) tabs;
+
+@property (copy, readonly) NSString *name;  // The full title of the window.
+- (NSInteger) id;  // The unique identifier of the window.
+@property NSInteger index;  // The index of the window, ordered front to back.
+@property NSRect bounds;  // The bounding rectangle of the window.
+@property (readonly) BOOL closeable;  // Whether the window has a close box.
+@property (readonly) BOOL miniaturizable;  // Whether the window can be minimized.
+@property BOOL miniaturized;  // Whether the window is currently minimized.
+@property (readonly) BOOL resizable;  // Whether the window can be resized.
+@property BOOL visible;  // Whether the window is currently visible.
+@property (readonly) BOOL zoomable;  // Whether the window can be zoomed.
+@property BOOL zoomed;  // Whether the window is currently zoomed.
+@property BOOL frontmost;  // Whether the window is currently the frontmost Terminal window.
+@property NSPoint position;  // The position of the window, relative to the upper left corner of the screen.
+@property NSPoint origin;  // The position of the window, relative to the lower left corner of the screen.
+@property NSPoint size;  // The width and height of the window
+@property NSRect frame;  // The bounding rectangle, relative to the lower left corner of the screen.
+
+- (void) closeSaving:(TerminalSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
+- (void) saveIn:(NSURL *)in_;  // Save a document.
+- (void) printWithProperties:(NSDictionary *)withProperties printDialog:(BOOL)printDialog;  // Print a document.
+- (void) delete;  // Delete an object.
+- (void) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
+- (BOOL) exists;  // Verify if an object exists.
+- (void) moveTo:(SBObject *)to;  // Move object(s) to a new location.
+
+@end
+
+
+
+/*
+ * Terminal Suite
+ */
+
+@interface TerminalApplication (TerminalSuite)
+
+- (SBElementArray *) settingsSets;
+
+@property (copy) TerminalSettingsSet *defaultSettings;  // The settings set used for new windows.
+@property (copy) TerminalSettingsSet *startupSettings;  // The settings set used for the window created on application startup.
+
+@end
+
+// A set of settings.
+@interface TerminalSettingsSet : SBObject
+
+- (NSInteger) id;  // The unique identifier of the settings set.
+@property (copy) NSString *name;  // The name of the settings set.
+@property NSInteger numberOfRows;  // The number of rows displayed in the tab.
+@property NSInteger numberOfColumns;  // The number of columns displayed in the tab.
+@property (copy) NSColor *cursorColor;  // The cursor color for the tab.
+@property (copy) NSColor *backgroundColor;  // The background color for the tab.
+@property (copy) NSColor *normalTextColor;  // The normal text color for the tab.
+@property (copy) NSColor *boldTextColor;  // The bold text color for the tab.
+@property (copy) NSString *fontName;  // The name of the font used to display the tab’s contents.
+@property NSInteger fontSize;  // The size of the font used to display the tab’s contents.
+@property BOOL fontAntialiasing;  // Whether the font used to display the tab’s contents is antialiased.
+@property (copy) NSArray *cleanCommands;  // The processes which will be ignored when checking whether a tab can be closed without showing a prompt.
+@property BOOL titleDisplaysDeviceName;  // Whether the title contains the device name.
+@property BOOL titleDisplaysShellPath;  // Whether the title contains the shell path.
+@property BOOL titleDisplaysWindowSize;  // Whether the title contains the tab’s size, in rows and columns.
+@property BOOL titleDisplaysSettingsName;  // Whether the title contains the settings name.
+@property BOOL titleDisplaysCustomTitle;  // Whether the title contains a custom title.
+@property (copy) NSString *customTitle;  // The tab’s custom title.
+
+- (void) closeSaving:(TerminalSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
+- (void) saveIn:(NSURL *)in_;  // Save a document.
+- (void) printWithProperties:(NSDictionary *)withProperties printDialog:(BOOL)printDialog;  // Print a document.
+- (void) delete;  // Delete an object.
+- (void) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
+- (BOOL) exists;  // Verify if an object exists.
+- (void) moveTo:(SBObject *)to;  // Move object(s) to a new location.
+
+@end
+
+// A tab.
+@interface TerminalTab : SBObject
+
+@property NSInteger numberOfRows;  // The number of rows displayed in the tab.
+@property NSInteger numberOfColumns;  // The number of columns displayed in the tab.
+@property (copy, readonly) NSString *contents;  // The currently visible contents of the tab.
+@property (copy, readonly) NSString *history;  // The contents of the entire scrolling buffer of the tab.
+@property (readonly) BOOL busy;  // Whether the tab is busy running a process.
+@property (copy, readonly) NSArray *processes;  // The processes currently running in the tab.
+@property BOOL selected;  // Whether the tab is selected.
+@property BOOL titleDisplaysCustomTitle;  // Whether the title contains a custom title.
+@property (copy) NSString *customTitle;  // The tab’s custom title.
+@property (copy, readonly) NSString *tty;  // The tab’s TTY device.
+@property (copy) TerminalSettingsSet *currentSettings;  // The set of settings which control the tab’s behavior and appearance.
+@property (copy) NSColor *cursorColor;  // The cursor color for the tab.
+@property (copy) NSColor *backgroundColor;  // The background color for the tab.
+@property (copy) NSColor *normalTextColor;  // The normal text color for the tab.
+@property (copy) NSColor *boldTextColor;  // The bold text color for the tab.
+@property (copy) NSArray *cleanCommands;  // The processes which will be ignored when checking whether a tab can be closed without showing a prompt.
+@property BOOL titleDisplaysDeviceName;  // Whether the title contains the device name.
+@property BOOL titleDisplaysShellPath;  // Whether the title contains the shell path.
+@property BOOL titleDisplaysWindowSize;  // Whether the title contains the tab’s size, in rows and columns.
+@property BOOL titleDisplaysFileName;  // Whether the title contains the file name.
+@property (copy) NSString *fontName;  // The name of the font used to display the tab’s contents.
+@property NSInteger fontSize;  // The size of the font used to display the tab’s contents.
+@property BOOL fontAntialiasing;  // Whether the font used to display the tab’s contents is antialiased.
+
+- (void) closeSaving:(TerminalSaveOptions)saving savingIn:(NSURL *)savingIn;  // Close a document.
+- (void) saveIn:(NSURL *)in_;  // Save a document.
+- (void) printWithProperties:(NSDictionary *)withProperties printDialog:(BOOL)printDialog;  // Print a document.
+- (void) delete;  // Delete an object.
+- (void) duplicateTo:(SBObject *)to withProperties:(NSDictionary *)withProperties;  // Copy object(s) and put the copies at a new location.
+- (BOOL) exists;  // Verify if an object exists.
+- (void) moveTo:(SBObject *)to;  // Move object(s) to a new location.
+
+@end
+
-- 
1.6.4.1

