External editor via cmd/start + exe picker; Permissions hidden for Windows-local (chmod only flips read-only there); Explorer/Recycle Bin wording; Ctrl vs Cmd shortcut labels; separator-aware path joins + drive-root detection; drives list in the panel source picker; icon.ico + colored tray icon; icacls ACL on connections.json; README Windows (beta) section with upstream known issues and a smoke-test checklist. Runtime paths pending first boot on a real Windows machine. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
43 lines
1.6 KiB
TypeScript
43 lines
1.6 KiB
TypeScript
// Injected by the bun process via BrowserWindow preload (src/bun/windows.ts
|
|
// buildPreload) before any page script. Brand-neutral names so rebrands never
|
|
// touch this file.
|
|
import type { EditorOpenContext } from '@shared/rpc';
|
|
|
|
declare global {
|
|
interface Window {
|
|
__APP_PLATFORM?: string;
|
|
/** Which root component this window boots. */
|
|
__APP_MODE?: 'main' | 'editor' | 'manager';
|
|
/** Window-kind specific context (EditorOpenContext for editor windows). */
|
|
__APP_CTX?: unknown;
|
|
}
|
|
}
|
|
|
|
export const PLATFORM = typeof window !== 'undefined' ? (window.__APP_PLATFORM ?? '') : '';
|
|
|
|
/** True when the window uses macOS hiddenInset chrome (header fused with titlebar). */
|
|
export const IS_MAC_CHROME = PLATFORM === 'darwin';
|
|
|
|
export const IS_WINDOWS = PLATFORM === 'win32';
|
|
|
|
/** Shortcut-hint labels: "⌘W" on macOS, "Ctrl+W" elsewhere. */
|
|
export const MOD_LABEL = IS_MAC_CHROME ? '⌘' : 'Ctrl+';
|
|
export const ALT_LABEL = IS_MAC_CHROME ? '⌥' : 'Alt+';
|
|
|
|
export const APP_MODE: 'main' | 'editor' | 'manager' =
|
|
typeof window !== 'undefined' ? (window.__APP_MODE ?? 'main') : 'main';
|
|
|
|
export const EDITOR_CONTEXT =
|
|
typeof window !== 'undefined' ? (window.__APP_CTX as EditorOpenContext | undefined) : undefined;
|
|
|
|
/**
|
|
* Kill the webview's default right-click menu (Reload, Inspect Element…)
|
|
* everywhere the app doesn't show its own native menu. Text fields keep the
|
|
* system text menu (cut/copy/paste, spelling).
|
|
*/
|
|
export function blockNativeContextMenu(event: Event): void {
|
|
const target = event.target as HTMLElement | null;
|
|
if (target?.closest('input, textarea, [contenteditable="true"]')) return;
|
|
event.preventDefault();
|
|
}
|