Skip to content

Commit dece2f4

Browse files
Add support for WezTerm on macOS
1 parent f917893 commit dece2f4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

app/src/lib/shells/darwin.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export enum Shell {
1111
PowerShellCore = 'PowerShell Core',
1212
Kitty = 'Kitty',
1313
Alacritty = 'Alacritty',
14+
WezTerm = 'WezTerm',
1415
}
1516

1617
export const Default = Shell.Terminal
@@ -33,6 +34,8 @@ function getBundleID(shell: Shell): string {
3334
return 'net.kovidgoyal.kitty'
3435
case Shell.Alacritty:
3536
return 'io.alacritty'
37+
case Shell.WezTerm:
38+
return 'com.github.wez.wezterm'
3639
default:
3740
return assertNever(shell, `Unknown shell: ${shell}`)
3841
}
@@ -58,13 +61,15 @@ export async function getAvailableShells(): Promise<
5861
powerShellCorePath,
5962
kittyPath,
6063
alacrittyPath,
64+
wezTermPath,
6165
] = await Promise.all([
6266
getShellPath(Shell.Terminal),
6367
getShellPath(Shell.Hyper),
6468
getShellPath(Shell.iTerm2),
6569
getShellPath(Shell.PowerShellCore),
6670
getShellPath(Shell.Kitty),
6771
getShellPath(Shell.Alacritty),
72+
getShellPath(Shell.WezTerm),
6873
])
6974

7075
const shells: Array<IFoundShell<Shell>> = []
@@ -94,6 +99,11 @@ export async function getAvailableShells(): Promise<
9499
shells.push({ shell: Shell.Alacritty, path: alacrittyExecutable })
95100
}
96101

102+
if (wezTermPath) {
103+
const wezTermExecutable = `${wezTermPath}/Contents/MacOS/wezterm`
104+
shells.push({ shell: Shell.WezTerm, path: wezTermExecutable })
105+
}
106+
97107
return shells
98108
}
99109

@@ -115,6 +125,12 @@ export function launch(
115125
// It uses --working-directory command to start the shell
116126
// in the specified working directory.
117127
return spawn(foundShell.path, ['--working-directory', path])
128+
} else if (foundShell.shell === Shell.WezTerm) {
129+
// WezTerm, like Alacritty, "cannot open files in the 'folder' format."
130+
//
131+
// It uses the subcommand `start`, followed by the option `--cwd` to set
132+
// the working directory, followed by the path.
133+
return spawn(foundShell.path, ['start', '--cwd', path])
118134
} else {
119135
const bundleID = getBundleID(foundShell.shell)
120136
return spawn('open', ['-b', bundleID, path])

docs/technical/shell-integration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ These shells are currently supported:
149149
- [PowerShell Core](https://github.com/powershell/powershell/)
150150
- [Kitty](https://sw.kovidgoyal.net/kitty/)
151151
- [Alacritty](https://github.com/alacritty/alacritty)
152+
- [WezTerm](https://github.com/wez/wezterm)
152153

153154
These are defined in an enum at the top of the file:
154155

0 commit comments

Comments
 (0)