Live data from Hacker News

Ghostling

github.com

11–20 of 72 posts

Re: Ghostling

#11

The C file is small enough to read (over a few minutes.) I got to about line 5 and realized: I’ve never seen quite that technique for embedding a font via an autogenerated header before. I’m more used to Windows resources; this seems to generate a byte array in CMake code. I’m somewhere between horrified and impressed, in that I feel we’ve finally discovered a cross platform binary resource embedding solution.

> I’m somewhere between horrified and impressed, in that I feel we’ve finally discovered a cross platform binary resource embedding solution.

Maybe I'm misunderstanding your comment about having "finally discovered" that...

For to me embedding binary resources in source files is nothing new at all? It was definitely done in the early JavaScript days for a variety of reasons.

Arguably early basic listings that had lots of DATA text lines were already doing that. Maybe not the most portable but we're talking about the 70s and 80s here and definitely binary data in source code.

Games for the Atari ST and Amiga, for example, could partially share at least some of their source code and it wasn't uncommon to encode binary inside sources, including... Fonts! Back then fonts were not reused from one game to another.

Heck, I've done in Java (and Java is cross platform) in the past: quick visual debug tools for Java GUI apps to toggle a debug mode showing something not dissimilar to a HUD. Pixel-perfect fonts encoded in .java source files.

I really don't think it's anything new.

P.S: I'm pretty sure it's done like for some fonts in the Linux kernel too.

Re: Ghostling

#12

The C file is small enough to read (over a few minutes.) I got to about line 5 and realized: I’ve never seen quite that technique for embedding a font via an autogenerated header before. I’m more used to Windows resources; this seems to generate a byte array in CMake code. I’m somewhere between horrified and impressed, in that I feel we’ve finally discovered a cross platform binary resource embedding solution.

Well, I originally used C23's #embed directive (https://en.cppreference.com/w/c/preprocessor/embed) but GCC in Nixpkgs doesn't support C23 (or I'm holding it wrong) so I dropped back to this. The better long term solution is #embed.

Re: Ghostling

#13
post #9

This looks interesting. I don't need my terminal emulator to support tabs, windows, or session management. My WM manages tabs and windows, and I use tmux for sessions, which also gives me a scrollback buffer, selection, clipboard, search, etc. This combination allows me to use any simple terminal emulator, such as urxvt, st, and now foot, without issues. Ghostty didn't appeal to me, but I might give this a try. It's…

It's comical how much time I've spent convincing people that tabs are a window manager feature not an application feature. People in the Alacritty issue on the subject were pissed!

Re: Ghostling

#14
post #4

I use libghostty for Trolley[0], which packages TUIs as desktop apps, like Electron does for web apps. It really is quite an amazing piece of software. I just wrapped it in a useful GUI and a bundle/package CLI and it just works. Even on Windows. Kudos to the Ghostty developers. [0] https://github.com/weedonandscott/trolley

This is a pretty cool idea. Kind of a neat distribution hack if all you have is a TUI (and not a full GUI). Curious whether you know of any success stories yet

Re: Ghostling

#15
post #9

This looks interesting. I don't need my terminal emulator to support tabs, windows, or session management. My WM manages tabs and windows, and I use tmux for sessions, which also gives me a scrollback buffer, selection, clipboard, search, etc. This combination allows me to use any simple terminal emulator, such as urxvt, st, and now foot, without issues. Ghostty didn't appeal to me, but I might give this a try. It's…

It's comical how much time I've spent convincing people that tabs are a window manager feature not an application feature. People in the Alacritty issue on the subject were pissed!

Are there any good, non-tiling window managers that support tabs? (I struggle with tiling ones like i3 because I am a small-brained mouse user)

Re: Ghostling

#16

Earlier quoted context omitted.

It's comical how much time I've spent convincing people that tabs are a window manager feature not an application feature. People in the Alacritty issue on the subject were pissed!

Are there any good, non-tiling window managers that support tabs? (I struggle with tiling ones like i3 because I am a small-brained mouse user)

I mean, macOS supports tabs now. I wouldn't call it "good" though.

Re: Ghostling

#17
post #4

I use libghostty for Trolley[0], which packages TUIs as desktop apps, like Electron does for web apps. It really is quite an amazing piece of software. I just wrapped it in a useful GUI and a bundle/package CLI and it just works. Even on Windows. Kudos to the Ghostty developers. [0] https://github.com/weedonandscott/trolley

This is a pretty cool idea. Kind of a neat distribution hack if all you have is a TUI (and not a full GUI). Curious whether you know of any success stories yet

Thanks.

This was written for my own screenwriting software, which is now in private alpha. It works quite nicely for an alpha

https://blisswriter.app

Re: Ghostling

#18

Earlier quoted context omitted.

It's comical how much time I've spent convincing people that tabs are a window manager feature not an application feature. People in the Alacritty issue on the subject were pissed!

Are there any good, non-tiling window managers that support tabs? (I struggle with tiling ones like i3 because I am a small-brained mouse user)

Maybe you'd like Niri?

https://github.com/niri-wm/niri

Re: Ghostling

#19

The C file is small enough to read (over a few minutes.) I got to about line 5 and realized: I’ve never seen quite that technique for embedding a font via an autogenerated header before. I’m more used to Windows resources; this seems to generate a byte array in CMake code. I’m somewhere between horrified and impressed, in that I feel we’ve finally discovered a cross platform binary resource embedding solution.

> I’m somewhere between horrified and impressed, in that I feel we’ve finally discovered a cross platform binary resource embedding solution. Maybe I'm misunderstanding your comment about having "finally discovered" that... For to me embedding binary resources in source files is nothing new at all? It was definitely done in the early JavaScript days for a variety of reasons. Arguably early basic listings that had lot…

`man xxd`

Re: Ghostling

#20

The C file is small enough to read (over a few minutes.) I got to about line 5 and realized: I’ve never seen quite that technique for embedding a font via an autogenerated header before. I’m more used to Windows resources; this seems to generate a byte array in CMake code. I’m somewhere between horrified and impressed, in that I feel we’ve finally discovered a cross platform binary resource embedding solution.

You can use `xxd` from the vim package to generate these. You'll find out pretty quickly that this is only suitable for small resources: gcc and clang blow up in both time and space on very large literal arrays. If you need to ship more than a few megabytes, find a different technique. I used this technique for awhile, but it was too problematic for my use case. Now, I use https://github.com/lief-project/LIEF -- amon…

Yeah xxd is the correct answer. If you don't want to install a dependency and have Lua installed, or if you're just feeling a little bit frisky, you can use my function which is Production Ready™.

    Xxd = function(name, input)
        if not name:find'^[_%a][_%w]*$' then error('bad name: '..tostring(name)) end
        local ans = {
            'const unsigned int '..name..'_len = '..(#input)..';',
            'const unsigned char '..name..'[] = {',
        }
        local t = {}
        for i=1,#input do
            table.insert(t, ('0x%02x,'):format(input:byte(i)))
            if #t == 16 then -- 16 columns per row. arbitrary, change this if you want
                table.insert(ans, table.concat(t))
                t = {}
            end
        end
        if #t ~= 0 then
            table.insert(ans, table.concat(t))
        end
        table.insert(ans, '};\n')
        return table.concat(ans, '\n')
    end
I am distributing it under the terms of the GNU GPL v3. So if you put this in your codebase I will sue you into releasing your entire source. Just kidding it's MIT licensed.

Honestly that's a terrible joke. Seriously it's MIT. Here I will put the full license in this comment to illustrate how serious I am:

Copyright 2026 rweichler

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Post reply on HN