File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed
crates/gitbutler-tauri/src Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 6
6
import { historyPath } from ' $lib/routes/routes.svelte' ;
7
7
import { SETTINGS } from ' $lib/settings/userSettings' ;
8
8
import { SHORTCUT_SERVICE } from ' $lib/shortcuts/shortcutService' ;
9
- import { getEditorUri , openExternalUrl , showFileInFolder } from ' $lib/utils/url' ;
9
+ import { getEditorUri , openExternalUrl , showFileInFolder , openInTerminal } from ' $lib/utils/url' ;
10
10
import { inject } from ' @gitbutler/shared/context' ;
11
11
import { mergeUnlisten } from ' @gitbutler/ui/utils/mergeUnlisten' ;
12
12
38
38
})
39
39
);
40
40
}),
41
+ shortcutService .on (' open-in-terminal' , async () => {
42
+ const project = await projectsService .fetchProject (projectId );
43
+ if (! project ) {
44
+ throw new Error (` Project not found: ${projectId } ` );
45
+ }
46
+ await openInTerminal ($userSettings .defaultTerminal .appName , vscodePath (project .path ));
47
+ }),
41
48
shortcutService .on (' show-in-finder' , async () => {
42
49
const project = await projectsService .fetchProject (projectId );
43
50
if (! project ) {
Original file line number Diff line number Diff line change @@ -51,3 +51,7 @@ export function getEditorUri(params: EditorUriParams): string {
51
51
52
52
return `${ params . schemeId } ://file${ pathString } ${ positionSuffix } ${ searchSuffix } ` ;
53
53
}
54
+
55
+ export async function openInTerminal ( appName : string , path : string ) {
56
+ await invoke < void > ( 'open_in_terminal' , { appName, path } ) ;
57
+ }
Original file line number Diff line number Diff line change @@ -144,7 +144,8 @@ pub fn build<R: Runtime>(handle: &AppHandle<R>) -> tauri::Result<tauri::menu::Me
144
144
. build ( handle) ?,
145
145
)
146
146
. separator ( )
147
- . text ( "project/open-in-vscode" , "Open in Editor" ) ;
147
+ . text ( "project/open-in-vscode" , "Open in Editor" )
148
+ . text ( "project/open-in-terminal" , "Open in Terminal" ) ;
148
149
149
150
#[ cfg( target_os = "macos" ) ]
150
151
{
@@ -295,6 +296,11 @@ pub fn handle_event(webview: &WebviewWindow, event: &MenuEvent) {
295
296
return ;
296
297
}
297
298
299
+ if event. id ( ) == "project/open-in-terminal" {
300
+ emit ( webview, SHORTCUT_EVENT , "open-in-terminal" ) ;
301
+ return ;
302
+ }
303
+
298
304
if event. id ( ) == "project/show-in-finder" {
299
305
emit ( webview, SHORTCUT_EVENT , "show-in-finder" ) ;
300
306
return ;
You can’t perform that action at this time.
0 commit comments