warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
21.41k stars 375 forks source link

Would be great if Warp as scriptable with AppleScript #3364

Open countfloyd opened 1 year ago

countfloyd commented 1 year ago

Discord username (optional)

No response

Describe the solution you'd like?

If you look at something like iTerm, you can script various things with AppleScript. If you want to open a bunch of tabs or split a window and run a command in each window, AppleScript lets you do this reliably. I can do this with Warp and basic window commands but it is not nearly as reliable.

Is your feature request related to a problem? Please describe.

No response

Additional context

No response

How important is this feature to you?

3

Warp Internal (ignore) - linear-label:770f6576-d6c0-4e4f-a259-fc64b5156087

None

dannyneira commented 1 year ago

hey @countfloyd Thanks for submitting this. We've recently exposed URIs for opening a new window/tab/launch configurations/etc. you can see an example of how it's being used in a Warp + Raycast extension here > Source code

That may help as a stopgap for some of the scripting functionality you're looking for.

Please add a :+1: to the original post at the top to signal that you want this feature, and then hit the subscribe button if you'd like to be notified.

xilopaint commented 1 year ago

@dannyneira where's the URI scheme documented?

lcx-seima commented 1 year ago

found new window schema here, while how can I achieve code executed after launch 🤔

warpdotdev-devx[bot] commented 1 year ago

@xilopaint I've added the URI Scheme to our docs: https://docs.warp.dev/features/uri-scheme There are also plans to add more in the future!

@lcx-seima The best way for now to achieve this would be to use Launch Configurations. You can use them to open new windows and run commands within them. https://docs.warp.dev/features/sessions/launch-configurations#commands

xilopaint commented 1 year ago

@warpdotdev-dx thanks! But AppleScript is still needed to integrate Warp with Alfred. Here you can find an example of the iTerm integration through AppleScript: https://github.com/vitorgalvao/custom-alfred-iterm-scripts.

warpdotdev-devx[bot] commented 1 year ago

@xilopaint there is a Warp + Alfred extension here: https://github.com/joetannenbaum/alfred-workflows/tree/main/warp-launch-configuration

Only works for launch configurations as it hasn't been updated for the other URIs but it may be a starting point for any further extensions you may want to make.

xilopaint commented 1 year ago

@xilopaint there is a Warp + Alfred extension here: https://github.com/joetannenbaum/alfred-workflows/tree/main/warp-launch-configuration

Only works for launch configurations as it hasn't been updated for the other URIs but it may be a starting point for any further extensions you may want to make.

I don't want to make a workflow with Warp, I want to integrate it to Alfred. When a custom terminal is integrated, Alfred workflows will use it instead of macOS Terminal. Here's how iTerm is integrated:

Screenshot 2023-07-28 at 14 20 36

After the custom terminal is integrated, we can also run terminal commands via Alfred panel:

Screenshot 2023-07-28 at 14 25 58

SCR-20230825-mupa

If you create a URI to send text to Warp maybe it would be possible to integrate it to Alfred even without AppleScript support.

warpdotdev-devx[bot] commented 1 year ago

@xilopaint There are plans for some additional URIs (warp://action/replace_terminal_input?contents= and warp://action/docker/open_container?id=), no ETA, but the best workaround for now would be to use a launch configuration as mentioned above since you can run it with Alfred and set up the launch config to run commands. Not exactly what you're looking for, but should help for now I hope.

idoa01 commented 1 year ago

+1 on some sort of way to send a command to a new tab.

iTerm uses applescript for this, multiple linux console support calling the terminal from an executable like so:

konsole --new-tab -e "command"
gnome-terminal --tab -- "command"

I'm guessing that with the URI framework you're adding I'll have to URI escape my input? this complicates things a lot more than necessary.