Add self-update, version 1.0.1

ghosttyconf --update installs the newest release from git.micw.org,
--check-update only checks. The download lands next to the running
binary, is started once with --version and only then replaces it.

Once a day a normal start asks in the background and mentions a newer
release in the header, at the top of the help and on stderr after
quitting; only on a terminal and not with GHOSTTYCONF_NO_UPDATE_CHECK
set. selfupdate.go is nscan's copyable template, with goca's --update
spelling in the hints.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mikeandClaude Opus 5.5 committed 2026-10-28 10:22:51 +01:00
1 parent e5750ef24b
commit fb5602452a
13 files changed
+818 -11

No files matched your search

+30
View File
@@ -12,6 +12,7 @@ the [README](../README.md).
- [Key bindings](#key-bindings)
- [Saving](#saving)
- [Reloading Ghostty](#reloading-ghostty)
- [Updating ghosttyconf](#updating-ghosttyconf)
- [Troubleshooting](#troubleshooting)
## Which file is edited
@@ -279,6 +280,29 @@ The documentation of an option mentions this where it matters.
Use `--no-reload` to only save. The status line then reminds you of the
shortcut.
## Updating ghosttyconf
`ghosttyconf --update` installs the newest release from
[git.micw.org](https://git.micw.org/mike/ghosttyconf/releases) in place of the
running binary, and `ghosttyconf --check-update` only looks. The update:
1. asks for the newest release that is neither a draft nor a prerelease,
2. downloads `ghosttyconf-<os>-<arch>` next to the running binary and checks
its size,
3. starts the download once with `--version` and expects the new version
number,
4. renames it over the old binary. A symlink stays and the file behind it is
replaced.
If any step fails, the old binary stays as it was.
Once a day, a normal start also asks in the background, without delaying the
start. A newer release then shows up on the next start, in yellow on the
right of the header and at the top of the help (`?`), and once more as a line
in the terminal after you quit. Nothing is installed on its own. The check
stays quiet when stderr is not a terminal, and `GHOSTTYCONF_NO_UPDATE_CHECK=1`
turns it off.
## Troubleshooting
**"Ghostty refused the AppleScript command"**: your config sets
@@ -296,6 +320,12 @@ Ghostty release, see [Development](development.md#updating-for-a-new-ghostty-rel
**A key combination can't be recorded**: Ghostty or macOS handled it before
ghosttyconf could see it. Type it into the trigger field.
**"cannot write to …" on `--update`**: ghosttyconf lives in a directory you
can't write to, such as `/usr/local/bin`. Run `sudo ghosttyconf --update`.
**`--update` is an unknown flag**: that is version 1.0.0, from before
self-update. Download the newest release by hand once.
**Validation fails for an entry you didn't touch**: the problem was already
in your file. ghosttyconf marks invalid values in red. Fix or reset them, or
save anyway.