diff --git a/Cauldron.Macos/AppDelegate.cs b/Cauldron.Macos/AppDelegate.cs
index 42fb347..f88e289 100644
--- a/Cauldron.Macos/AppDelegate.cs
+++ b/Cauldron.Macos/AppDelegate.cs
@@ -27,9 +27,19 @@ public partial class AppDelegate : NSApplicationDelegate
as MainWindow);
}
+ partial void NewTabMenuItemClicked(AppKit.NSMenuItem sender)
+ {
+ (NSApplication.SharedApplication.KeyWindow.WindowController
+ as MainWindow)
+ .CreateNewTab();
+ }
+
[Action("validateMenuItem:")]
public bool ValidateMenuItem(AppKit.NSMenuItem sender)
{
- return true;
+ if (sender.Title is "Run Script" or "New Tab")
+ return NSApplication.SharedApplication.KeyWindow != null;
+
+ return false;
}
}
diff --git a/Cauldron.Macos/AppDelegate.designer.cs b/Cauldron.Macos/AppDelegate.designer.cs
index c7f493b..3d3ef68 100644
--- a/Cauldron.Macos/AppDelegate.designer.cs
+++ b/Cauldron.Macos/AppDelegate.designer.cs
@@ -11,6 +11,9 @@ namespace Cauldron.Macos
{
partial class AppDelegate
{
+ [Action ("NewTabMenuItemClicked:")]
+ partial void NewTabMenuItemClicked (AppKit.NSMenuItem sender);
+
[Action ("RunScriptMenuItemClicked:")]
partial void RunScriptMenuItemClicked (AppKit.NSMenuItem sender);
diff --git a/Cauldron.Macos/Main.storyboard b/Cauldron.Macos/Main.storyboard
index c11b99e..1e5f87d 100644
--- a/Cauldron.Macos/Main.storyboard
+++ b/Cauldron.Macos/Main.storyboard
@@ -65,6 +65,11 @@
+