Logo di Forge Auto Widget Layout

Forge Auto Widget Layout

Community
Nebulavenus
forge-auto-widget-layout

Add automatic widget layout to a ForgeUiContext application. Replace manual rect calculations with a stack-based cursor model supporting vertical/horizontal directions, padding, spacing, and nesting.

Panoramica

AutoreNebulavenus
Repositoryforge-gpu
Nome della skillforge-auto-widget-layout
Stelle
46
Fork
7
File inclusi
Solo istruzioni
LicenzaZlib
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • Tutto nelle istruzioni

    Tutto ciò che serve al modello è nelle istruzioni: nessun file aggiuntivo da sincronizzare.

  • Open source

    Pubblicata da Nebulavenus su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Forge Auto Widget Layout in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-auto-widget-layout
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Nuova skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella nella cartella delle skill di quell'agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Nebulavenus/forge-gpu.git /tmp/forge-gpu
mkdir -p .claude/skills
cp -r /tmp/forge-gpu/.claude/skills/forge-auto-widget-layout .claude/skills/forge-auto-widget-layout
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Forge Auto Widget Layout in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Forge Auto Widget Layout non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Forge Auto Widget Layout non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

Add automatic widget positioning to any application that uses ForgeUiContext. Based on UI Lesson 08.

When to use

  • You have an immediate-mode UI with manually computed widget rects and want to automate placement
  • You need a vertical panel of stacked widgets (labels, checkboxes, sliders)
  • You need a horizontal row of buttons or controls side by side
  • You need nested layouts (a vertical panel containing a horizontal button row)
  • You want to change padding or add/remove widgets without recalculating every rect by hand

Key API calls

  • forge_ui_ctx_layout_push(ctx, rect, direction, padding, spacing) — push a layout region onto the stack
  • forge_ui_ctx_layout_pop(ctx) — pop and return to the parent layout
  • forge_ui_ctx_layout_next(ctx, size) — return the next widget rect and advance the cursor
  • forge_ui_ctx_label_layout(ctx, text, size, r, g, b, a) — label placed by the current layout
  • forge_ui_ctx_button_layout(ctx, id, text, size) — button placed by the current layout
  • forge_ui_ctx_checkbox_layout(ctx, id, label, value, size) — checkbox placed by the current layout
  • forge_ui_ctx_slider_layout(ctx, id, value, min, max, size) — slider placed by the current layout

Correct order

  1. Push a layout with a bounding rect, direction, padding, and spacing
  2. Declare widgets using _layout() variants — each call advances the cursor automatically
  3. For nested layouts: call layout_next() to reserve a sub-rect from the parent, then layout_push() inside that rect
  4. Pop nested layouts before continuing in the parent
  5. Pop the root layout when done

Every layout_push() must have a matching layout_pop() — including on error paths. Unmatched pushes are logged as warnings by forge_ui_ctx_end().

Key concepts

  1. Layout cursor — a position (x, y) that starts at the top-left content area (after padding) and advances after each widget
  2. Direction — FORGE_UI_LAYOUT_VERTICAL advances downward (widgets get full width, caller specifies height); FORGE_UI_LAYOUT_HORIZONTAL advances rightward (widgets get full height, caller specifies width)
  3. Padding — uniform inset from all four edges of the layout rect
  4. Spacing — gap inserted before each widget except the first
  5. Size parameter — the widget dimension along the layout's primary axis (height for vertical, width for horizontal); the cross-axis dimension is filled automatically
  6. Layout stack — up to FORGE_UI_LAYOUT_MAX_DEPTH (8) nested layouts
  7. Spacing-before-item model — spacing is added before each item (except the first), keeping remaining_h/remaining_w accurate

Common mistakes

  1. Forgetting layout_pop() — every push needs a pop on every code path, including early returns from failed nested pushes
  2. Using standard widget API inside a layout — use _layout() variants (button_layout, checkbox_layout) to get automatic positioning; the standard API (button, checkbox) still requires explicit rects
  3. Wrong size parameter — in a vertical layout, size is height; in a horizontal layout, size is width. Passing the wrong dimension produces unexpectedly stretched or squished widgets
  4. Not reserving a sub-rect for nested layouts — call layout_next(row_h) first to get the sub-rect, then push a new layout inside it. Pushing a layout with the full parent rect would overlap existing widgets
  5. Exceeding stack depth — layout_push() returns false if the stack overflows (8 levels max). Always check the return value

Ready-to-use template

Vertical panel with mixed widgets

c
#define PANEL_PADDING    16.0f   /* inset from panel edges */
#define WIDGET_SPACING    8.0f   /* vertical gap between widgets */
#define LABEL_HEIGHT     30.0f   /* height of a label row */
#define CHECKBOX_HEIGHT  28.0f   /* height of a checkbox row */
#define BUTTON_HEIGHT    34.0f   /* height of a button */
#define SLIDER_HEIGHT    32.0f   /* height of a slider */
#define BUTTON_SPACING   10.0f   /* horizontal gap between buttons */

ForgeUiRect panel = { x, y, w, h };

/* Draw panel background */
forge_ui__emit_rect(ctx, panel, bg_r, bg_g, bg_b, bg_a);

/* Push vertical layout for the panel */
if (!forge_ui_ctx_layout_push(ctx, panel,
                              FORGE_UI_LAYOUT_VERTICAL,
                              PANEL_PADDING, WIDGET_SPACING)) {
    return;
}

/* Title label */
forge_ui_ctx_label_layout(ctx, "Settings", LABEL_HEIGHT,
                          title_r, title_g, title_b, title_a);

/* Checkboxes */
(void)forge_ui_ctx_checkbox_layout(ctx, ID_CB_1, "Option A",
                                   &option_a, CHECKBOX_HEIGHT);
(void)forge_ui_ctx_checkbox_layout(ctx, ID_CB_2, "Option B",
                                   &option_b, CHECKBOX_HEIGHT);

/* Horizontal button row */
ForgeUiRect btn_row = forge_ui_ctx_layout_next(ctx, BUTTON_HEIGHT);

if (!forge_ui_ctx_layout_push(ctx, btn_row,
                              FORGE_UI_LAYOUT_HORIZONTAL,
                              0.0f, BUTTON_SPACING)) {
    forge_ui_ctx_layout_pop(ctx);  /* pop outer before returning */
    return;
}

float btn_w = (btn_row.w - BUTTON_SPACING) * 0.5f;
(void)forge_ui_ctx_button_layout(ctx, ID_BTN_OK, "OK", btn_w);
(void)forge_ui_ctx_button_layout(ctx, ID_BTN_CANCEL, "Cancel", btn_w);

forge_ui_ctx_layout_pop(ctx);  /* end horizontal row */

/* Slider */
(void)forge_ui_ctx_slider_layout(ctx, ID_SLIDER, &value,
                                 0.0f, 100.0f, SLIDER_HEIGHT);

forge_ui_ctx_layout_pop(ctx);  /* end vertical panel */

Key observations

  • The 0.5f in btn_w is inherent math (dividing by 2), not a magic number
  • layout_next() returns a rect from the outer vertical layout, which becomes the bounds for the inner horizontal layout
  • The inner layout_push error path pops the outer layout before returning
  • Widget return values can be (void) cast when the result is not needed

Reference

Domande frequenti

Cosa fa la skill IA Forge Auto Widget Layout?

Add automatic widget layout to a ForgeUiContext application. Replace manual rect calculations with a stack-based cursor model supporting vertical/horizontal directions, padding, spacing, and nesting.

Perché usare Forge Auto Widget Layout su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Forge Auto Widget Layout è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Forge Auto Widget Layout in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/Nebulavenus/forge-gpu/tree/main/.claude/skills/forge-auto-widget-layout. TypingMind legge il file SKILL.md e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Forge Auto Widget Layout?

Qualsiasi modello che colleghi in TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Forge Auto Widget Layout?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Forge Auto Widget Layout: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Forge Auto Widget Layout è gratuita?

Sì. È pubblicata su GitHub da Nebulavenus con licenza Zlib. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, modelli o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇