Skip to content

feat(terminal): tmux navigator, presets, and custom preset files#7

Open
dguerizec wants to merge 9 commits intotwidi:mainfrom
dguerizec:feature/terminal-navigator
Open

feat(terminal): tmux navigator, presets, and custom preset files#7
dguerizec wants to merge 9 commits intotwidi:mainfrom
dguerizec:feature/terminal-navigator

Conversation

@dguerizec
Copy link
Contributor

Summary

  • Tmux navigator: full-page shell picker with window management (create, select), preset sections grouped by source, and ad-hoc shell list
  • Preset system: multi-source discovery (project dir → git root → session cwd walk), relative_to field for cwd resolution (preset_dir, project_dir, git_dir, session_cwd), unavailable presets greyed out
  • Custom preset files: per-project file picker to add arbitrary JSON preset files, stored in ~/.twicc/presets/<project_id>.json, with deduplication against built-in sources
  • Shortcut config integration: shortcut button slots moved into the navigator page (unified settings surface)

Depends on #6 (terminal shortcuts).

Test plan

  • Open terminal tab, click gear icon → navigator shows shortcuts + shells + preset sections
  • Create ad-hoc shell, verify it appears with green icon, click to switch
  • Click a preset → creates window with correct cwd and command
  • Add a custom preset file via "Add preset file" → browse, select JSON, verify presets appear
  • Remove a custom preset file → section disappears
  • Add a preset with "relative_to": "project_dir" → cwd resolves to project root
  • Add a preset with "relative_to": "git_dir" when no git → preset greyed out
  • Select a non-JSON file in the picker → error message
  • Select an invalid JSON file → error on submit, dialog stays open
  • Toggle "Hidden" switch in file picker → dotfiles visible

🤖 Generated with Claude Code

Add a configurable toolbar of shortcut buttons for the terminal:
- 3 slots stored in localStorage (per-device, not synced)
- Default: Ctrl+C, Ctrl+Z, one empty slot
- Config panel toggled by re-clicking the Terminal tab
- Each slot opens a dialog with live key capture (press any combo)
- Supports Ctrl+A-Z, Alt+key, arrows, Esc, Tab, Enter, etc.
- Per-button "Show on desktop" toggle
- Buttons appear in the terminal toolbar alongside Copy mode toggle
- On mobile: all non-empty buttons visible
- On desktop: only buttons with showOnDesktop enabled
…s globally

- Fix compact header not collapsing when re-clicking Terminal tab on mobile
- Move terminalShortcuts to SYNCED_SETTINGS_KEYS so shortcuts configured
  on desktop are available on mobile (and vice versa)
…slot mismatch

- Use hidden <input> instead of div[tabindex=0] for key capture so mobile
  browsers show the virtual keyboard
- Reset _isApplyingRemoteSettings guard on nextTick to prevent ping-pong
  loop when backend broadcasts array/object synced settings back to sender
- Pass shortcut data directly to dialog open() to avoid stale prop from
  same-tick reactivity delay
- Dialog now closes itself after save/clear instead of relying on parent
  accessing unexposed template ref
…ab bar

- Backend: SessionContext, tmux window CRUD (create/select/rename/send-keys),
  preset resolution from .twicc-tmux.json, window monitor task, scroll bindings
- Frontend: TmuxNavigator component (shell picker with ad-hoc + preset sections),
  window tab bar (desktop), mobile dropdown, window state management in useTerminal
- Tab re-click cycles: navigator → config (shortcuts) → terminal
- Presets loaded from .twicc-tmux.json with multi-source resolution
  (project dir, git root, session cwd walk)
Move shortcut button slots from separate config panel into the
TmuxNavigator, unifying terminal settings in one place. Unify shell
rendering: all shells use play icon (green when running, grey when not),
presets stay in their source sections in original order.
Allow users to add arbitrary JSON preset files to any project via a file
browser dialog. Preset references are stored in ~/.twicc/presets/<project_id>.json
and loaded as additional sources in the navigator.

- Backend: preset file CRUD (paths.py, terminal.py, views.py), REST API
  endpoint, deduplication against built-in sources, content validation
- Frontend: AddPresetDialog with file tree browser and show-hidden toggle,
  JSON-only file filter, remove button on custom preset sections
Presets can now specify relative_to (preset_dir|project_dir|git_dir|
session_cwd) to control how their cwd is resolved. This enables
library preset files loaded from another directory to run commands
relative to the project root instead of the preset file location.

Presets whose base directory is unavailable are greyed out in the
navigator with a disabled state and explanatory message.
Replace misleading "at the root of your project directory" with the
actual multi-source discovery chain: project dir, git root, then
session cwd walk. Addresses PR review comment about documentation
not reflecting the real lookup behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant