正在加载视频...

视频加载失败

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,...

112,403 次观看 • 7 个月前 •via X (Twitter)

47 条评论

FileCity 的头像
FileCity7 个月前

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

Bjørn Erik Pedersen 的头像
Bjørn Erik Pedersen7 个月前

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.

Mitchell Hashimoto 的头像
Mitchell Hashimoto7 个月前

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.

Bjørn Erik Pedersen 的头像
Bjørn Erik Pedersen7 个月前

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

Mitchell Hashimoto 的头像
Mitchell Hashimoto7 个月前

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.

Bjørn Erik Pedersen 的头像
Bjørn Erik Pedersen7 个月前

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

Mitchell Hashimoto 的头像
Mitchell Hashimoto7 个月前

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

Bjørn Erik Pedersen 的头像
Bjørn Erik Pedersen7 个月前

?????????

Kian 的头像
Kian7 个月前

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).

Mitchell Hashimoto 的头像
Mitchell Hashimoto7 个月前

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.

Aram Hăvărneanu 的头像
Aram Hăvărneanu7 个月前

Disgusting.

Wiedy Mi 的头像
Wiedy Mi7 个月前

Pretty cool, even raylib is there

Matt 的头像
Matt7 个月前

Can I replace xterm.js yet?

Vimana 的头像
Vimana7 个月前

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

Mitchell Hashimoto 的头像
Mitchell Hashimoto7 个月前

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.

Vimana 的头像
Vimana7 个月前

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.

Mitchell Hashimoto 的头像
Mitchell Hashimoto7 个月前

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

pgattic 的头像
pgattic7 个月前

Built with Raylib! @raysan5

Chat Data 的头像
Chat Data7 个月前

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.

Conny Brunnkvist 的头像
Conny Brunnkvist7 个月前

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

Austin K 的头像
Austin K7 个月前

Love to see it

Solglyph 的头像
Solglyph7 个月前

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

COURT 的头像
COURT7 个月前

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

moreward (moreboxed.com) 的头像
moreward (moreboxed.com)7 个月前

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.

cCross 的头像
cCross7 个月前

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

Evert Junior 的头像
Evert Junior7 个月前

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

Mitchell Hashimoto 的头像
Mitchell Hashimoto7 个月前

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).

Evert Junior 的头像
Evert Junior7 个月前

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!

Mitchell Hashimoto 的头像
Mitchell Hashimoto7 个月前

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.

Adib Hanna 的头像
Adib Hanna7 个月前

this is awesome!

djheidihoe 的头像
djheidihoe7 个月前

600 LoC Sounds like a cheat code Great work!

MARU ○ 的头像
MARU ○7 个月前

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

4xi0m4 的头像
4xi0m47 个月前

@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.

Rob Morgan 的头像
Rob Morgan7 个月前

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

Vitalii Diachkov 🇺🇦 的头像
Vitalii Diachkov 🇺🇦7 个月前

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?

Autonomous Alpha 的头像
Autonomous Alpha7 个月前

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?

Matt Anderson 的头像
Matt Anderson7 个月前

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."

Stephen Edginton 的头像
Stephen Edginton7 个月前

Soo good what the vision next

schrepfler 的头像
schrepfler7 个月前

👏👏👏👏

netox 的头像
netox7 个月前

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

opus vs grok 的头像
opus vs grok7 个月前

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

Zaniar 的头像
Zaniar7 个月前

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.

Logno 的头像
Logno7 个月前

is this a precursor to a better tmux in ghostty?

Péter Szarvas 的头像
Péter Szarvas7 个月前

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

Daniel Kelly 的头像
Daniel Kelly7 个月前

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

Rich Kuo 的头像
Rich Kuo7 个月前

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?

Edward Prentice 的头像
Edward Prentice7 个月前

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!

相关视频

day 4 of building an OpenCode clone from scratch i have a newfound appreciation for how good this tool is, and how much attention to detail was put into making it. here is what i managed to clone, and problems i've encountered: 1. scrollable autocomplete. mouse click to select, mousewheel to scroll, arrow keys that auto-scroll when you hit the edge, enter to confirm, sounds simple, but remember that this is a CLI tool, not a web app, all of this has to be implemented from the ground up 2. toast notifications in the terminal, success/error/info variants, auto-dismiss, easily triggerable through context 3. modal dialogs with backdrop overlay, click-outside-to-close, escape to dismiss, focus trapping so the content behind stops capturing input, again, seems simple, but the concept of a "dialog" does not exist in the terminal, so implementing it is way harder 4. built a responder chain for keyboard input, only the topmost layer owns the keyboard. ctrl+c walks down: dialog > command menu > clear input > exit. had to invent this because there's no built-in focus management in a terminal 5. generic command actions. each command gets a context with toast, dialog, and navigate (easily extendable for further features) 6. react-router with a memory router in a terminal app. navigate between screens with the same patterns as web 7. (mock) session view with user/bot message components. thinking indicator, model info footer, mode-colored borders when you use opencode, you don't think about these things, but there is a million little details they thought of. absolutely insane and cracked team Anomaly

Code With Antonio

69,394 次观看 • 7 个月前