Skip to content

Commit

Permalink
feat: add Warp integration for Linux (#1087)
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya authored and shiftkey committed Aug 11, 2024
1 parent 8e34109 commit 759d971
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/src/lib/shells/linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export enum Shell {
Alacritty = 'Alacritty',
Kitty = 'Kitty',
LXTerminal = 'LXDE Terminal',
Warp = 'Warp',
}

export const Default = Shell.Gnome
Expand Down Expand Up @@ -68,6 +69,8 @@ function getShellPath(shell: Shell): Promise<string | null> {
return getPathIfAvailable('/usr/bin/kitty')
case Shell.LXTerminal:
return getPathIfAvailable('/usr/bin/lxterminal')
case Shell.Warp:
return getPathIfAvailable('/usr/bin/warp-terminal')
default:
return assertNever(shell, `Unknown shell: ${shell}`)
}
Expand All @@ -92,6 +95,7 @@ export async function getAvailableShells(): Promise<
alacrittyPath,
kittyPath,
lxterminalPath,
warpPath,
] = await Promise.all([
getShellPath(Shell.Gnome),
getShellPath(Shell.GnomeConsole),
Expand All @@ -108,6 +112,7 @@ export async function getAvailableShells(): Promise<
getShellPath(Shell.Alacritty),
getShellPath(Shell.Kitty),
getShellPath(Shell.LXTerminal),
getShellPath(Shell.Warp),
])

const shells: Array<FoundShell<Shell>> = []
Expand Down Expand Up @@ -171,6 +176,10 @@ export async function getAvailableShells(): Promise<
shells.push({ shell: Shell.LXTerminal, path: lxterminalPath })
}

if (warpPath) {
shells.push({ shell: Shell.Warp, path: warpPath })
}

return shells
}

Expand Down Expand Up @@ -204,6 +213,8 @@ export function launch(
return spawn(foundShell.path, ['--single-instance', '--directory', path])
case Shell.LXTerminal:
return spawn(foundShell.path, ['--working-directory=' + path])
case Shell.Warp:
return spawn(foundShell.path, [], { cwd: path })
default:
return assertNever(shell, `Unknown shell: ${shell}`)
}
Expand Down

0 comments on commit 759d971

Please sign in to comment.