-
Notifications
You must be signed in to change notification settings - Fork 5k
Warp CLI + General Scriptability + Open Warp with a directory URL #612
-
Describe the solution you'd like?
Currently we are using iTerm with a custom script to launch a Java environment from within IntelliJ: #!/bin/bash TEMP="${HOME}/EC-Projects/misc/bin/jlineExec.sh" if [ 1ドル = "-version" ]; then echo "" > ${TEMP} else export JAVA_CMD="${JAVA_HOME}/bin/java $@" export FIRST="${JAVA_CMD/javaagent:/javaagent:\"}" export ALMOST="${FIRST/agent.jar -Dfile/agent.jar\" -Dfile}" echo "#!/bin/bash" > ${TEMP} echo "${ALMOST/bin -Dfile/bin\" -Dfile}" >> ${TEMP} echo ${TEMP} open -a iTerm.app ${TEMP} fi
Having support to use Warp instead of iTerm in this script would be awesome.
### Is your feature request related to a problem? Please describe.
_No response_
### Additional context
_No response_
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 28
Replies: 33 comments 15 replies
-
From discord:
"Thanks! Another question, is it possible to change your current/default theme programmatically? I like to have a single script to setup my machines"
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Hi, Is there any way to open a new warp tab by setting the custom zshrc file ? I am trying to set my shortcut in the zshrc file, and the goal is to open mutiple tab in Warp and run the specfic command for each tab
Beta Was this translation helpful? Give feedback.
All reactions
-
I've done this in an applescript.
Here's an example:
sudo osascript -e 'tell application "Warp" to activate'
sudo osascript -e 'tell application "System Events" to tell process "Warp" to keystroke "t" using command down'
sleep 1
sudo osascript -e 'tell application "System Events"
tell process "Warp"
keystroke "your script.sh"
key code 36
end tell
end tell
'
So here's what it does.
- Activate Warp - bring to front
- Send cmd-t to Warp to open a new tab
- Sleep 1 second (the rest didn't work without this)
- Type in "your script.sh"
- Send key code 36 (Enter)
So this opens a new tab, types in your script name and presses Enter 👍 I have it in one script, and another script calls it and opens 5 remote server tabs in Warp for me. Very convenient!
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 3
-
@flaxton thank you for this! I translated it so that Alfred can utilize Warp as the default terminal: https://gist.github.com/parterburn/e832b9090ee35eb830529de8bd978b82
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
-
Is there any way to open Warp in a particular directory from a shell script? Looking for similar behaviour to vscode: code ./some/directory
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 4
-
I came from using Iterm2, and in the settings I was able to set a file to be source on launch ( ~/.bash_profile).
Is there a way to do this in warp?
Beta Was this translation helpful? Give feedback.
All reactions
-
From @ianwalter via:
Describe the solution you'd like?
I just used iTerm2's Python API to create a python script in my monorepo that creates a bunch of tabs to run different services (e.g. docker compose, API server, Next.js dev server, iOS simulator, etc). It's great because I can easily start my whole dev environment with one command and have a meaningful tab name set for each tab. I would have preferred to use Node.js instead of Python, but not a big deal. Really liking Warp so far but this is what I am still using iTerm2 for.
Is your feature request related to a problem? Please describe.
No response
Additional context
Here's an example of a tab I create in the script:
# Create a new tab and run the Docker Compose services. tab = await window.async_create_tab() await tab.async_set_title('Docker') command = f'cd {root}/packages/web; yarn docker\n' await tab.current_session.async_send_text(command)
Beta Was this translation helpful? Give feedback.
All reactions
-
From @kieran-osgood via:
Describe the solution you'd like?
Possibly related to #102 but in the default mac terminal and iTerm you can use a command like: open -a terminal ./path/to/directory and it will open the terminal window/tab at that directory - (which I use frequently in combination with Launchbar (https://www.obdev.at/resources/launchbar/help/index.php?chapter=OtherFeatures#:~:text=Select%20a%20folder%20in%20LaunchBar,pressing%20Tab%20and%20selecting%20Terminal.)
Is your feature request related to a problem? Please describe.
Currently running open -a Warp ./path/to/directory just opens Warp at my home directory instead of the specified one
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions
-
Make it super easy to do a "open Warp to this directory" and 90% of our scriptability needs will be met.
Heck supporting a "warp:///newterminal/path=~/Downloads" URL scheme would be the easiest by far.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thanks! Another question, is it possible to change your current/default theme programmatically? I like to have a single script to setup my machines
Beta Was this translation helpful? Give feedback.
All reactions
-
I wanted to configure warp as an external tool to be launched from my IDE. It would be very convenient if I could pass my project's directory (which is available in tool launch config) to warp so it would start from that directory.
Beta Was this translation helpful? Give feedback.
All reactions
-
From Tominabox vi Discord: https://discord.com/channels/851854972600451112/906269689116770304/929810244157194371
hey all, after a bit of messing around it would be pretty neat to be able to have ways to open warp with specific splits and applications running in each one. E.g. when opening project X, a docker container runs up in the left hand split and a node server runs on the right hand. I suppose it's a bit similar to customizable tasks like mentioned above
Beta Was this translation helpful? Give feedback.
All reactions
-
Was looking for a way to send a command to Warp from AppleScript or from another bash. Something like the following that I use for iTerm:
if application "iTerm" is running then
tell application "iTerm"
set newWindow to (create window with default profile)
tell newWindow
tell current tab
tell current session
write text "ls"
end tell
end tell
end tell
end tell
else
tell application "iTerm"
tell current window
tell current tab
tell current session
write text "ls"
end tell
end tell
end tell
end tell
end if
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 4
-
Similarly, it'd be great if there was a Warp version of this to be used with Alfred App: https://github.com/vitorgalvao/custom-alfred-iterm-scripts/blob/master/custom_iterm_script.applescript
Beta Was this translation helpful? Give feedback.
All reactions
-
Update, solved this: https://gist.github.com/parterburn/e832b9090ee35eb830529de8bd978b82
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 6
-
From @solvip via
- Custom Prompt (PS1, Starship, Powerlevel10k) #422
- Custom Prompt (PS1, Starship, Powerlevel10k) #422 (comment)
Is there a way to programmatically(i.e., from a shell script) check if the "Honor user's custom prompt (PS1) setting" is set or not?
The use case is tooling for ops; we wanna make sure that if you are operating prod, you'll see it in your prompt.
Beta Was this translation helpful? Give feedback.
All reactions
-
The ability to run Warp with a startup directory argument (or pass it to a running instance) would be very valuable for such use cases as running terminal from some other software like file managers and IDEs. I'd be happy to see this supported.
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 5
-
I'm trying to login after proxied by export xxx_proxy='', after running /Applications/Warp.app/Contents/MacOS/stable I got this:
objc[8383]: Class SentryLevelMapper is implemented in both /Applications/Warp.app/Contents/Frameworks/Sentry.framework/Versions/A/Sentry (0x10b649e58) and /Applications/Warp.app/Contents/MacOS/stable (0x10a60a7f8). One of the two will be used. Which one is undefined.
initializing crash reporting Some("stable_release") with tag "v0.2022年04月01日.01.37.stable_03"
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Builder, source: "unknown proxy scheme" }', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/sentry-0.23.0/src/transports/reqwest.rs:36:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Beta Was this translation helpful? Give feedback.
All reactions
-
It seems like Warp has added exactly what I was looking for with "Launch Configurations" as described in the docs: https://docs.warp.dev/features/session-management/launch-configurations
But I don't actually see this feature in the latest version. Is this in beta or something?
Beta Was this translation helpful? Give feedback.
All reactions
-
The documentation was released kinda early.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
This command works for me: open -a Warp.app ~/Documents
Beta Was this translation helpful? Give feedback.
All reactions
-
It only works in terminal such as by open -a Warp.app .
But it still gives an error if we try to use the Foundation API of NSWorkspace in ObjectiveC or Swift.
do { let application = try await NSWorkspace.shared.open(urls, withApplicationAt: url, configuration: config) } catch { // Error handling }
I have a Finder-Sync extension app (Open Sourced at https://github.com/Kyle-Ye/MenuHelper) and will use such API to try to open with Warp.
Other standard apps which is able to open url are all OK with such API call. (Git Tower/Xcode/VS Code/Terminal/IntelliJ IDEA etc.)
Beta Was this translation helpful? Give feedback.
All reactions
-
Didn't know this already worked !!! Thank you so much for sharing
Beta Was this translation helpful? Give feedback.
All reactions
-
From the NSWorkspace header it looks like this could be the issue when trying to open from Cocoa: The path to the application instance is always automatically inserted as the first argument.
In that case only the Warp developers can fix things for us.
/* Command-line arguments to pass to a new application instance. Defaults to @[].
Only applies when a new application instance is created.
The path to the application instance is always automatically inserted as the first argument.
If the calling process is sandboxed, the value of this property is ignored. */
@property (copy) NSArray<NSString *> *arguments;
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 3
-
From @sd-godaddy on #2215
launch Warp from any other terminal:
open /Applications/Warp.app --args /Users/mysusername/Workspace/PEX_dev/myprojectname
It opens warp but clearly passing arg /Users/mysusername/Workspace/PEX_dev/myprojectname
is not making Warp to open in this location.
Probably Warp is not accepting arguments at all.
Beta Was this translation helpful? Give feedback.
All reactions
-
A huge use case in my workflows is having scripts launch iTerm windows with profiles set with single TUI application running, with the window automatically closing afterwards:
#!/usr/bin/python3
import iterm2
import AppKit
import sys
bundle = "com.googlecode.iterm2"
if not AppKit.NSRunningApplication.runningApplicationsWithBundleIdentifier_(bundle):
AppKit.NSWorkspace.sharedWorkspace().launchApplication_("iTerm")
async def main(connection):
app = await iterm2.async_get_app(connection)
if len(sys.argv) > 2:
window = await iterm2.Window.async_create(connection, profile = str(sys.argv[1]), command = str(sys.argv[2]))
else:
window = await iterm2.Window.async_create(connection, profile = str(sys.argv[1]))
await window.async_activate()
apps = AppKit.NSRunningApplication.runningApplicationsWithBundleIdentifier_(bundle)
apps[0].activateWithOptions_(AppKit.NSApplicationActivateIgnoringOtherApps)
iterm2.run_until_complete(main)
It's painfully slow, though, and I would love to have a more responsive application start things up. This does require a "start with profile x running" feature from the CLI interface.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hey Folks, Warp has released a public URI Scheme which has been used to create a Raycast extension to open folders with Warp (among other things). Learn more about it here: https://docs.warp.dev/features/uri-scheme
We'll update that document as new features are added.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hello, I tried the Raycast extension, but there are some problems. How can I execute dynamic cmd in a new window?
The launch Config method requires a fixed yaml file, but I can't dynamically create yaml in the raycast script and then execute it. This is too inelegant and will create some useless yaml.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
The URI Schema doesn't allow passing a command to Warp and therefore doesn't solve the problem :-/
Beta Was this translation helpful? Give feedback.
All reactions
-
Will ssh:// support be added to the uri-schemes as well? It's something i used to use a lot with other terminal applications and have to use a workaround for with Warp
Beta Was this translation helpful? Give feedback.
All reactions
-
Here's how an AppleScript for Raycast can look like:
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Warp
# @raycast.mode silent
# Optional parameters:
# @raycast.argument1 { "type": "text", "placeholder": "Command" }
# Documentation:
# @raycast.author electerious
# @raycast.authorURL https://raycast.com/electerious
on run argv
tell application "Warp" to activate
tell application "System Events" to tell process "Warp" to keystroke "t" using command down
tell application "System Events"
tell process "Warp"
keystroke "" & ( item 1 of argv )
key code 36
end tell
end tell
end run
Thanks to @flaxton for the inspiration. It's not perfect, but better than nothing.
Beta Was this translation helpful? Give feedback.
All reactions
-
Would something along these lines be able to be used to open a file in Neovim in Warp?
Beta Was this translation helpful? Give feedback.
All reactions
-
@electerious In my testing only key code 36 or 'keystroke return' not working on Air M1. Any idea ?
Beta Was this translation helpful? Give feedback.
All reactions
-
For Linux users (Specifically arch based distros) using warp-terminal I made this quick script and put it in my .config/warp-terminal directory. Works well for me.
#!/bin/bash # Make sure to run the following # sudo chmod +x $HOME/.config/warp-terminal/warp.sh # sudo ln -s $HOME/.config/warp-terminal/warp.sh /usr/bin/warp usage() { echo "Usage: 0ドル <path_to_folder>" echo " 0ドル [-r | --reuse] <path_to_folder>" exit 1 } if [[ $# -eq 0 ]]; then warp-terminal # Opens warp normally fi # https://docs.warp.dev/features/uri-scheme if [[ "1ドル" == "-r" || "1ドル" == "--reuse" ]]; then if [[ $# -ne 2 ]]; then usage fi path="2ドル" xdg-open "warp://action/new_window?path=$path" else path="1ドル" xdg-open "warp://action/new_tab?path=$path" fi
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 5
-
Here is little modification to @artrixdotdev script for Linux and VS Code users. In terminal.external.linuxExec you cannot add parameters. So to make VS Code "Open new external terminal" works as expected - opening terminal in project location - do following:
- Use modified script below and store into new file in
.config/warp-terminal - Run
sudo chmod +x $HOME/.config/warp-terminal/warp.sh - Run
ln -s $HOME/.config/warp-terminal/warp.sh /usr/bin/warp - Set
"terminal.external.linuxExec": "warp"in VS Code settings - 🎉
#!/bin/bash # Make sure to run the following # sudo chmod +x $HOME/.config/warp-terminal/warp.sh # sudo ln -s $HOME/.config/warp-terminal/warp.sh /usr/bin/warp usage() { echo "Usage: 0ドル" echo "Usage: 0ドル <path_to_folder>" echo " 0ドル [-r | --reuse] <path_to_folder>" exit 1 } if [[ $# -eq 0 ]]; then WD="$(pwd)" if [[ "$WD" != "" ]]; then xdg-open "warp://action/new_tab?path=${WD}" else warp-terminal # Opens warp normally fi exit 0 fi # https://docs.warp.dev/features/uri-scheme if [[ "1ドル" == "-r" || "1ドル" == "--reuse" ]]; then if [[ $# -ne 2 ]]; then usage fi path="2ドル" xdg-open "warp://action/new_window?path=$path" else path="1ドル" xdg-open "warp://action/new_tab?path=$path" fi
Beta Was this translation helpful? Give feedback.
All reactions
-
On MacOS to open warp via a command line which I added to my .zshrc
### Function to open a new Warp terminal tab at the specified path #### Usage: warp [path] - Opens a new Warp tab at the given path or current directory if no path is provided warp() { local target_path="${1:-.}" open "warp://action/new_tab?path=$(cd "$target_path" && pwd)" }
Beta Was this translation helpful? Give feedback.
All reactions
-
🚀 1
-
Warp Preview now has a cli.
Beta Was this translation helpful? Give feedback.
All reactions
-
Great! Is there any way to have split pane similar to Wezterm or good old tmux?
Beta Was this translation helpful? Give feedback.
All reactions
-
You can use the command palette
Screenshot 2026年01月15日-11-07-05@2x
or the keybindings
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
Maybe programmatically somehow?
Beta Was this translation helpful? Give feedback.
All reactions
-
Hi, just following up on this issue, being able to open panes and splits via bash or AppleScript would greatly improve my Claude Code experience, as I could have it show me text or image files!
Beta Was this translation helpful? Give feedback.
All reactions
-
just wanted to add aside from the agent it would be nice to change user settings from the cli as well
Beta Was this translation helpful? Give feedback.