t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Cold launch shows a blank window until the backend is ready

Open BareTread opened this issue 7 months ago • 2 comments

Cold launch shows a blank window until the backend is ready

What I'm seeing

On Linux/Wayland, the nightly build takes about 7 seconds from launch to usable UI on a cold start.

Once it appears, the app works normally. This is mostly a perceived startup issue: for several seconds it looks like nothing is happening.

Version / environment

  • T3 Code: 0.0.22.nightly.20260501.170-1
  • Package: t3code-bin from AUR, locally bumped to the current nightly release
  • OS: Arch Linux
  • Session: Hyprland / Wayland
  • Launch wrapper uses Wayland Ozone flags and --no-sandbox

What I found

I took a quick look inside the packaged app.asar. From what I can tell, the desktop process starts the local server first and then loads the renderer from the backend URL:

window.loadURL(backendHttpUrl)

So the rough startup path seems to be:

  1. Electron main starts.
  2. Main spawns apps/server/dist/bin.mjs.
  3. The server initializes its runtime / SQLite / PTY / HTTP listener.
  4. Main waits for the backend URL to be ready.
  5. The window loads the renderer from that URL.
  6. The UI appears.

That would explain the blank/quiet startup: the app cannot show the real renderer until the local server is ready.

I may be missing some context, but the window reveal logic itself looked intentional. It seems like the expensive part is waiting for the local backend before first paint, not the final show() call.

Suggestion

Would it make sense to show a tiny local loading page immediately, then swap to the backend renderer once it is ready?

Something along these lines:

window.loadFile('splash.html')
await waitForBackendWindowReady(backendHttpUrl)
window.loadURL(backendHttpUrl)

The splash page could be extremely plain: logo/name + “Starting T3 Code…” or similar. Even if the backend still takes the same 5–7 seconds, startup would feel much better because the user gets immediate feedback.

Things I checked that did not seem to be the main issue

  • Auto-updater: appears to happen after the window is already shown.
  • User config/cache: small in my case, about 37 MB.
  • GPU/AppImage extraction: does not look like the main bottleneck.

Happy to provide logs/timing if useful. This is pre-alpha, so totally understandable if this is just not high priority yet — filing because it seems like a small polish win with a big perceived-startup payoff.

BareTread avatar May 01 '26 11:05 BareTread

I also have it being around 7 seconds for startup which seems very slow:

t3code
[13:28:35.249] INFO (#3): runtime logging configured
  scope: desktop
  runId: [redacted]
  component: desktop-startup
  logDir: /home/[user]/.t3/userdata/logs

[13:28:35.252] INFO (#3): app ready
  scope: desktop
  runId: [redacted]
  component: desktop-startup

[13:28:35.256] INFO (#3): bootstrap start
  scope: desktop
  runId: [redacted]
  component: desktop-bootstrap

[13:28:35.261] INFO (#3): selected backend port via sequential scan
  scope: desktop
  runId: [redacted]
  component: desktop-bootstrap
  port: 3773
  startPort: 3773

[13:28:35.262] INFO (#3): bootstrap resolved backend endpoint
  scope: desktop
  runId: [redacted]
  component: desktop-bootstrap
  baseUrl: http://127.0.0.1:3773/

[13:28:35.263] INFO (#3): bootstrap ipc handlers registered
  scope: desktop
  runId: [redacted]
  component: desktop-bootstrap

[13:28:35.265] INFO (#3): bootstrap backend start requested
  scope: desktop
  runId: [redacted]
  component: desktop-bootstrap

[13:28:42.729] INFO (#39): backend ready
  scope: desktop
  runId: [redacted]
  component: desktop-window
  source: http

[13:28:42.765] INFO (#39): main window created
  scope: desktop
  runId: [redacted]
  component: desktop-window

Furyfree avatar May 14 '26 11:05 Furyfree

Desktop startup now renders an explicit splash/loading surface while the backend and initial snapshot become ready. The blank cold-start window described by the old load path has been replaced.

This was closed as part of a large repo-wide maintenance sweep. If you think it's still relevant, please reopen.

juliusmarminge avatar Jun 20 '26 00:06 juliusmarminge