- Add ttyd-nerd-font submodule with embedded JetBrains Mono Nerd Font for proper icon rendering in browser via ttyd - Add Ctrl+Shift+V / Shift+Insert paste support in ttyd frontend - Strip Zellij env vars from PTY child processes to prevent workspace terminal from inheriting Zellij session context - Launch PTY commands through login shell for proper PATH resolution - Use /etc/passwd shell lookup instead of $SHELL (Zellij overrides it) - Soften ANSI 256-color palette to match modern dark themes - Handle Nerd Font PUA glyphs as width 1 in pyte terminal emulator - Fix brightmagenta typo in pyte graphics - Update install script to build ttyd from submodule source - Add web deployment TODO items for image paste and context menu Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
80 lines
3.0 KiB
Bash
Executable File
80 lines
3.0 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
export TERM=xterm-256color
|
|
export COLORTERM=truecolor
|
|
|
|
PROJECTS_DIR="/mnt/media/Projects"
|
|
CLIDE_BIN="/mnt/media/Projects/clide/.venv/bin/clide"
|
|
|
|
# Parse URL argument from ttyd (format: project=name or just name)
|
|
# ttyd passes arguments after the command
|
|
PROJECT_ARG="${1:-}"
|
|
|
|
# Extract project name (handle "project=foo" or just "foo")
|
|
if [[ "$PROJECT_ARG" == project=* ]]; then
|
|
PROJECT="${PROJECT_ARG#project=}"
|
|
elif [[ -n "$PROJECT_ARG" ]]; then
|
|
PROJECT="$PROJECT_ARG"
|
|
else
|
|
PROJECT=""
|
|
fi
|
|
|
|
# If no project specified, show selector
|
|
if [[ -z "$PROJECT" ]]; then
|
|
echo "╔══════════════════════════════════════════════════════════╗"
|
|
echo "║ Clide Project Selector ║"
|
|
echo "╠══════════════════════════════════════════════════════════╣"
|
|
echo "║ Add ?project=NAME to URL to connect directly ║"
|
|
echo "║ Example: code.schweitz.net?project=system-management ║"
|
|
echo "╠══════════════════════════════════════════════════════════╣"
|
|
echo "║ Available projects: ║"
|
|
echo "╚══════════════════════════════════════════════════════════╝"
|
|
echo ""
|
|
|
|
# List git repos in Projects dir
|
|
for dir in "$PROJECTS_DIR"/*/; do
|
|
if [[ -d "$dir/.git" ]]; then
|
|
name=$(basename "$dir")
|
|
echo " • $name"
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "Active sessions:"
|
|
zellij list-sessions 2>/dev/null | grep "^clide-" | sed 's/^/ • /' || echo " (none)"
|
|
echo ""
|
|
read -p "Enter project name: " PROJECT
|
|
fi
|
|
|
|
# Validate project exists
|
|
WORKDIR="$PROJECTS_DIR/$PROJECT"
|
|
if [[ ! -d "$WORKDIR" ]]; then
|
|
echo "Error: Project '$PROJECT' not found in $PROJECTS_DIR"
|
|
echo "Available: $(ls -1 "$PROJECTS_DIR" | tr '\n' ' ')"
|
|
exit 1
|
|
fi
|
|
|
|
SESSION_NAME="clide-$PROJECT"
|
|
|
|
# Clean up dead/exited zellij sessions for this project
|
|
if zellij list-sessions 2>/dev/null | grep -q "$SESSION_NAME.*EXITED"; then
|
|
zellij delete-session "$SESSION_NAME" 2>/dev/null || true
|
|
fi
|
|
|
|
# Try to attach to a live session, otherwise create fresh
|
|
if zellij list-sessions 2>/dev/null | grep -q "^$SESSION_NAME "; then
|
|
# Session exists and is alive -- attach
|
|
exec zellij attach "$SESSION_NAME" \
|
|
options --no-pane-frames --default-cwd "$WORKDIR"
|
|
else
|
|
# No live session -- kill any zombie remnants and start fresh
|
|
zellij delete-session "$SESSION_NAME" 2>/dev/null || true
|
|
|
|
exec zellij --session "$SESSION_NAME" \
|
|
options \
|
|
--no-pane-frames \
|
|
--default-shell "$CLIDE_BIN" \
|
|
--default-cwd "$WORKDIR"
|
|
fi
|