Repository navigation
v1.4.1 — Hardened Web Studio API, Safer init/uninstall, Battery Status & v1.4.0 Features
🚀 What's New in WezTerm Studio v1.4.1
Heads-up: this is the first PyPI release since
v1.3.0. It ships everything fromv1.3.1andv1.4.0(never published on their own), plus a security and reliability hardening pass over the Web Studio API,init/uninstall, and every file the tool writes.
🔒 Security: Hardened Web Studio API (wezterm-theme web)
Before this release, any web page open in your browser could POST to http://127.0.0.1:7777 (a text/plain "simple request" needs no CORS preflight) and rewrite your WezTerm config, including the command launched by file:line links (editor_cmd). Every request is now checked:
- Host allowlist: a loopback-bound server only answers loopback
Hostnames on its own port, which blocks DNS rebinding. - JSON only:
POSTrequiresContent-Type: application/json(415otherwise). That forces a CORS preflight, which the server never approves. - Origin check: an
Originheader, when present, must match theHost(403otherwise). - Per-process session token: injected into the page as
<meta name="studio-token">and sent back asX-Studio-Token(403when missing or wrong). - Response headers:
X-Frame-Options: DENY,Content-Security-Policy: frame-ancestors 'none',Referrer-Policy: no-referrerandX-Content-Type-Options: nosniff. Request bodies are capped at 5 MB. - Clean errors: bad input (for example
theme_id: "abc"or invalid JSON) returns a400JSON error, and unexpected failures return500instead of an empty reply.--host <non-loopback>prints a prominent warning.
🧩 Safer init / uninstall with a Lua-aware Scanner
- Exact handler matching: conflicting
wezterm.on('format-tab-title', …)handlers are now found by a scanner that skips comments and strings and balances parentheses.initdisables only that call. It no longer swallows unrelated config after named handlers, breaks on nested closures such aspcall(function() … end), or re-comments the same handler on every run. - Handlers re-enabled on uninstall:
uninstallrestores the handlers thatinitdisabled, including blocks written by≤ 1.4.0, so runninginitand thenuninstallgives back the originalwezterm.luabyte for byte. Pass--keep-disabled-handlersto opt out. - Hook lookup:
- The hook now tries the absolute module path first, which fixes
~/.wezterm.luacombined with a custom$XDG_CONFIG_HOME. - Load failures are logged with
wezterm.log_errorandlog_warninstead of being swallowed. - Re-running
initupgrades an outdated hook in place.
- The hook now tries the absolute module path first, which fixes
💾 Config Integrity, Atomic Writes & Backups
settings.jsonis never clobbered: a hand-edited loader file that fails to parse (one trailing comma is enough) used to be silently replaced. Now nothing is written, and you get the file, line and column of the error.wezterm_theme.jsongets the same protection.- Atomic writes: every managed file is written through a temp file,
fsyncandos.replace, so WezTerm never reloads a half-written config.- Symlinked dotfiles (stow, chezmoi) are followed instead of being replaced.
- The existing file mode is preserved.
- On Windows, the write retries while WezTerm holds the file.
- Serialized changes: concurrent Web Studio clicks can no longer mix JSON and Lua from different themes, or roll back each other's writes.
- One validation path: every appearance setting (CLI, TUI, Web Studio, presets) is checked once, covering types, ranges,
#rrggbbcursor colors and control characters. Lua strings now escape control characters as well. - Missing
weztermis reported: when noweztermbinary is found, you now get a warning that validation was skipped (it used to be silent), and a non-zero exit fromweztermcounts as a failure. - Backups:
- Restoring by exact filename (the Web UI used a list index that shifted).
- Cross-mode restores (standalone ↔ loader) no longer overwrite the wrong JSON.
- Automatic backups are pruned: the newest 10
pre_restorecopies are kept, plus the newest 10wezterm.luabackups and the pristinepre_init. Labeled backups are never pruned. - Backups taken in the same second never collide.
- Preset import: importing a long JSON preset no longer fails with
ENAMETOOLONGon Python ≤ 3.12. - Color-scheme cache: the cache is now rebuilt after a WezTerm upgrade.
🔋 Battery Status with Level & Charging Icons
-
The Studio right-status bar now maps
state_of_chargeto 11 Nerd Font battery glyphs (→), shows a charging icon (), and color-codes the level:State Color Charging or Full emerald #34d399AC hold mint #86efac≤ 30% amber #fbbf24≤ 15% bold crimson #f87171
✨ From v1.3.1 & v1.4.0: Frosted Glass, OLED, Sessionizer, Session Snapshots & GPU Tuner
- Frosted-glass blur across platforms with
--blur 0-100. It usesmacos_window_background_bluron macOS,kde_window_background_bluron KDE andwin32_system_backdropon Windows 11. - Background and cursor overrides:
- An OLED
#000000background override. - A custom cursor color that keeps WCAG contrast.
- Automatic
Symbols Nerd Font Mono+ Emoji fallback chains.
- An OLED
- Workspace switcher: a zero-dependency switcher for
zoxideand Git projects. - Session snapshots: save and restore workspaces to
wezterm_session.jsonfromCtrl+Shift+P, the CLI (wezterm-theme session) or the Web Studio. - GPU and rendering tuning:
front_end(WebGpu/OpenGL/Software),max_fps,animation_fpsand Wayland controls.- DevOps
quick_select_patterns(Ctrl+Shift+Space). - CPU and Software-renderer diagnostics in
wezterm-theme doctor.
- Conflict detection:
wezterm-theme doctor,initand the Web Studio detect conflictingformat-tab-titlehandlers, and the Web Studio offers a Fix Automatically button. - Web Studio layout: fixed card and button overflow on narrow and multi-column grids.
⚠ Upgrade Notes
- Run
wezterm-theme initonce to upgrade an existing hook to the absolute-path version. Older hooks keep working in the meantime. - Reload any open Web Studio tab after upgrading.
POSTrequests now need the session token embedded in the page. - Changes are serialized only inside one process. A CLI command run while
wezterm-theme webis running is not serialized with the server.
📦 Upgrade / Install
pipx upgrade wezterm-theme
# or: uv tool upgrade wezterm-theme
# or: pip install --upgrade --user wezterm-theme🙏 Credits & Community Inspirations
rootiest/battery.wez&r/weztermstatus-line setups: battery level and charging icons with color alerts.@MLFlexer(smart_workspace_switcher.wezterm,resurrect.wezterm),@mikkasendke(sessionizer.wezterm) &YedPool/Wezurrect: fuzzy workspace switching and session snapshot persistence.@michaelbrusegard(awesome-wezterm): curated index of the WezTerm plugin ecosystem.@jaik3n(WezTerm Discussion #7422): OLED#000000background and custom cursor overrides.- The WezTerm community on
r/wezterm,r/unixporn& Discussion #628: frosted-glass blur, Nerd Font fallback chains, Quick Select patterns, and GPU and Wayland FPS tuning.
Full Changelog: v1.3.0...v1.4.1