Skip to content

Commit e54e6c3

Browse files
authored
Merge pull request #89 from grimmerk/fix/terminal-cwd-update
fix: terminal CWD updates when Working Dir changes
2 parents 9c4f284 + cd53a21 commit e54e6c3

4 files changed

Lines changed: 32 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 1.0.60
4+
5+
- Fix: terminal cd uses ~ shorthand + clear for cleaner output
6+
- Fix: POSIX-safe shell escaping for cd path
7+
- Move Working Dir setting to General (visible in Projects + Terminal tabs)
8+
39
## 1.0.59
410

511
- Feat: SVG starburst icon for Sessions tab header (sunflower yellow)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "CodeV",
33
"productName": "CodeV",
4-
"version": "1.0.59",
4+
"version": "1.0.60",
55
"description": "Quick switcher for VS Code, Cursor, and Claude Code sessions",
66
"repository": {
77
"type": "git",

src/main.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,16 @@ ipcMain.on('open-folder-selector', async (event) => {
674674
if (window) {
675675
window.webContents.send('folder-selected', folderPath);
676676
}
677+
678+
// Update terminal CWD if PTY is running (#88)
679+
if (ptyProcess) {
680+
const home = require('os').homedir();
681+
const rest = folderPath.startsWith(home) ? folderPath.slice(home.length) : null;
682+
// POSIX-safe: single-quote the path, escape embedded single quotes
683+
const escaped = (rest !== null ? rest : folderPath).replace(/'/g, "'\\''");
684+
const cdPath = rest !== null ? `~'${escaped}'` : `'${escaped}'`;
685+
ptyProcess.write(`cd ${cdPath} && clear\n`);
686+
}
677687
});
678688

679689
ipcMain.on('ide-preference-changed', async (_event, preferredIDE: string) => {

src/popup.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,21 @@ const PopupDefaultExample = ({
392392
/>
393393
</label>
394394
</div>
395+
{switcherMode !== 'sessions' && (
396+
<div style={{ ...rowStyle, gap: '8px' }}>
397+
<span style={labelStyle}>Working Dir</span>
398+
<div style={{ color: '#aaa', fontSize: '12px', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1, textAlign: 'right' }}>
399+
{workingFolderPath || 'None'}
400+
</div>
401+
<button
402+
onClick={() => openFolderSelector()}
403+
style={{ backgroundColor: 'transparent', border: '1px solid #555', borderRadius: '4px', padding: '2px 6px', cursor: 'pointer', fontSize: '12px', color: THEME.text.primary, flexShrink: 0 }}
404+
title="Change Folder"
405+
>
406+
📁
407+
</button>
408+
</div>
409+
)}
395410
</div>
396411

397412
{/* Projects settings (only in Projects tab) */}
@@ -437,19 +452,6 @@ const PopupDefaultExample = ({
437452
</button>
438453
)}
439454
</div>
440-
<div style={{ ...rowStyle, gap: '8px' }}>
441-
<span style={labelStyle}>Working Dir</span>
442-
<div style={{ color: '#aaa', fontSize: '12px', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1, textAlign: 'right' }}>
443-
{workingFolderPath || 'None'}
444-
</div>
445-
<button
446-
onClick={() => openFolderSelector()}
447-
style={{ backgroundColor: 'transparent', border: '1px solid #555', borderRadius: '4px', padding: '2px 6px', cursor: 'pointer', fontSize: '12px', color: THEME.text.primary, flexShrink: 0 }}
448-
title="Change Folder"
449-
>
450-
📁
451-
</button>
452-
</div>
453455
</div>
454456
)}
455457

0 commit comments

Comments
 (0)