|
1 | 1 | # minigui |
2 | 2 |
|
3 | | -`minigui` es una biblioteca experimental para crear interfaces gráficas desde **Gleam (target Erlang)** usando un **port externo en C** (nativo). |
| 3 | +`minigui` is an experimental library for creating graphical user interfaces from **Gleam (Erlang target)** using a native **external C port**. |
4 | 4 |
|
5 | | -## Estado / alcance |
| 5 | +## Status / scope |
6 | 6 |
|
7 | | -- **Windows**: backend **Win32** (ventana + label + textbox + botón). |
8 | | -- **Linux**: backend **GTK3** (ventana + label + textbox + botón). |
9 | | -- **macOS**: por ahora solo **modo headless** (simulado). |
| 7 | +- **Windows**: **Win32** backend (window + label + textbox + button). |
| 8 | +- **Linux**: **GTK3** backend (window + label + textbox + button). |
| 9 | +- **macOS**: for now, **headless mode** only (simulated). |
10 | 10 |
|
11 | | -> Nota: en Linux el binario `minigui` enlaza con GTK3, por lo que el sistema debe tener GTK3 disponible en runtime (en desktops es común; en servidores minimalistas puede requerir instalar paquetes). |
| 11 | +> Note: on Linux the `minigui` binary links against GTK3, so the system must have GTK3 available at runtime (common on desktops; on minimal servers you may need to install packages). |
12 | 12 |
|
13 | | -El objetivo es mantener una API pequeña y estable en Gleam, y permitir backends nativos por plataforma. |
| 13 | +The goal is to keep a small, stable API in Gleam, while enabling native per-platform backends. |
14 | 14 |
|
15 | | -## Releases / publicación |
| 15 | +## Releases / publishing |
16 | 16 |
|
17 | | -Ver el checklist: [`RELEASING.md`](./RELEASING.md) |
| 17 | +See the checklist: [`RELEASING.md`](./RELEASING.md) |
18 | 18 |
|
19 | | -## Instalación (Gleam Packages) |
| 19 | +## Installation (Gleam Packages) |
20 | 20 |
|
21 | 21 | ```bash |
22 | 22 | gleam add minigui |
23 | 23 | ``` |
24 | 24 |
|
25 | | -### “Sin dependencias de build” (binario precompilado) |
| 25 | +### "Build-dependency-free" (precompiled binary) |
26 | 26 |
|
27 | | -Para evitar que tus usuarios tengan que instalar un compilador C o headers (`libx11-dev`, etc.), `minigui` está pensado para usar un **ejecutable precompilado** como puente (un *port*) y descargarlo automáticamente a `priv/` en el primer uso. |
| 27 | +To avoid requiring your users to install a C compiler or headers (`libx11-dev`, etc.), `minigui` is designed to use a **precompiled executable** as a bridge (a *port*) and download it automatically into `priv/` on first use. |
28 | 28 |
|
29 | | -Por defecto construye la URL así: |
| 29 | +By default it builds the URL like this: |
30 | 30 |
|
31 | 31 | ``` |
32 | 32 | https://github.com/Aztekode/minigui/releases/download/v<version>/<asset> |
33 | 33 | ``` |
34 | 34 |
|
35 | | -Donde `<version>` sale del `vsn` del paquete (ej. `0.1.0`) y `<asset>` depende del OS/arquitectura, por ejemplo: |
| 35 | +Where `<version>` comes from the package `vsn` (e.g. `0.1.0`) and `<asset>` depends on the OS/architecture, for example: |
36 | 36 |
|
37 | 37 | - `minigui.exe` (Windows x64) |
38 | 38 | - `minigui` (Linux x64) |
39 | 39 |
|
40 | | -Puedes sobreescribir la base de descargas con: |
| 40 | +You can override the download base with: |
41 | 41 |
|
42 | 42 | ```bash |
43 | 43 | MINIGUI_RELEASE_BASE_URL="https://github.com/Aztekode/minigui/releases/download/v0.1.0" |
44 | 44 | ``` |
45 | 45 |
|
46 | | -Si prefieres un enlace exacto tipo `.../minigui.exe`, puedes fijar la URL completa: |
| 46 | +If you prefer an exact link like `.../minigui.exe`, you can set the full URL: |
47 | 47 |
|
48 | 48 | ```bash |
49 | 49 | MINIGUI_PORT_URL="https://github.com/Aztekode/minigui/releases/download/v0.1.0/minigui.exe" |
50 | 50 | ``` |
51 | 51 |
|
52 | | -Opciones de seguridad/cache: |
| 52 | +Security/cache options: |
53 | 53 |
|
54 | | -- Por defecto, `minigui` **requiere** que exista `minigui(.exe).sha256` y valida el SHA256. |
55 | | -- `MINIGUI_REQUIRE_SHA=0`: desactiva la validación (no recomendado). |
56 | | -- El binario se cachea por usuario (Linux: `~/.cache/minigui/<version>/`, Windows: `%LOCALAPPDATA%\\minigui\\<version>\\`). |
| 54 | +- By default, `minigui` **requires** `minigui(.exe).sha256` to exist and validates the SHA256. |
| 55 | +- `MINIGUI_REQUIRE_SHA=0`: disables validation (not recommended). |
| 56 | +- The binary is cached per user (Linux: `~/.cache/minigui/<version>/`, Windows: `%LOCALAPPDATA%\\minigui\\<version>\\`). |
57 | 57 |
|
58 | | -> Requisito de runtime: una instalación “completa” de Erlang/OTP que incluya las aplicaciones estándar `inets` + `ssl` (normalmente ya vienen con OTP; en algunas distros Linux pueden venir en paquetes separados). |
| 58 | +> Runtime requirement: a "full" Erlang/OTP installation that includes the standard `inets` + `ssl` applications (they usually ship with OTP; on some Linux distros they may be split into separate packages). |
59 | 59 |
|
60 | 60 | ## Protocolo (v1) |
61 | 61 |
|
62 | | -El port se abre con `open_port(..., [{packet, 2}, binary, ...])`. |
| 62 | +The port is opened with `open_port(..., [{packet, 2}, binary, ...])`. |
63 | 63 |
|
64 | 64 | - Handshake: |
65 | 65 | - `0x00` `HELLO` + `u16 version` |
66 | 66 | - `0xF0` `HELLO_ACK` + `u16 version` + `u32 capabilities` |
67 | 67 |
|
68 | | -- Comandos: |
69 | | - - `0x10` `CREATE_WINDOW` + `u32 request_id` + título UTF-8 |
70 | | - - `0x11` `SET_LABEL` + `u32 request_id` + texto UTF-8 |
71 | | - - `0x12` `SET_TEXT` + `u32 request_id` + texto UTF-8 |
72 | | - - `0x13` `ADD_BUTTON` + `u32 request_id` + `u8 id` + etiqueta UTF-8 |
| 68 | +- Commands: |
| 69 | + - `0x10` `CREATE_WINDOW` + `u32 request_id` + UTF-8 title |
| 70 | + - `0x11` `SET_LABEL` + `u32 request_id` + UTF-8 text |
| 71 | + - `0x12` `SET_TEXT` + `u32 request_id` + UTF-8 text |
| 72 | + - `0x13` `ADD_BUTTON` + `u32 request_id` + `u8 id` + UTF-8 label |
73 | 73 | - `0x14` `RUN` + `u32 request_id` |
74 | 74 | - `0x15` `QUIT` + `u32 request_id` |
75 | | -- Respuestas: |
| 75 | +- Responses: |
76 | 76 | - `0x70` `OK` + `u32 request_id` |
77 | | - - `0x71` `ERR` + `u32 request_id` + mensaje UTF-8 |
78 | | -- Eventos: |
| 77 | + - `0x71` `ERR` + `u32 request_id` + UTF-8 message |
| 78 | +- Events: |
79 | 79 | - `0x81` `BUTTON_CLICKED` + `u8 id` |
80 | 80 | - `0x82` `CLOSED` |
81 | | - - `0x83` `LOG` + texto UTF-8 |
82 | | - - `0x84` `TEXT_CHANGED` + texto UTF-8 |
| 81 | + - `0x83` `LOG` + UTF-8 text |
| 82 | + - `0x84` `TEXT_CHANGED` + UTF-8 text |
83 | 83 | - `0x85` `KEY_DOWN` + `u32 keycode` |
84 | | - - `0x86` `ERROR` + texto UTF-8 |
| 84 | + - `0x86` `ERROR` + UTF-8 text |
85 | 85 |
|
86 | | -## Compilar (Linux) |
| 86 | +## Build (Linux) |
87 | 87 |
|
88 | | -Requisitos: `gcc`, `make`, `pkg-config`, `libgtk-3-dev`, `Erlang/OTP`, `gleam`. |
| 88 | +Requirements: `gcc`, `make`, `pkg-config`, `libgtk-3-dev`, `Erlang/OTP`, `gleam`. |
89 | 89 |
|
90 | | -> Probado con **Gleam v1.17.0**. |
| 90 | +> Tested with **Gleam v1.17.0**. |
91 | 91 |
|
92 | 92 | ```bash |
93 | 93 | make port |
94 | 94 | gleam build |
95 | 95 | make demo |
96 | 96 | ``` |
97 | 97 |
|
98 | | -Si estás en un entorno sin servidor X (CI/headless), fuerza el modo simulado: |
| 98 | +If you're in an environment without an X server (CI/headless), force simulated mode: |
99 | 99 |
|
100 | 100 | ```bash |
101 | 101 | MINIGUI_HEADLESS=1 make demo |
102 | 102 | ``` |
103 | 103 |
|
104 | | -## Compilar (Windows) |
| 104 | +## Build (Windows) |
105 | 105 |
|
106 | | -1. Compila `c_src/minigui_port.c` a `priv/minigui_port.exe` (MSVC o mingw). |
107 | | -2. Ejecuta el demo: |
| 106 | +1. Compile `c_src/minigui_port.c` to `priv/minigui_port.exe` (MSVC or mingw). |
| 107 | +2. Run the demo: |
108 | 108 |
|
109 | 109 | ```powershell |
110 | 110 | gleam build |
111 | 111 | gleam run -m demo |
112 | 112 | ``` |
113 | 113 |
|
114 | | -> Nota: el código Win32 está dentro de `#ifdef _WIN32`. |
| 114 | +> Note: the Win32 code is inside `#ifdef _WIN32`. |
0 commit comments