@@ -170,19 +170,45 @@ pub fn open_in_terminal(terminal_id: String, path: String) -> Result<()> {
170170
171171 #[ cfg( target_os = "macos" ) ]
172172 {
173- let app_name = match terminal_id. as_str ( ) {
174- "terminal" => "Terminal" ,
175- "iterm2" => "iTerm" ,
176- "ghostty" => "Ghostty" ,
177- "warp" => "Warp" ,
178- "alacritty-mac" => "Alacritty" ,
179- "wezterm-mac" => "WezTerm" ,
180- "hyper" => "Hyper" ,
173+ match terminal_id. as_str ( ) {
174+ // These terminals support `open -a <app> <path>` as folder handlers
175+ "terminal" => {
176+ let mut cmd = Command :: new ( "open" ) ;
177+ cmd. arg ( "-a" ) . arg ( "Terminal" ) . arg ( & path) ;
178+ run_terminal_command ( cmd, "Terminal" , & path) ?;
179+ }
180+ "iterm2" => {
181+ let mut cmd = Command :: new ( "open" ) ;
182+ cmd. arg ( "-a" ) . arg ( "iTerm" ) . arg ( & path) ;
183+ run_terminal_command ( cmd, "iTerm2" , & path) ?;
184+ }
185+ "warp" => {
186+ let mut cmd = Command :: new ( "open" ) ;
187+ cmd. arg ( "-a" ) . arg ( "Warp" ) . arg ( & path) ;
188+ run_terminal_command ( cmd, "Warp" , & path) ?;
189+ }
190+ "ghostty" => {
191+ let mut cmd = Command :: new ( "open" ) ;
192+ cmd. arg ( "-a" ) . arg ( "Ghostty" ) . arg ( & path) ;
193+ run_terminal_command ( cmd, "Ghostty" , & path) ?;
194+ }
195+ "alacritty-mac" => {
196+ let mut cmd = Command :: new ( "alacritty" ) ;
197+ cmd. arg ( "--working-directory" ) . arg ( & path) ;
198+ run_terminal_command ( cmd, "Alacritty" , & path) ?;
199+ }
200+ "wezterm-mac" => {
201+ let mut cmd = Command :: new ( "wezterm" ) ;
202+ cmd. arg ( "start" ) . arg ( "--cwd" ) . arg ( & path) ;
203+ run_terminal_command ( cmd, "WezTerm" , & path) ?;
204+ }
205+ "hyper" => {
206+ let mut cmd = Command :: new ( "hyper" ) ;
207+ cmd. arg ( & path) ;
208+ run_terminal_command ( cmd, "Hyper" , & path) ?;
209+ }
181210 _ => bail ! ( "Unknown terminal: {}" , terminal_id) ,
182211 } ;
183- let mut cmd = Command :: new ( "open" ) ;
184- cmd. arg ( "-a" ) . arg ( app_name) . arg ( & path) ;
185- run_terminal_command ( cmd, app_name, & path) ?;
186212 }
187213
188214 #[ cfg( target_os = "windows" ) ]
0 commit comments