Files
go-ts/readme.md
2026-01-17 02:47:15 +01:00

117 lines
4.8 KiB
Markdown

# TeamSpeak TUI Client
A modern, fast, and lightweight TeamSpeak 3 client built in Go with a beautiful Terminal User Interface (TUI).
## 🚀 Features
- **Low Latency Audio**: Optimized for both Windows (WASAPI) and Linux (PortAudio).
- **Responsive UI**: Built with Bubble Tea for a smooth terminal experience.
- **Cross-Platform**: Full support for Windows and Linux (including WSL2).
- **Audio Controls**: Per-user volume and mute indicators.
## 🛠️ Linux Dependencies
To build the project on Linux (including Ubuntu/WSL2), you need to install the following system libraries:
```bash
sudo apt-get update
sudo apt-get install -y \
libportaudio2 \
portaudio19-dev \
libopus-dev \
libpulse-dev
```
### 🔊 WSL2 Audio Setup
WSL2 does not have direct access to your Windows audio hardware. To enable audio, we recommend using a PulseAudio network bridge:
1. **Install PulseAudio on Windows** (e.g., via [portable binaries](https://www.freedesktop.org/wiki/Software/PulseAudio/Ports/Windows/)).
2. **Enable TCP**: Edit `default.pa` in PulseAudio and add:
`load-module module-native-protocol-tcp auth-anonymous=1 listen=0.0.0.0`
3. **Environment Variable**: Set the `PULSE_SERVER` in your WSL2 shell:
```bash
export PULSE_SERVER=tcp:$(grep nameserver /etc/resolv.conf | awk '{print $2}'):4713
```
## 🏗️ Building
```bash
# General build
go build -o ts-tui ./cmd/tui
# Run with debug logging (highly recommended for audio setup)
go run ./cmd/tui --server your-ip:9987 --debug
```
## ⌨️ Common Keys
- `q`: Quit cleanly.
- `Arrows / hjkl`: Navigate channels and users.
- `Enter`: Join channel.
- `1`: Poke user (in User View).
- `m`: Mute/Unmute audio.
## 💻 Development with VS Code
This project uses Go **build tags** to support multiple platforms from the same codebase. This can sometimes cause "redeclared" errors or "undefined" symbols in VS Code if not configured correctly.
### Recommended Setup
1. **Windows + MSYS2**: If you are developing on Windows and have Opus/PortAudio installed via MSYS2, your `.vscode/settings.json` should include the paths to your MinGW64 environment:
```json
{
"go.toolsEnvVars": {
"CGO_ENABLED": "1",
"PATH": "C:\\msys64\\mingw64\\bin;${env:PATH}",
"PKG_CONFIG_PATH": "C:\\msys64\\mingw64\\lib\\pkgconfig"
}
}
```
2. **Build Tags**: Do **not** force both tags simultaneously (e.g., `-tags=linux,windows`) as this will cause "redeclared" errors for types defined in both systems (like `Player` or `Capturer`).
3. **Switching OS Analysis**: If you are on Windows but want to check for errors in the Linux files, update your settings to:
```json
"go.toolsEnvVars": { "GOOS": "linux" }
```
### Pro Tip: VS Code Remote - WSL
For the best experience when working on Linux features from Windows, use the **WSL extension**. Open VS Code inside your WSL environment (`code .` from the WSL terminal). This allows `gopls` to run directly in Linux, where all system headers and libraries are natively available.
## 🤖 Gitea Actions (CI/CD)
El archivo `.gitea/workflows/build-windows.yml` automatiza la compilación en cada push.
### Cómo usar tu propio Windows como Runner
Si tu Gitea no tiene runners públicos, puedes convertir tu propia máquina Windows en uno:
1. **Descarga `act_runner`**: Descarga el binario oficial de [Gitea Actions Runner](https://gitea.com/gitea/act_runner/releases).
2. **Registro**:
- Ve a tu instancia de Gitea -> Administración del Sitio -> Actions -> Runners.
- Copia el **Registration Token**.
- Ejecuta: `./act_runner register`
- Introduce la URL de tu Gitea y el token.
- En **labels**, asegúrate de poner `windows-latest:host`.
3. **Ejecución**:
- Lanza el runner: `./act_runner daemon`.
- Ahora, cualquier push lanzará la build en tu PC de forma automática.
> [!TIP]
> El workflow usa **MSYS2** automáticamente para instalar `opus` y `portaudio` en el entorno temporal de la build, así que no necesitas configurar nada extra en el sistema del runner.
### Cómo añadir un Runner en WSL2 (para x86_64)
Si tu runner principal es ARM (como una Raspberry Pi) y quieres compilar para tu PC (x86_64), lo mejor es poner un runner dentro de WSL2:
1. **Entra en WSL2**: Ejecuta `wsl` en tu terminal.
2. **Descarga `act_runner`**:
```bash
curl -L https://gitea.com/gitea/act_runner/releases/download/v0.2.13/act_runner-0.2.13-linux-amd64 -o act_runner
chmod +x act_runner
```
3. **Registro**:
- Igual que en Windows, usa `./act_runner register` con el token de tu Gitea.
- En **labels**, pon algo como `linux-x86_64:host`.
4. **Actualiza el workflow**:
- En `.gitea/workflows/build-linux.yml`, cambia `runs-on: ubuntu-latest` por `runs-on: linux-x86_64`.
> [!NOTE]
> Al usar el label `:host`, el runner usará las herramientas instaladas en tu Linux de WSL2 sin necesidad de Docker, lo que lo hace mucho más rápido.