2026-04-03 17:37:51 +09:00
|
|
|
import type { OhMyOpenCodeConfig, TmuxConfig } from "./config"
|
|
|
|
|
import { TmuxConfigSchema } from "./config/schema/tmux"
|
|
|
|
|
|
2026-05-07 13:40:06 +09:00
|
|
|
type RuntimeWithBun = typeof globalThis & {
|
|
|
|
|
Bun?: {
|
|
|
|
|
which(binary: string): string | null
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function defaultWhich(binary: string): string | null {
|
|
|
|
|
return (globalThis as RuntimeWithBun).Bun?.which(binary) ?? null
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-04 14:14:19 +09:00
|
|
|
export function isTmuxIntegrationEnabled(
|
|
|
|
|
pluginConfig: { tmux?: { enabled?: boolean } | undefined },
|
|
|
|
|
): boolean {
|
|
|
|
|
return pluginConfig.tmux?.enabled ?? false
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-05 13:27:41 +09:00
|
|
|
export function isInteractiveBashEnabled(
|
2026-05-07 13:40:06 +09:00
|
|
|
which: (binary: string) => string | null = defaultWhich,
|
2026-04-05 13:27:41 +09:00
|
|
|
): boolean {
|
|
|
|
|
return which("tmux") !== null
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-03 17:37:51 +09:00
|
|
|
export function createRuntimeTmuxConfig(pluginConfig: { tmux?: OhMyOpenCodeConfig["tmux"] }): TmuxConfig {
|
|
|
|
|
return TmuxConfigSchema.parse(pluginConfig.tmux ?? {})
|
|
|
|
|
}
|