Skip to content

Conversation

@j-c-m
Copy link
Contributor

@j-c-m j-c-m commented Oct 17, 2025

WIP.

WORKING:
tell application "Ghostty" to create window
tell application "Ghostty" to create tab

tell application "Ghostty" to create window command "btop"
tell application "Ghostty" to create tab command "btop"

tell application "Ghostty" to create window command "btop" with wait
tell application "Ghostty" to create tab command "btop" with wait

use initialInput not command for no wait to override:

if (opts.command) |c_command| {
const cmd = std.mem.sliceTo(c_command, 0);
if (cmd.len > 0) {
config.command = .{ .shell = cmd };
config.@"wait-after-command" = true;
}
}

overrides config.waitForCommand when command is set.

NOT-WORKING:
Added some applicable standard definitions stubs from
/System/Library/ScriptingDefinitions/CocoaStandard.sdef

tried using

@objc func scriptNewWindow(_ command: NSScriptCommand) -> Any? {}

in AppDelegate first and could not get it work, apparently this
unreliable with swift

switched to

class *: NSScriptCommand and it works.
@j-c-m j-c-m changed the title AppleScript macOS: AppleScript Oct 17, 2025
Source:

/System/Library/ScriptingDefinitions/CocoaStandard.sdef

Non-Working.
@j-c-m j-c-m force-pushed the applescript branch 2 times, most recently from 6a1eb6a to 4faf540 Compare October 18, 2025 16:09
add tabs and save options stubs to sdef to silence erorrs.

add command parameter to create window & tab

Still getting with waitAfterCommand = false

Process exited. Press any key to close the terminal.
maybe I should always use initialInput style?

tell application "Ghostty" to create window command "btop"
tell application "Ghostty" to create window command "btop" with wait
@j-c-m
Copy link
Contributor Author

j-c-m commented Oct 18, 2025

// We don't run command as "command" and instead use "initialInput" so
// that we can get all the login scripts to setup things like PATH.
if let command {
config.initialInput = "\(command); exit\n"
}

Not sure if this is correct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant