正在加载视频...
视频加载失败
From empty repo to a functional minimal standalone terminal based on libghostty in 2 hours, presenting Ghostling! ~600 lines of C and you get extremely accurate, performant, and proven terminal emulation. Feature list: - Resize with text reflow - Full 24-bit color and 256-color palette support - Bold, italic,... show more
112,403 次观看 • 7 个月前 •via X (Twitter)
47 条评论

Made you a File City Tour of Ghostling A visual map + narrated walkthrough of the minimal standalone terminal emulator (~600 lines of C) built on libghostty (the core of Ghostty). Great work! @mitchellh

I'm pretty sure most Ghostty terminal users would wote on going for a stable Ghostty terminal before farming out doing new things. But up to you.

This is an extraction of Ghostty's core and is already widely used (see awesome-libghostty). It has led to multiple core bug fixes in Ghostty thanks to much broader use, so it is directly relevant to Ghostty's stability while also barely a new thing. Ghostty GUI is up to over 1 million daily active macOS users (based on update pings), up from 200K only 2 months ago. I don't have any way to know how many Linux users. Point being: its extremely stable and used all over. I can't track the usage of libghostty but libghostty is already used by some very large scale applications, so the ultimate reach of Ghostty's core is even larger. And every bug fixed there is a bug fixed in Ghostty. It is the rising tide that lifts all ships. I know you really enjoy jumping into my posts and being a dick but you can't get me down baby! This is super cool and I'm very excited to broaden the ecosystem.

Get a life. I'm just saying that you need to get the core working before you farm out to other things.

lol gEt a LiFe, you're the one who obsesses over my work and replies to my stuff. I'm married man. I know what you're saying, but you're just wrong, as usual. I'm sorry, it has to be hard to take so many Ls.

I have no idea on eartch what that triggered that response, but I'm pretty happy about it.

Just having fun man. That’s what it’s all about.

?????????

Did you use AI? I'm wondering because you pushed this out pretty quickly and there is a large volume of comments... but the code is neat and readable (which is unusual for AI-generated code).

I didn't write a single line of code. I reviewed it all though and consistently nudged the AI in the right direction. Heavy commenting is my personal style, and its especially good for a demo like this.

Disgusting.

Pretty cool, even raylib is there

Can I replace xterm.js yet?

~600 lines? That's impressive. But what if we can have more, in less than ~50 sLoC. Something fully cross-platform?

A comparable example could be made here. Most of the LoC is Raylib glue, libghostty-vt doesn't include a renderer, and C is more verbose than C++. Not quite an apples to apples comparison.

Of course. Ghostty and libghostty are excellent software, no doubt about that. My point was simply that sLoC isn’t a particularly meaningful way to judge software.

100% agree there, but people love to see it and I aim to please.

Built with Raylib! @raysan5

Shipping a minimal terminal in about 600 lines is a great demo of how much leverage a solid core library gives you. It is not just tiny, it keeps the behaviors people notice like reflow and solid emulation. Curious which pieces were still stubborn even with libghostty underneath.

Does it have persistent scrollback history, and a full or at least useful minimum, native desktop menubar? Because that would be a killer.

Love to see it

That's amazing! Congrats on building Ghostling in such a short amount of time, what an incredible achievement for a minimal terminal emulator!

Doesn’t support GUI interfaces with 3D rendered visuals. Can not recommend 🚫🤗

Mitchell this is pretty cool. It does seem to reproduce the issue I hit while carving my own headers out of zig directly: Quitting nvim for some reason takes considerable amount of time (fast, but noticeable.) Regular ghostty doesn't have this issue. BIzarre.

600 lines is tight, what tests cover Unicode grapheme edge cases?

I ended using SwiftTerm for instead of libghostty because the docs clearly states the API is still not stable.

SwiftTerm is great. The API is definitely not stable, I haven't tagged a release yet. But the implementation is super stable (since its been the core of Ghostty for years).

SwiftTerm has been wonderful! But I also love Ghostty. Both Claude and Codex advised me against going with libghostty because the unstable API 😂, I hope we get a release soon!

Oh shit, the LLMs are fucking me? Yeah I should start cleaning this up and ready to go so I can get into the training data.

this is awesome!

600 LoC Sounds like a cheat code Great work!

why I have a feeling that OpenAI or Anthropocene will acquire ghostty for massive $$$

@mitchellh This is impressive. The speed from empty repo to working terminal in 2 hours speaks to how solid libghostty API is. Zero dependency terminal emulation is the dream for many use cases.

Nice, I’m already successfully wrapping it with Rust FFI. Working great! 🔥

Is the goal of this to be a built-in terminals somewhere or just to test how easy it is to build something on top of libghostty?

Terminal emulation in 600 lines? This isn't just code. It's a philosophical statement about software complexity. What if minimalism is the real innovation?

I love how you are forward thinking enough to start a huge project in Zig But can still appreciate things like: "this demo is meant to showcase the minimal C API since C is so much more broadly used and accessible to a wide variety of developers and language ecosystems."

Soo good what the vision next

👏👏👏👏

Impressive, can’t resist to read the old-good C code to learn how to use libghostty. Love Zero dependency not even libc.

600 lines of C doing what bloated Electron apps need 60MB for — beautiful. btw bookmarks are a fake signal. i read X's source code and posted proof on my timeline

yep. the fastest way to prove a platform is ready is to build something tiny but real on top of it and let it hit the weird edges.

is this a precursor to a better tmux in ghostty?

for the people who miss the point: ghostty is a wrapper around libgostty ghostling is a bootstrap repo for those who want to write their own wrapper around libgostty

@grok what’s he done here? A new terminal or and update to ghosty?

i feel like 10 new terminal/ides were released this past week and people saying they are switching off ghostty meanwhile ghostty looks good and works great, do i need to switch off ghostty to this new ghostty?

I love this, but I don't know if I have an obvious use case. Are there benefits to a $CompanyTerminal I'm overlooking? We're a 3000+ Windows company without WSL2 (so git bash and Docker desktop). Love your work. Would love to build a cool terminal app as a side project!


