{"id":51941295,"url":"https://github.com/buzzqw/tpgk","last_synced_at":"2026-07-28T19:01:19.469Z","repository":{"id":373441522,"uuid":"1311890352","full_name":"buzzqw/TPGK","owner":"buzzqw","description":"Enhanced Terminal Emulator for Linux, in python and VTE","archived":false,"fork":false,"pushed_at":"2026-07-27T19:58:03.000Z","size":358,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-07-27T21:16:40.494Z","etag":null,"topics":["ai","console","emulator","history","notes","terminal"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buzzqw.png","metadata":{"files":{"readme":"README.md","changelog":"history.py","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-25T10:31:08.000Z","updated_at":"2026-07-27T19:58:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/buzzqw/TPGK","commit_stats":null,"previous_names":["buzzqw/tpgk"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/buzzqw/TPGK","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buzzqw%2FTPGK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buzzqw%2FTPGK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buzzqw%2FTPGK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buzzqw%2FTPGK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buzzqw","download_url":"https://codeload.github.com/buzzqw/TPGK/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buzzqw%2FTPGK/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36003882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-28T02:00:06.341Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","console","emulator","history","notes","terminal"],"created_at":"2026-07-28T19:01:16.848Z","updated_at":"2026-07-28T19:01:19.462Z","avatar_url":"https://github.com/buzzqw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TPGK — Terminal Python GTK\n\n[![Python](https://img.shields.io/badge/Python-3.10%2B-blue)](https://python.org)\n[![GTK3](https://img.shields.io/badge/GTK-3-green)](https://gtk.org)\n[![VTE](https://img.shields.io/badge/VTE-2.91-orange)](https://wiki.gnome.org/Apps/Terminal/VTE)\n[![License](https://img.shields.io/badge/License-EUPL%201.2-blue)](LICENSE)\n\n**TPGK** is an advanced terminal emulator for Linux built with Python, GTK3, and VTE.\nIt combines a full-featured terminal with AI chat capabilities, command history\nsearch, and a built-in notes system.\n\n\u003e TPGK uses **VTE** (the same engine as GNOME Terminal) for perfect scroll,\n\u003e selection, and copy-paste behavior.\n\n- **[English manual](manual_en.md)**\n- **[Manuale italiano](manual_it.md)**\n\n---\n\n## Features\n\n### Core Terminal\n- Full terminal emulation via **VTE** (xterm-256color, true color)\n- Tabs with **detach**, **move**, **reorder**, **rename**\n- **Split screen** (tmux-like): single, vertical, horizontal panels\n- **System Stats bar**: CPU, RAM, disk updated every 3s via psutil (View \u003e Show System Stats)\n- **SSH detection**: stats label adapts when inside an SSH session\n- **Scrollback** with configurable limit (or unlimited, `0`)\n- **Scrollbar position**: right, left, or disabled\n- **Toolbar**, **menu bar**, **scrollbar**, **stats bar** toggles\n- 8 color schemes: Dark, Light, Solarized Dark, Solarized Light,\n  Gruvbox Dark, Monokai, Nord, Matrix\n- **Custom 16-color palette** editor with presets\n- **Clickable URLs** — Ctrl+Click or direct click to open in browser\n- **Command palette** — press `/` for interactive popup with fuzzy search\n\n### AI Chat (built-in)\n- `/ai` — Chat with AI directly in the terminal\n- `/ai context N \u003cquestion\u003e` — Include terminal output as AI context\n- `Ctrl+C` to cancel AI responses (no orphaned threads)\n- `/connect [provider]` — Interactive provider/model selection with auto-detection\n- 6 providers: OpenAI, Claude, Gemini, DeepSeek, Ollama (local), Custom\n- Streaming responses with busy indicator (\"● Thinking\")\n- **System Prompt** per provider — customize AI persona and behavior\n\n### Smart Commands\n| Command | Description |\n|---------|-------------|\n| `/history [terms\\|-term\\|:sql SQL]` | Search command history (AND logic, exclusion with -, raw SQL) |\n| `/ai` | Enter AI chat mode |\n| `/ai context N q` | Include last N lines as AI context |\n| `/ai off` | Exit AI chat mode |\n| `/connect [provider]` | Select AI provider/model |\n| `/wnotes [-file.md] text` | Save a timestamped note |\n| `/onotes [-file.md]` | Open notes in editor |\n| `/help` | Show commands and shortcuts |\n| `/clear` or `/cls` | Clear the screen |\n\n### History\n- **SQLite-backed** command history (`~/.config/tpgk/history.db`)\n- **Ctrl+R**: Interactive reverse-i-search\n- `/history ssh 167`: AND logic, `/history ssh -161`: exclusion, `/history :sql SELECT ...`: raw SQL\n- **SQL examples**: failed commands (`exit_code != 0`), by directory (`cwd LIKE '%/proj%'`), most used (`GROUP BY command`), last day (`timestamp \u003e datetime('now','-1 day')`)\n- **Alt+1..9**: Re-execute a history result\n\n### Notes\n- `/wnotes` — Save timestamped notes to markdown\n- `/onotes` — Open notes in configured editor\n- **Right-click → Add to Note** — Append selected text to notes\n\n### Preferences (live-reload)\n- **Font chooser** — native Gtk.FontChooserDialog\n- 8 color schemes with instant live preview\n- 16-color palette editor\n- **Terminal size** (cols × rows) determines window dimensions\n- AI API keys, models, URLs, and system prompts\n- Shell command, encoding, cursor, transparency, and more\n- All changes applied **immediately without restart**\n\n### Signals \u0026 Process Control\n- **Send Signal** menu (SIGTERM, SIGKILL, SIGHUP, SIGINT, etc.)\n- Signals target the **foreground process group** (not just bash)\n- 13 encodings (UTF-8 through GBK)\n- Shell integration via OSC 133 (bash/zsh)\n\n---\n\n## Installation\n\n### Quick Install\n```bash\ngit clone https://github.com/buzzqw/TPGK.git tpgk\ncd tpgk\nchmod +x setup.sh\n./setup.sh\n```\n\n### Manual Install\n```bash\n# System dependencies (Arch)\nsudo pacman -S gtk3 vte3 python-gobject\n\n# Clone and create venv\ngit clone https://github.com/buzzqw/TPGK.git tpgk\ncd tpgk\nuv venv .venv --system-site-packages\nsource .venv/bin/activate\nuv pip install requests\n```\n\n### Run\n```bash\n./tpgk.sh\n# or\nsource .venv/bin/activate \u0026\u0026 python -m tpgk\n```\n\n---\n\n## Keyboard Shortcuts\n\n| Shortcut | Action |\n|----------|--------|\n| `Ctrl+Shift+T` | New Tab |\n| `Ctrl+Shift+N` | New Window |\n| `Ctrl+Shift+W` | Close Tab |\n| `Ctrl+Shift+Q` | Close Window |\n| `Ctrl+Shift+C` | Copy |\n| `Ctrl+Shift+V` | Paste |\n| `Ctrl+Shift+A` | Select All |\n| `Ctrl+Shift+S` | Set Title |\n| `Ctrl+Shift+R` | Reset Terminal |\n| `Ctrl+Shift+X` | Reset and Clear |\n| `Ctrl+Shift+Up` / `Ctrl+Shift+Down` | Jump between prompts (OSC 133) |\n| `Ctrl++` / `Ctrl+-` / `Ctrl+0` | Zoom In / Out / Reset |\n| `Ctrl+R` | Interactive History Search |\n| `Ctrl+U` | Kill Line |\n| `Ctrl+W` | Kill Word |\n| `Ctrl+L` | Clear Screen |\n| `Ctrl+C` | Interrupt / Cancel AI / Exit history search |\n| `Ctrl+D` | EOF (closes tab on exit) |\n| `F11` | Fullscreen |\n| `Ctrl+Click` URL | Open URL in browser |\n| `Alt+1..9` | Re-execute history |\n| `/` (start of line) | Open command palette |\n| `Tab` (after `/`) | Autocomplete command / show provider list for `/connect` |\n\n---\n\n## Configuration\n\nSettings in `~/.config/tpgk/settings.json`.\n\nAll options via **Edit \u003e Preferences** (7 tabs: General, Appearance, Colors,\nCompatibility, AI, Notes, About):\n\n- Font (native chooser), size, bold\n- Color scheme (8 presets) with live preview\n- Terminal size (cols × rows)\n- Scrollback, scrollbar position\n- Cursor shape, blink, color\n- 16-color palette with presets\n- AI provider keys, models, URLs, system prompts\n- Shell command, login shell, encoding\n- OSC 133 shell integration (bash/zsh)\n- Notes directory, file, editor\n\n---\n\n## Shell Integration (OSC 133)\n\nTPGK supports shell integration via OSC 133 sequences to track\nprompts, commands, and exit codes.\n\n### Features\n- **`Ctrl+Shift+Up/Down`** — jump between prompts in the scrollback buffer\n- **Right-click \u003e Copy Command Output** — copy the output of the last command\n- **Visual margin markers** — green bar (success) or red bar (failure) at every prompt\n- **Exit code tracking** — exit codes shown via margin markers and available for scripting\n\n### Activation\n\n1. Enable in **Preferences \u003e Compatibility \u003e OSC 133**.\n2. A setup script `osc-setup.sh` is created in `~/.config/tpgk/`. Run it:\n   ```bash\n   bash ~/.config/tpgk/osc-setup.sh\n   ```\n3. Restart TPGK — the integration script `osc133.sh` is auto-generated at startup.\n\nThe integration supports both **bash** and **zsh**.\n\n---\n\n## Requirements\n\n- **Python** \u003e= 3.10\n- **GTK3** (`gtk3`)\n- **VTE 2.91** (`vte3`)\n- **PyGObject** (`python-gobject`)\n- **requests** (for AI clients)\n- **Linux** with X11 or Wayland\n\n---\n\n## Performance\n\nMeasured on a typical Linux desktop (average of 3 cold-launch runs, process\nstart to window mapped):\n\n| Metric | Value |\n|---|---|\n| Startup time | ~0.7s |\n| Idle memory (RSS) | ~84 MB |\n\nThe `requests` library — only needed for AI chat — is imported lazily on\nfirst use instead of at startup. This trims ~125ms off startup time and\n~20MB off idle memory versus importing it eagerly.\n\n---\n\n## Project Structure\n\n```\ntpgk/\n├── __init__.py              # Package init\n├── __main__.py              # Gtk.Application entry point\n├── window.py                # MainWindow, menus, tabs, toolbar, detached window\n├── terminal.py              # VTE terminal wrapper with AI/history/notes\n├── history.py               # SQLite command history with search\n├── ai_client.py             # Multi-provider AI API client\n├── notes.py                 # Timestamped notes manager\n├── settings.py              # JSON config singleton (50+ settings)\n├── settings_dialog.py       # GTK preferences dialog (7 tabs)\n├── system_stats.py          # CPU/RAM/Disk stats collector\n├── tests/\n│   ├── test_tpgk.py         # Core unit tests\n│   ├── test_tpgk_extra.py   # Edge-case tests\n│   └── test_new_features.py # New feature tests\n├── setup.sh                 # One-command installer\n├── tpgk.sh                  # Launcher script\n├── versiona.sh              # Release automation (commit, tag, GitHub release)\n├── README.md                # This file\n├── manual_en.md             # Full English user manual\n└── manual_it.md             # Full Italian user manual\n```\n\n---\n\n## License\n\n**EUPL 1.2** (European Union Public License)\n\n**Author:** Andres Zanzani (buzzqw)\n\n---\n\n## Acknowledgements\n\n- [VTE](https://wiki.gnome.org/Apps/Terminal/VTE) — The GNOME terminal widget\n- [GTK3](https://gtk.org) — Cross-platform GUI toolkit\n- [PyGObject](https://pygobject.gnome.org) — Python bindings for GObject libraries\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuzzqw%2Ftpgk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuzzqw%2Ftpgk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuzzqw%2Ftpgk/lists"}