Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: add +boo command #4876

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

cli: add +boo command #4876

wants to merge 1 commit into from

Conversation

rockorager
Copy link
Collaborator

@rockorager rockorager commented Jan 9, 2025

Add a +boo command to show the animation from the website. The data
for the frames is compressed during the build process. This build step
was added to the SharedDeps object because it is used in both
libghostty and in binaries.

The compression is done as follows:

  • All files are concatenated together using \x01 as a combining byte
  • The files are compressed to a cached build file
  • A zig file is written to stdout which @embedFiles the compressed
    file and exposes it to the importer
  • A new anonymous module "framedata" is added in the SharedDeps object

Any file can import framedata and access the compressed bytes via
framedata.compressed. In the boo command, we decompress the slice and
split it into frames for use in the animation.

The overall addition to the binary size is 348k.

@rockorager rockorager force-pushed the boo branch 3 times, most recently from f16cd47 to 9943f8f Compare January 9, 2025 16:54
@rockorager
Copy link
Collaborator Author

I thought maybe it was related to my updating of libvaxis (and maybe having multiple zg unicode copies available since zf uses vaxis also), but no...rolling that portion of the commit back yields exactly the same binary size.

@rockorager
Copy link
Collaborator Author

rockorager commented Jan 9, 2025

I also tried using the zig std.compress.zlib (which we use for kitty graphics already) namespace, even though this is using flate under the hood. No appreciable change in binary size (~10 bytes smaller)

@rockorager
Copy link
Collaborator Author

I also tried passing the build script the directory of the frames_*.txt and reading them, instead of embedding them in case somehow we were getting artifacts from that. No dice...same binary size.

@jcollie
Copy link
Collaborator

jcollie commented Jan 9, 2025

Would it make sense to add https://github.com/ghostty-org/website to build.zig.zon and get the frames from there, rather than copying them into the Ghostty source code? Won't help the binary size but seems "cleaner" to me.

@rockorager
Copy link
Collaborator Author

rockorager commented Jan 9, 2025 via email

@SohelIslamImran
Copy link

I think this should be totally optional and standalone, and shouldn't be included in the binary

@tristan957
Copy link
Collaborator

I think this should be totally optional and standalone, and shouldn't be included in the binary

Please explain why.

@rockorager rockorager force-pushed the boo branch 2 times, most recently from d4b6b33 to a3a674f Compare January 11, 2025 02:49
Add a `+boo` command to show the animation from the website. The data
for the frames is compressed during the build process. This build step
was added to the SharedDeps object because it is used in both
libghostty and in binaries.

The compression is done as follows:
- All files are concatenated together using \x01 as a combining byte
- The files are compressed to a cached build file
- A zig file is written to stdout which `@embedFile`s the compressed
  file and exposes it to the importer
- A new anonymous module "framedata" is added in the SharedDeps object

Any file can import framedata and access the compressed bytes via
`framedata.compressed`. In the `boo` command, we decompress the file and
split it into frames for use in the animation.

The overall addition to the binary size is 348k.
@rhodes-b
Copy link

I think this should be totally optional and standalone, and shouldn't be included in the binary

patches are always something optional you can apply as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants