Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct Commands For All Windows, Fix ⌘W #1587

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 26 additions & 23 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@
587B60F82934124200D5CD8F /* CEWorkspaceFileManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587B60F72934124100D5CD8F /* CEWorkspaceFileManagerTests.swift */; };
587B61012934170A00D5CD8F /* UnitTests_Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587B61002934170A00D5CD8F /* UnitTests_Extensions.swift */; };
587B612E293419B700D5CD8F /* CodeFileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587B612D293419B700D5CD8F /* CodeFileTests.swift */; };
587B9D57292FC27A00AC7927 /* FolderMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587B9D54292FC27A00AC7927 /* FolderMonitor.swift */; };
587B9D9F29300ABD00AC7927 /* SegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587B9D8829300ABD00AC7927 /* SegmentedControl.swift */; };
587B9DA029300ABD00AC7927 /* PanelDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587B9D8929300ABD00AC7927 /* PanelDivider.swift */; };
587B9DA229300ABD00AC7927 /* EffectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587B9D8B29300ABD00AC7927 /* EffectView.swift */; };
Expand Down Expand Up @@ -232,7 +231,6 @@
58D01C9D293167DC00C5B6B4 /* KeychainSwiftAccessOptions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58D01C93293167DC00C5B6B4 /* KeychainSwiftAccessOptions.swift */; };
58F2EAEC292FB2B0004A9BDE /* IgnoredFiles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58F2EAAA292FB2B0004A9BDE /* IgnoredFiles.swift */; };
58F2EAEF292FB2B0004A9BDE /* ThemeSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58F2EAAF292FB2B0004A9BDE /* ThemeSettingsView.swift */; };
58F2EB02292FB2B0004A9BDE /* Loopable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58F2EACD292FB2B0004A9BDE /* Loopable.swift */; };
58F2EB03292FB2B0004A9BDE /* Documentation.docc in Sources */ = {isa = PBXBuildFile; fileRef = 58F2EACE292FB2B0004A9BDE /* Documentation.docc */; };
58F2EB04292FB2B0004A9BDE /* SourceControlSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58F2EAD1292FB2B0004A9BDE /* SourceControlSettings.swift */; };
58F2EB05292FB2B0004A9BDE /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 58F2EAD2292FB2B0004A9BDE /* Settings.swift */; };
Expand Down Expand Up @@ -354,18 +352,20 @@
6CAAF69429BCD78600A1F48A /* (null) in Sources */ = {isa = PBXBuildFile; };
6CABB19E29C5591D00340467 /* NSTableViewWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CABB19C29C5591D00340467 /* NSTableViewWrapper.swift */; };
6CABB1A129C5593800340467 /* OverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CABB1A029C5593800340467 /* OverlayView.swift */; };
6CB446402B6DFF3A00539ED0 /* CodeEditSourceEditor in Frameworks */ = {isa = PBXBuildFile; productRef = 6CB4463F2B6DFF3A00539ED0 /* CodeEditSourceEditor */; };
6CB52DC92AC8DC3E002E75B3 /* CEWorkspaceFileManager+FileManagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CB52DC82AC8DC3E002E75B3 /* CEWorkspaceFileManager+FileManagement.swift */; };
6CB9144B29BEC7F100BC47F2 /* (null) in Sources */ = {isa = PBXBuildFile; };
6CBA0D512A1BF524002C6FAA /* SegmentedControlImproved.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CBA0D502A1BF524002C6FAA /* SegmentedControlImproved.swift */; };
6CBD1BC62978DE53006639D5 /* Font+Caption3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CBD1BC52978DE53006639D5 /* Font+Caption3.swift */; };
6CBE1CFB2B71DAA6003AC32E /* Loopable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CBE1CFA2B71DAA6003AC32E /* Loopable.swift */; };
6CBE1D002B720565003AC32E /* CodeEditSourceEditor in Frameworks */ = {isa = PBXBuildFile; productRef = 6CBE1CFF2B720565003AC32E /* CodeEditSourceEditor */; };
6CC9E4B229B5669900C97388 /* Environment+ActiveEditor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CC9E4B129B5669900C97388 /* Environment+ActiveEditor.swift */; };
6CD03B6A29FC773F001BD1D0 /* SettingsInjector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CD03B6929FC773F001BD1D0 /* SettingsInjector.swift */; };
6CDA84AD284C1BA000C1CC3A /* EditorTabBarContextMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CDA84AC284C1BA000C1CC3A /* EditorTabBarContextMenu.swift */; };
6CDEFC9629E22C2700B7C684 /* Introspect in Frameworks */ = {isa = PBXBuildFile; productRef = 6CDEFC9529E22C2700B7C684 /* Introspect */; };
6CE622692A2A174A0013085C /* InspectorTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE622682A2A174A0013085C /* InspectorTab.swift */; };
6CE6226B2A2A1C730013085C /* UtilityAreaTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE6226A2A2A1C730013085C /* UtilityAreaTab.swift */; };
6CE6226E2A2A1CDE0013085C /* NavigatorTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CE6226D2A2A1CDE0013085C /* NavigatorTab.swift */; };
6CE952E32B29433500C29C31 /* CodeEditSourceEditor in Frameworks */ = {isa = PBXBuildFile; productRef = 6CE952E22B29433500C29C31 /* CodeEditSourceEditor */; };
6CED16E42A3E660D000EC962 /* String+Lines.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CED16E32A3E660D000EC962 /* String+Lines.swift */; };
6CFF967429BEBCC300182D6F /* FindCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967329BEBCC300182D6F /* FindCommands.swift */; };
6CFF967629BEBCD900182D6F /* FileCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967529BEBCD900182D6F /* FileCommands.swift */; };
Expand Down Expand Up @@ -681,7 +681,6 @@
587B60F72934124100D5CD8F /* CEWorkspaceFileManagerTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CEWorkspaceFileManagerTests.swift; sourceTree = "<group>"; };
587B61002934170A00D5CD8F /* UnitTests_Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnitTests_Extensions.swift; sourceTree = "<group>"; };
587B612D293419B700D5CD8F /* CodeFileTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeFileTests.swift; sourceTree = "<group>"; };
587B9D54292FC27A00AC7927 /* FolderMonitor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FolderMonitor.swift; sourceTree = "<group>"; };
587B9D8829300ABD00AC7927 /* SegmentedControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SegmentedControl.swift; sourceTree = "<group>"; };
587B9D8929300ABD00AC7927 /* PanelDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PanelDivider.swift; sourceTree = "<group>"; };
587B9D8B29300ABD00AC7927 /* EffectView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EffectView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -794,7 +793,6 @@
58D01C93293167DC00C5B6B4 /* KeychainSwiftAccessOptions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeychainSwiftAccessOptions.swift; sourceTree = "<group>"; };
58F2EAAA292FB2B0004A9BDE /* IgnoredFiles.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IgnoredFiles.swift; sourceTree = "<group>"; };
58F2EAAF292FB2B0004A9BDE /* ThemeSettingsView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThemeSettingsView.swift; sourceTree = "<group>"; };
58F2EACD292FB2B0004A9BDE /* Loopable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Loopable.swift; sourceTree = "<group>"; };
58F2EACE292FB2B0004A9BDE /* Documentation.docc */ = {isa = PBXFileReference; lastKnownFileType = folder.documentationcatalog; path = Documentation.docc; sourceTree = "<group>"; };
58F2EAD1292FB2B0004A9BDE /* SourceControlSettings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SourceControlSettings.swift; sourceTree = "<group>"; };
58F2EAD2292FB2B0004A9BDE /* Settings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -904,6 +902,7 @@
6CB52DC82AC8DC3E002E75B3 /* CEWorkspaceFileManager+FileManagement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CEWorkspaceFileManager+FileManagement.swift"; sourceTree = "<group>"; };
6CBA0D502A1BF524002C6FAA /* SegmentedControlImproved.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentedControlImproved.swift; sourceTree = "<group>"; };
6CBD1BC52978DE53006639D5 /* Font+Caption3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Font+Caption3.swift"; sourceTree = "<group>"; };
6CBE1CFA2B71DAA6003AC32E /* Loopable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Loopable.swift; sourceTree = "<group>"; };
6CC9E4B129B5669900C97388 /* Environment+ActiveEditor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Environment+ActiveEditor.swift"; sourceTree = "<group>"; };
6CD03B6929FC773F001BD1D0 /* SettingsInjector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsInjector.swift; sourceTree = "<group>"; };
6CDA84AC284C1BA000C1CC3A /* EditorTabBarContextMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorTabBarContextMenu.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1070,9 +1069,10 @@
6C66C31329D05CDC00DE9ED2 /* GRDB in Frameworks */,
58F2EB1E292FB954004A9BDE /* Sparkle in Frameworks */,
6C2149412A1BB9AB00748382 /* LogStream in Frameworks */,
6CBE1D002B720565003AC32E /* CodeEditSourceEditor in Frameworks */,
6C147C4529A329350089B630 /* OrderedCollections in Frameworks */,
6C6BD6F429CD142C00235D17 /* CollectionConcurrencyKit in Frameworks */,
6CE952E32B29433500C29C31 /* CodeEditSourceEditor in Frameworks */,
6CB446402B6DFF3A00539ED0 /* CodeEditSourceEditor in Frameworks */,
5879828A292ED15F0085B254 /* SwiftTerm in Frameworks */,
6CDEFC9629E22C2700B7C684 /* Introspect in Frameworks */,
2816F594280CF50500DD548B /* CodeEditSymbols in Frameworks */,
Expand Down Expand Up @@ -1463,7 +1463,7 @@
5831E3C92933E83400D5A6D2 /* Protocols */ = {
isa = PBXGroup;
children = (
58F2EACD292FB2B0004A9BDE /* Loopable.swift */,
6CBE1CFA2B71DAA6003AC32E /* Loopable.swift */,
852C7E322A587279006BA599 /* SearchableSettingsPage.swift */,
);
path = Protocols;
Expand Down Expand Up @@ -2188,7 +2188,6 @@
5831E3C92933E83400D5A6D2 /* Protocols */,
5875680E29316BDC00C965A3 /* ShellClient */,
6C5C891A2A3F736500A94FE1 /* FocusedValues.swift */,
587B9D54292FC27A00AC7927 /* FolderMonitor.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -3032,7 +3031,8 @@
6CDEFC9529E22C2700B7C684 /* Introspect */,
6C0F3A3B2A1D0D5000223D19 /* CodeEditKit */,
6C5BE5212A3D5666002DA0FC /* WindowManagement */,
6CE952E22B29433500C29C31 /* CodeEditSourceEditor */,
6CB4463F2B6DFF3A00539ED0 /* CodeEditSourceEditor */,
6CBE1CFF2B720565003AC32E /* CodeEditSourceEditor */,
);
productName = CodeEdit;
productReference = B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */;
Expand Down Expand Up @@ -3128,7 +3128,7 @@
6CDEFC9429E22C2700B7C684 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */,
6C0F3A3A2A1D0D5000223D19 /* XCRemoteSwiftPackageReference "CodeEditKit" */,
6C5BE5202A3D5666002DA0FC /* XCRemoteSwiftPackageReference "SwiftUI-WindowManagement" */,
6CE952E12B29433500C29C31 /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */,
6CBE1CFE2B720565003AC32E /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */,
);
productRefGroup = B658FB2D27DA9E0F00EA4DBD /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -3386,6 +3386,7 @@
58822528292C280D00E83CDE /* StatusBarEncodingSelector.swift in Sources */,
6C7F37FE2A3EA6FA00217B83 /* View+focusedValue.swift in Sources */,
B6C4F2A12B3CA37500B2B140 /* SourceControlNavigatorHistoryView.swift in Sources */,
6CBE1CFB2B71DAA6003AC32E /* Loopable.swift in Sources */,
B6C6A43029771F7100A3D28F /* EditorTabBackground.swift in Sources */,
B60718372B170638009CDAB4 /* SourceControlNavigatorRenameBranchView.swift in Sources */,
6C578D8129CD294800DC73B2 /* ExtensionActivatorView.swift in Sources */,
Expand All @@ -3395,7 +3396,6 @@
9D36E1BF2B5E7D7500443C41 /* GitBranchesGroup.swift in Sources */,
587B9E8229301D8F00AC7927 /* GitHubPreviewHeader.swift in Sources */,
611191FC2B08CCB800D4459B /* SearchIndexer+AsyncController.swift in Sources */,
58F2EB02292FB2B0004A9BDE /* Loopable.swift in Sources */,
6C578D8929CD36E400DC73B2 /* Commands+ForEach.swift in Sources */,
611192082B08CCFD00D4459B /* SearchIndexer+Terms.swift in Sources */,
28B8F884280FFE4600596236 /* NSTableView+Background.swift in Sources */,
Expand Down Expand Up @@ -3429,7 +3429,6 @@
6C2C155A29B4F4CC00EA60A5 /* Variadic.swift in Sources */,
B6E41C8F29DE9CD80088F9F4 /* AccountsSettingsDetailsView.swift in Sources */,
5882252B292C280D00E83CDE /* StatusBarCursorLocationLabel.swift in Sources */,
587B9D57292FC27A00AC7927 /* FolderMonitor.swift in Sources */,
58798252292E78D80085B254 /* ImageFileView.swift in Sources */,
5882252D292C280D00E83CDE /* StatusBarSplitTerminalButton.swift in Sources */,
58798238292E30B90085B254 /* FeedbackWindowController.swift in Sources */,
Expand Down Expand Up @@ -4665,20 +4664,20 @@
minimumVersion = 0.2.0;
};
};
6CDEFC9429E22C2700B7C684 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
6CBE1CFE2B720565003AC32E /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/siteline/SwiftUI-Introspect";
repositoryURL = "https://github.com/CodeEditApp/CodeEditSourceEditor";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.2.3;
minimumVersion = 0.7.0;
};
};
6CE952E12B29433500C29C31 /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */ = {
6CDEFC9429E22C2700B7C684 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/CodeEditSourceEditor.git";
repositoryURL = "https://github.com/siteline/SwiftUI-Introspect";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.7.0;
minimumVersion = 0.2.3;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down Expand Up @@ -4748,16 +4747,20 @@
package = 6C147C4329A329350089B630 /* XCRemoteSwiftPackageReference "swift-collections" */;
productName = DequeModule;
};
6CDEFC9529E22C2700B7C684 /* Introspect */ = {
6CB4463F2B6DFF3A00539ED0 /* CodeEditSourceEditor */ = {
isa = XCSwiftPackageProductDependency;
package = 6CDEFC9429E22C2700B7C684 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */;
productName = Introspect;
productName = CodeEditSourceEditor;
};
6CE952E22B29433500C29C31 /* CodeEditSourceEditor */ = {
6CBE1CFF2B720565003AC32E /* CodeEditSourceEditor */ = {
isa = XCSwiftPackageProductDependency;
package = 6CE952E12B29433500C29C31 /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */;
package = 6CBE1CFE2B720565003AC32E /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */;
productName = CodeEditSourceEditor;
};
6CDEFC9529E22C2700B7C684 /* Introspect */ = {
isa = XCSwiftPackageProductDependency;
package = 6CDEFC9429E22C2700B7C684 /* XCRemoteSwiftPackageReference "SwiftUI-Introspect" */;
productName = Introspect;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = B658FB2427DA9E0F00EA4DBD /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
"identity" : "codeeditsourceeditor",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditSourceEditor.git",
"location" : "https://github.com/CodeEditApp/CodeEditSourceEditor",
"state" : {
"revision" : "e08a43ea07861e42d42f317899df69bf8f0a0a54",
"version" : "0.7.0"
Expand Down Expand Up @@ -140,8 +140,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/mattmassicotte/MainOffender",
"state" : {
"revision" : "343cc3797618c29b48b037b4e2beea0664e75315",
"version" : "0.1.0"
"revision" : "8de872d9256ff7f9913cbc5dd560568ab164be45",
"version" : "0.2.1"
}
},
{
Expand All @@ -167,8 +167,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ChimeHQ/Rearrange",
"state" : {
"revision" : "0fb658e721c68495f6340c211cc6d4719e6b52d8",
"version" : "1.6.0"
"revision" : "5ff7f3363f7a08f77e0d761e38e6add31c2136e1",
"version" : "1.8.1"
}
},
{
Expand Down Expand Up @@ -203,8 +203,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
"revision" : "43c802fb7f96e090dde015344a94b5e85779eff1",
"version" : "509.1.0"
}
},
{
Expand Down
2 changes: 0 additions & 2 deletions CodeEdit/CodeEditApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ struct CodeEditApp: App {
var body: some Scene {
Group {
WelcomeWindow()
.keyboardShortcut("1", modifiers: [.command, .shift])

ExtensionManagerWindow()
.keyboardShortcut("2", modifiers: [.command, .shift])

AboutWindow()

Expand Down
2 changes: 2 additions & 0 deletions CodeEdit/Features/Documents/WorkspaceDocument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ final class WorkspaceDocument: NSDocument, ObservableObject, NSToolbarDelegate {

private func initWorkspaceState(_ url: URL) throws {
self.fileURL = url
self.displayName = url.lastPathComponent
thecoolwinter marked this conversation as resolved.
Show resolved Hide resolved

let sourceControlManager = SourceControlManager(
workspaceURL: url,
editorManager: editorManager
Expand Down
1 change: 0 additions & 1 deletion CodeEdit/Features/WindowCommands/CodeEditCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import SwiftUI

struct CodeEditCommands: Commands {

var body: some Commands {
MainCommands()
FileCommands()
Expand Down
21 changes: 17 additions & 4 deletions CodeEdit/Features/WindowCommands/FileCommands.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,24 @@ struct FileCommands: Commands {

CommandGroup(replacing: .saveItem) {
Button("Close Tab") {
NSApp.sendAction(#selector(CodeEditWindowController.closeCurrentTab(_:)), to: nil, from: nil)
if NSApp.target(forAction: #selector(CodeEditWindowController.closeCurrentTab(_:))) != nil {
NSApp.sendAction(#selector(CodeEditWindowController.closeCurrentTab(_:)), to: nil, from: nil)
} else {
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
}
}
.keyboardShortcut("w")

Button("Close Editor") {
NSApp.sendAction(#selector(CodeEditWindowController.closeActiveEditor(_:)), to: nil, from: nil)
if NSApp.target(forAction: #selector(CodeEditWindowController.closeActiveEditor(_:))) != nil {
NSApp.sendAction(
#selector(CodeEditWindowController.closeActiveEditor(_:)),
to: nil,
from: nil
)
} else {
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
}
}
.keyboardShortcut("w", modifiers: [.control, .shift, .command])

Expand All @@ -52,10 +64,11 @@ struct FileCommands: Commands {
.keyboardShortcut("w", modifiers: [.shift, .command])

Button("Close Workspace") {
// TODO: Determine how this is different than the "Close Window" command and adjust accordingly
NSApp.sendAction(#selector(NSWindow.close), to: nil, from: nil)
guard let keyWindow = NSApplication.shared.keyWindow else { return }
NSApp.sendAction(#selector(NSWindow.close), to: keyWindow, from: nil)
}
.keyboardShortcut("w", modifiers: [.control, .option, .command])
.disabled(!(NSApplication.shared.keyWindow?.windowController is CodeEditWindowController))

if let utilityAreaViewModel {
Button("Close Terminal") {
Expand Down
Loading
Loading