21 lines · 888 B · TypeScript
RawDownload
import type { DesktopBridge, DesktopWslState } from "@t3tools/contracts"; type WslEnableBridge = Pick<DesktopBridge, "setWslBackendEnabled" | "setWslDistro" | "setWslOnly">; export async function applyWslEnableSelection(input: {  readonly bridge: WslEnableBridge;  readonly mode: "both" | "wsl-only";  readonly nextDistro: string | null;  readonly persistedDistro: string | null;}): Promise<DesktopWslState> {  const { bridge, mode, nextDistro, persistedDistro } = input;   // Stage every preference before enabling. The desktop only relaunches for  // mode/distro changes while WSL is active, so the final enable observes the  // complete selection and is the only call that may relaunch.  await bridge.setWslOnly(mode === "wsl-only");  if (persistedDistro !== nextDistro) {    await bridge.setWslDistro(nextDistro);  }  return await bridge.setWslBackendEnabled(true);}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t