// Name: Open Finder Tab in WezTerm // Description: Opens the active Finder tab's directory in a new WezTerm window. // Author: tayiorbeii // GitHub: tayiorbeii import "@johnlindquist/kit" const script = ` tell application "Finder" if (count of windows) is 0 then return POSIX path of (desktop as alias) else try set theTarget to (target of front window) as alias on error try set theTarget to (insertion location) as alias on error set theTarget to (desktop as alias) end try end try return POSIX path of theTarget end if end tell ` try { const dir = (await applescript(script)).trim() if (!dir) { await notify("Couldn't determine Finder path") exit(1) } if (which("wezterm")) { await $`wezterm start --cwd ${dir}` } else if (which("wezterm-gui")) { await $`wezterm-gui start --cwd ${dir}` } else { await $`open -a WezTerm --args start --cwd ${dir}` } } catch (err) { await notify(`Error: ${err?.message || err}`) exit(1) }