Documentation

Aero Client Docs

How Aero is built, the window.__AERO__ script API, and everything you need to write userscripts that run cleanly inside the client.

Overview & Architecture

Aero Client is an Electron (Chromium) app around kirka.io. Before any page JavaScript runs, the client injects a single initialization script into the game page's own JavaScript world. That script:

  • Creates the global window.__AERO__ object (settings, helpers, UI toolkit, script-settings registry).
  • Sets up SPA navigation detection, the client's keyboard shortcuts, raw mouse input, and Alt+F4.
  • Defines the Menu class (the in-game client menu) and the game preload logic.

The rest runs natively in the client, outside the page: the resource swapper, links that try to open a new window (sent to your browser unless they're game links), the screenshot hotkey, Discord activity, and updates.

Userscripts are not part of this init script. They are loaded separately at runtime: the game preload asks the client for the scripts, then evals the ones that are enabled. Enabling or disabling a script does not require rebuilding or restarting the client.

Two kinds of scripts

  • Imported scripts — .js files the user drops into a folder on their computer.
  • Bundled "Base" scripts — scripts shipped inside the client. They always appear and cannot be deleted by the user.

Both kinds behave identically at runtime and use the same APIs.

Folder Layout

All user data lives under the OS Documents directory:

paths
Documents/AeroClient/
├─ settings.json      # client settings (source of window.__AERO__.settings)
├─ scripts/          # imported userscripts (.js) — one file = one script
├─ CSS/              # custom game stylesheets (.css), managed by the CSS tab
└─ swapper/assets/   # resource-swapper replacement files

The scripts and CSS folders are created automatically the first time the menu loads. The client menu has buttons to open each folder: Open Swapper Folder and Open Scripts Folder under Settings → Client, and Open Folder on the CSS tab.

A file in swapper/assets/ replaces the game asset at the same path — e.g. swapper/assets/img/foo.png replaces https://kirka.io/assets/img/foo.png. The folder is read when the client starts, so restart after adding or changing files.

Installing a Script

  1. Open the client menu (Right Shift by default) and click Open Scripts Folder under Settings → Client (or browse to Documents/AeroClient/scripts/).
  2. Drop your .js file in. One file is one script.
  3. Reload the page (F5 by default) — the menu reads the folder when the page loads.
  4. On the Mods tab, the script appears as a card with a New badge. Flip its switch on — it runs immediately, no refresh needed.
Base scripts ship with the client and always appear under the Base filter. Imported files show under Imported.

File Format & Metadata Header

A script is a plain .js file. The loader reads an optional metadata header from the first 15 lines. Each line must start exactly with // @tag — two slashes, one space, then the tag:

  • // @name <text> — display label on the Mods card. If omitted, the filename without .js is used.
  • // @category <text> — grouping label, shown on the card. If omitted, defaults to Imported. Only the value HUD is special-cased by the menu filters.
  • // @author <text> — shown on the card as "by <author>". If omitted, the author shows as unknown.

Other common userscript headers (// @version, // @description, // @match, // @run-at) are ignored by the loader — they're conventional/cosmetic only. The client decides when and where scripts run, not the @match/@run-at directives. A // ==UserScript== … // ==/UserScript== block is conventional but not required.

Filename is the identity. The filename — including the .js extension and exact spacing/casing (e.g. Custom Skin Link.js) — is the stable identifier used everywhere: in the enabled/favorite/seen lists, and as the key for registering a settings panel.

Lifecycle, Timing & Execution Context

  • When: scripts run after DOMContentLoaded in the game window, once the client has fetched the live settings. window.__AERO__ is already fully available.
  • How often: once per full page load. kirka.io's in-app navigation (lobby → game → profile…) does not re-run scripts — listen for aero-url-change instead.
  • How: each enabled script's source runs via indirect eval in the global scope. Wrap your script in an IIFE. 'use strict' is fine.
  • Which: only scripts whose filename is in the enabled_scripts setting are executed. Disabled scripts never run.
  • Live enable: switching a script ON runs it immediately (no refresh) by dispatching an event carrying the script's source.
  • Live disable caveat: switching OFF only removes it from the enabled list — code that already ran stays active until refresh (F5). Scripts needing clean teardown should no-op when disabled or instruct the user to refresh.
  • Host allowlist: the preload only initializes on kirka.io, snipers.io, ask101math.com, fpsiogame.com, cloudconverts.com.
  • Error isolation: an exception while running a script is caught and logged to the console as [Aero] Error in user script <filename>; it won't crash the client.
No DOMContentLoaded listeners. Because scripts run after that event, listeners attached to it never fire. kirka.io is a Vue SPA, so most in-game elements appear later — use a MutationObserver or polling to wait for the game DOM.

Your First Script

Wrap everything in an IIFE and wait for the SPA DOM with a MutationObserver instead of DOMContentLoaded:

javascript
// @name        My First Script
// @category    HUD
// @author      you

(function () {
  'use strict';

  // Scripts run after DOMContentLoaded — game DOM may not exist yet.
  const obs = new MutationObserver(() => {
    const hud = document.querySelector('#app .game-hud');
    if (!hud) return;
    obs.disconnect();

    // build your feature here
    const tag = document.createElement('div');
    tag.textContent = 'Hello from Aero';
    hud.appendChild(tag);
  });
  obs.observe(document.body, { childList: true, subtree: true });
})();

Base vs Imported Scripts & Precedence

The client returns a combined list: bundled built-ins first, then imported folder scripts.

  • Precedence: if a folder file has the same filename as a bundled built-in, the folder file is skipped — the shipped version always wins. Users can't shadow a base feature by dropping a same-named file.
  • Built-ins are flagged builtin: true, show a small Base badge, and appear under the Base filter. Imported scripts appear under Imported.

Currently shipped base scripts

  • Custom Skin Link.js — replace the player skin with your own image link.
  • CustomServerPreset.js — build, save and apply custom room-creation presets.
  • gun_scale_modifier.js — per-weapon gun size and X/Y/Z position, with keybinds to scale in-game.
  • no_weapon_bob.js — removes the walk/idle bob from the held gun.
  • no_reload_animation.js — holds the gun still while reload/draw animations play.

The last three adjust the held gun in a fixed order, so all three can be enabled together.

Per-script entry the menu receives

  • name — the filename (stable key).
  • label — display name (from @name or filename).
  • content — the script source.
  • category — from @category or Imported.
  • author — from @author or unknown.
  • builtin — true for shipped base scripts, false for folder scripts.

The window.__AERO__ Global

Properties and methods available to every script:

  • settings — live object of the client's current settings. Read it for client state (e.g. base_url, menu_keybind, menu_theme, feature toggles); the menu updates it in place as the user changes settings.
  • version — the client version string.
  • logos — { mark, wordmark }: the Aero logos as PNG data URIs (the menu is injected into a remote page, so local asset paths can't be used).
  • menuHTML, menuCSS — raw markup/styles for the client menu (used internally).
  • invoke(command, args) — runs a client command and returns a Promise. See Client Commands.
  • listen(event, callback) — subscribes to an event pushed by the client (e.g. notification); returns a function that unsubscribes.
  • scriptSettings — internal registry mapping a script filename to its settings-panel builder.
  • registerScriptSettings(name, builder) — register a settings panel for a script.
  • ui — the UI toolkit for building native-looking settings panels.

Adding a Settings Panel

A script can add a settings panel that opens from the Settings button on its Mods card. Call window.__AERO__.registerScriptSettings(name, builder):

  • name — must exactly equal the script's filename, including .js and any spaces/casing (e.g. gun_scale_modifier.js). This is how the menu matches a panel to a card.
  • builder — a function called as builder(panel, ui) each time the user opens the panel.

Always guard the call so the script also works outside the client:

javascript
(function () {
  const KEY = 'myscript_glow';

  function build(panel, ui) {
    ui.note(panel, 'Configure My First Script.');
    ui.toggle(
      panel,
      'Enable glow',
      localStorage.getItem(KEY) === '1',
      (on) => localStorage.setItem(KEY, on ? '1' : '0'),
      'Adds a glow to the HUD.'
    );
    ui.slider(panel, 'Glow strength', localStorage.getItem('myscript_strength') || 50,
      (v) => localStorage.setItem('myscript_strength', v),
      { min: 0, max: 100, unit: '%' });
  }

  if (window.__AERO__ && window.__AERO__.registerScriptSettings) {
    window.__AERO__.registerScriptSettings('My First Script.js', build);
  }
})();

How the settings view behaves

  • The settings view opens in place inside the Mods tab (with a back arrow), not as a popup.
  • panel is that view's body; it is cleared before each open, and builder runs fresh every time. Don't cache DOM nodes across opens.
  • Each row you add shows as its own bordered card, in the menu's current theme.
  • ui is the same object as window.__AERO__.ui.
  • If the script is currently disabled, the menu shows "Enable this script to configure it." instead of calling your builder.
  • If a script has no registered panel, the menu explains how to edit the file and offers an Open Scripts Folder button.
  • If your builder throws, the menu shows "This script's settings failed to load." and logs the error.

Scripts persist their own state in localStorage — the UI toolkit does not auto-persist; your onChange callbacks decide what to store.

The ui Toolkit

All builders append to a parent element and return the created control (or a small object). Styling comes from the client's menu CSS, so panels match the menu and follow its Dark / Light / Graphite theme. Call them as methods (ui.toggle(…)) — they use this internally, so don't destructure them.

  • el(tag, props) — document.createElement(tag) with props assigned onto it (e.g. { className: 'btn-outline', textContent: 'Go' }). Returns the element.
  • note(parent, text) — appends a small muted paragraph. Returns the <p>.
  • row(parent, label, control, sub) — a standard setting row: a label (with optional sub description) on the left and control on the right. Returns the row. The other builders use it; use it directly for custom controls. (Insert your own element before the row's .setting-info to add e.g. an icon/thumbnail on the left.)
  • toggle(parent, label, checked, onChange, sub) — an on/off switch row. onChange(newChecked). Returns the checkbox input.
  • text(parent, label, value, onChange, opts) — a text input row. onChange(value) fires when the user commits the value (blur or Enter), not on every keystroke. opts: type (default text), placeholder, sub, image: true (adds a live image preview for URL/base64 fields). Returns the input.
  • imagePreview(url) — returns { wrap, set(url) }: wrap is the preview element to insert; set('') clears it; empty/broken images show "No image"/"Invalid image".
  • slider(parent, label, value, onChange, opts) — a range slider row with the current value shown beside it. onChange(value) fires continuously while dragging (the value is a string). opts: min, max, step, sub, unit (appended to the shown value, e.g. '%'). Returns the input.
  • select(parent, label, options, value, onChange, sub) — a dropdown. options is an array of strings, or [value, label] pairs. Returns the select.
  • button(parent, label, onClick) — an outline button sized to its label. Returns the button.
  • keybind(parent, label, value, onChange, sub) — a "press a key" capture button. Captures event.key (e.g. a, Space, ArrowUp) — different from the client's own hotkeys, which store event.code. Returns the button.

Most helpers return the underlying control element so you can further tweak styles/attributes after creation.

Persisting Data & Events

Persisting script state

  • Scripts manage their own persistence with localStorage — the UI toolkit saves nothing automatically.
  • Namespace your keys with a script-specific prefix to avoid collisions (e.g. csl_…, gsc_…, nra_…, kirka_room_presets).
  • localStorage persists across sessions and refreshes.

Client settings

  • Read client settings via window.__AERO__.settings.
  • Change a client setting with invoke('update_setting', { key, value }) (for client settings — most scripts just use localStorage for their own state). This saves to disk only: it doesn't update window.__AERO__.settings or fire aero-settings-changed, so do both yourself if the change should apply right away.

Events

Dispatched on document:

  • aero-settings-changed — a client setting changed; detail is { setting, value }.
  • aero-run-script — a script was enabled live; detail is { name, content }.
  • aero-css-folder-changed — the enabled Custom CSS changed; detail.content is the combined CSS of every enabled file (empty when none).

Dispatched on window:

  • aero-url-change — SPA navigation; detail is { url }. React to entering lobby/game/servers/profile/market/friends.
javascript
window.addEventListener('aero-url-change', (e) => {
  if (e.detail.url.includes('/profile')) {
    // re-apply your feature for this view
  }
});

Scripts may also define and dispatch their own CustomEvents to coordinate between a settings panel and an in-page panel.

Client Commands (invoke)

Call via window.__AERO__.invoke(command, args) → Promise. Commands are only accepted from the client's own game window, on the allowed game hosts.

  • Settings: get_settings, update_setting ({ key, value } — unknown keys are ignored, and a value of the wrong type is rejected), reset_settings (resets everything and restarts the client).
  • Scripts/CSS: get_scripts, open_scripts_folder, get_css_files, open_css_folder, import_css ({ name, content } — never overwrites; returns the saved filename), delete_css ({ name } — moves the file to the Recycle Bin / Trash).
  • Swapper: open_swapper_folder.
  • Window/app: get_version, toggle_devtools, toggle_fullscreen, navigate ({ url }), close_app, restart_app, launch_game, check_for_updates.
  • Clipboard: get_clipboard_text, set_clipboard_text ({ text }).
  • System: open_external ({ url } — http, https and mailto links only), set_autostart ({ enable }), update_rpc_state ({ url }).
  • Importing from other clients: list_import_sources, import_client ({ id }).
javascript
const settings = await window.__AERO__.invoke('get_settings');

window.__AERO__.invoke('update_setting', {
  key: 'menu_keybind',
  value: 'KeyP'
});

Most scripts only ever need update_setting/get_settings (and rarely open_scripts_folder). Everything else is used by the client's own menu.

CSS Classes & Variables

The menu's styles are scoped to elements inside an .aero root — the menu itself, its dialogs, and your settings panel. Use these classes so your UI matches the client:

  • Layout/rows: setting-row, setting-row.col (stacked), setting-info, setting-label, setting-desc, apply-badge (small tag beside a label).
  • Controls: switch (a <label class="switch"> holding a checkbox and a <span class="switch-track">), text-input, range (inside a range-wrap with an <output>), select, keybind.
  • Buttons: btn-outline (and btn-outline.danger), btn-icon, btn-ghost (.active for the selected pill).
  • Image fields: config-image-row, image-preview, image-preview-empty.
  • Cards: css-card, css-card-header, css-actions.

Color custom properties are full colors — use them directly, e.g. color: var(--muted):

  • --text — primary text.   --muted — secondary text.
  • --bg — menu background.   --panel — row/card background.   --field — input/control background.   --line — borders.
  • --accent, --on-accent — selected/"on" background and the text on it.
  • --danger — destructive actions.

The values follow the Client Theme (dark, light or graphite, from settings.menu_theme). To give a panel of your own outside the menu the same look, put it in an element with class="aero" and data-theme set to the theme.

Practical tips: text-input is 220px wide by default — set flex: 1 to fill a row. btn-outline sizes to its label. For a compact multi-select, style small toggle "chips" with var(--field)/var(--muted) for off and var(--accent)/var(--on-accent) for on.

Mods & CSS Tabs

The Mods tab lists the client's built-in features first, then every script. Each card shows:

  • The label, with a New badge if the script is new since the last page load and a Base badge if it's bundled.
  • Its category and author (built-in features say "Built in").
  • A switch to turn it on or off.
  • A favorite (heart) button (scripts only) — toggles membership in the favorites list.
  • A Settings button (scripts, Custom Hitmarker and Custom Kill Icon) — opens the in-place settings view (registered panel, or the "how to edit" fallback).

Built-in features: Permanent Crosshair, K/D Indicator, Custom Hitmarker, Custom Kill Icon, Market Names, Custom List Price, and the Pack/Chest Opener.

Enable/disable

  • Flipping a script's switch changes its membership in the enabled list and re-renders the card.
  • Enabling runs the script live (dispatches aero-run-script); disabling removes it from the list (running code persists until refresh).
  • The Settings button and the switch are independent: Settings opens the panel, the switch never navigates.

Filters

  • All — everything.   New — scripts that are new since the last page load.
  • HUD — cards whose category is HUD.   Base — bundled built-ins.   Imported — user folder scripts.
  • A favorites-only filter and a grid/list layout toggle are available. Search filters cards by name.

CSS tab

  • Lists every .css in Documents/AeroClient/CSS/, with a preview of its code. Import copies files in (never overwriting).
  • Any number of files can be enabled at once; they're applied to the game in folder order, live.
  • Download saves a copy; Remove moves the file to the Recycle Bin / Trash.
  • Custom CSS styles the game only — the menu's look is set by the Client Theme.

Relevant settings lists (arrays of filenames): enabled_scripts, favorite_scripts, seen_scripts (and for CSS: enabled_css, favorite_css).

Gotchas & Best Practices

  • Filename = identity. The name passed to registerScriptSettings must exactly match the filename (with .js, spaces, and case).
  • New files need a reload. The menu reads the scripts and CSS folders when the page loads.
  • No DOMContentLoaded. Scripts run after it. Set up immediately and use observers/intervals for late-loading SPA DOM.
  • Wrap in an IIFE. Scripts share global scope; avoid leaking globals and name collisions.
  • The settings builder re-runs and the panel is wiped each open. Rebuild your UI every call; don't hold references between opens.
  • Don't throw in the builder — it's caught, but your panel won't render.
  • Disabling doesn't tear down. If your script patches globals or adds observers, guard behavior behind a live localStorage/setting check, or tell users to refresh after disabling.
  • Persist with localStorage, namespaced per script.
  • update_setting only saves. Update window.__AERO__.settings and dispatch aero-settings-changed yourself if the change should apply now.
  • Keybind capture uses event.key, not event.code.
  • Built-ins win over same-named folder files.
  • Categories: only HUD is special in filters; pick it if your script is a HUD feature.

Updating Older Scripts

Scripts that only use the ui toolkit need no changes. Scripts that build their own elements with the menu's old class names or color variables should switch to the current ones:

  • setting → setting-row  ·  setting.column → setting-row col  ·  setting-header → setting-label  ·  setting-sub → setting-desc
  • checkbox → switch  ·  change-keybind → keybind  ·  aero-button → btn-outline
  • rgba(var(--light), 1) → var(--text)  ·  --lgray → var(--muted)  ·  --dgray → var(--field)  ·  --border → var(--line)
  • --cyan / --en-bg → var(--accent)  ·  --en-text → var(--on-accent)  ·  --close-bg → var(--danger)
  • window.__AERO__.logo → window.__AERO__.logos.mark

Bundling a Base Script (maintainers)

For maintainers shipping a script with the client rather than as a user import:

  1. Place the .js file in the client's src/scripts/ folder.
  2. Add its exact filename to the BUILTIN_SCRIPTS list in src/main/commands.js. The list order is the run order.
  3. It ships with the next build. It will then always appear under the Base filter, take precedence over any same-named folder file, and behave exactly like an imported script otherwise.
Questions or want to publish a script? Join the Discord.