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 @@ -158,7 +158,8 @@ pub fn build<R: Runtime>(
158
158
. build ( handle) ?,
159
159
)
160
160
. separator ( )
161
- . text ( "project/open-in-vscode" , "Open in Editor" ) ;
161
+ . text ( "project/open-in-vscode" , "Open in Editor" )
162
+ . text ( "project/open-in-terminal" , "Open in Terminal" ) ;
162
163
163
164
#[ cfg( target_os = "macos" ) ]
164
165
{
@@ -322,6 +323,11 @@ pub fn handle_event<R: Runtime>(
322
323
return ;
323
324
}
324
325
326
+ if event. id ( ) == "project/open-in-terminal" {
327
+ emit ( webview, SHORTCUT_EVENT , "open-in-terminal" ) ;
328
+ return ;
329
+ }
330
+
325
331
if event. id ( ) == "project/show-in-finder" {
326
332
emit ( webview, SHORTCUT_EVENT , "show-in-finder" ) ;
327
333
return ;
You can’t perform that action at this time.
0 commit comments