- Width: drop the header-fits-too floor; popup width is now max(COLUMN_WIDTH, columns-required, tabs-required). The brand title in the header is allowed to ellipsize at the 216px minimum (full name preserved in tray hover and h1 title attr). - Minimize: new -/▢ button in the header next to pin. Toggling hides the tab strip + body, locks width at COLUMN_WIDTH, and lets the existing ResizeObserver collapse height to just the header. State persists in config.minimized so reopening the popup remembers it. Add-column + button is hidden while minimized. - Claude launcher: now spawns powershell.exe -NoExit -Command claude in the wt new-tab (was cmd.exe /K claude). Cmd-fallback updated to also start powershell directly when the trailing args target it.
340 lines
11 KiB
JavaScript
340 lines
11 KiB
JavaScript
const { shell, clipboard, dialog } = require('electron');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const { spawn } = require('child_process');
|
|
|
|
function ensureExists(targetPath) {
|
|
try {
|
|
fs.accessSync(targetPath);
|
|
return { ok: true };
|
|
} catch {
|
|
return { ok: false, error: `Path not found:\n${targetPath}` };
|
|
}
|
|
}
|
|
|
|
function ensureWindows() {
|
|
if (process.platform !== 'win32') {
|
|
return { ok: false, error: 'Windows only.' };
|
|
}
|
|
return { ok: true };
|
|
}
|
|
|
|
async function openInExplorer(targetPath) {
|
|
const exists = ensureExists(targetPath);
|
|
if (!exists.ok) return exists;
|
|
const result = await shell.openPath(targetPath);
|
|
if (result) return { ok: false, error: result };
|
|
return { ok: true };
|
|
}
|
|
|
|
// Reasonable cap for the alias used as a wt --title argument and as a
|
|
// search pattern. Strips control + reserved chars that would break wt's
|
|
// command parser (it splits on `;`).
|
|
function sanitizeTitle(s) {
|
|
if (!s) return '';
|
|
return String(s).replace(/[ |