237 pointsby bjornroberg14 hours ago6 comments
  • oDot12 hours ago
    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

    • nout12 hours ago
      I think your github readme is really missing a picture/screenshot to quickly understand what is the experience like. I.e. if your app is mainly about adding the chrome (as in the surrounding UI pixels) around the TUI, then it would be good to show what is the chrome like.
      • cstrahan5 hours ago
        Nah, I think it’s pretty clear. It would look like a terminal emulator. Just like how Electron looks like a bunch of browser widgets - because it’s literally a single-web-app browser.
    • theowaway2134569 hours ago
      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
      • oDot9 hours ago
        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

    • girvo7 hours ago
      I kind of want to use this to turn Wordgrinder into a Mac app haha
    • Imustaskforhelp3 hours ago
      Oh this is nice!

      You mention that Android/IOS support is possible. I hope that you can please add these support properly as your project matures.

      Asking this because I would love to have a cli tool where I can just point to for example golang codebase from any device (mac/windows/linux) etc. and thanks to golang's cross compilation simplicity, have it be compiled for android (well linux arm fwiw) and then have it all be compiled into a single android apk.

      And if you do that, I would love to have something like zenity but for android so as to abstract the cli behind a nice gui for mass-adoption.

      This is almost a million dollar problem as there are so many good cli tools and its incredibly easy and versatile to make a gui even with scripts on top of that cli but Android/Ios usually don't have that versatility.

  • znpy2 minutes ago
    I’m seriously interested in this. I wonder if i can use this along some decent gui library and an llm to vibe-code a SecureCRT replacement.

    SecureCRT is awesome but it’s crazy expensive :(

  • vintagedave13 hours ago
    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.

    • simonw12 hours ago
      Here's the build script that uses: https://github.com/ghostty-org/ghostling/blob/main/bin2heade...

      I ran it against a 1x1 pixel GIF:

        cmake -DINPUT=pixel.gif -DOUTPUT=pixel.h -DARRAY_NAME=pixel_gif -P bin2header.cmake
      
      And got this:

        // Auto-generated from /private/tmp/exp/pixel.gif — do not edit.
        static const unsigned char pixel_gif[] = {
            0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, 
            0x00, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 
            0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3b
        };
    • mitchellh9 hours ago
      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.
    • w4rh4wk54 hours ago
      For completeness, there's also the somewhat common way of creating an object file directly from the binary using objcopy. The object file ends up with 3 symbols with names based on the input file. For instance, a binary file level0.map yields: _binary_level0_map_start, _binary_level0_map_end, _binary_level0_map_size.

      These can be used in the application through external declarations; and you include the object file in the linking step, like any other object file.

    • fresh_broccoli12 hours ago
      Fun fact: XPM bitmaps were designed to be #included unmodified, the files contain C boilerplate: https://en.wikipedia.org/wiki/X_PixMap
    • electroly11 hours ago
      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 -- among other things, this project can modify Windows PE, macOS Mach-O, and Linux ELF binaries to add resources to them, then offers an API to read them back later. It's a little different for each format, but it's capable of doing all three and I was able to build a cross-platform resource-bundling system that doesn't care how big the resources are.

      • rweichler8 hours ago
        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.

        • tjoff2 hours ago
          Feels like Lua is a more exotic dependency. I used to use xxd but this gets problematic when files grow (and they don't need to grow much at all), objcopy is much faster (which I didn't think would matter much, but it did) and don't have the same issues that accidentally opening the .h file in your editor or code-searching having to traverse that mess.

          Yes, you'd want to gitignore it and exclude it from search etc. but you still have size issues etc. See gucci-on-fleek's comment on objcopy above for usage.

    • gucci-on-fleek4 hours ago
      My preferred technique (where #embed isn't available) is to use objcopy:

        $ echo 'Hello, world!' > hello-world.txt 
        $ objcopy --input-target=binary --output-target=elf64-x86-64 \
            hello-world.txt hello-world.o
        $ cat <<EOF > embed.c
            #include <stdint.h>
            #include <stdio.h>
        
            #define EMBED(NAME)                                \
                extern const uint8_t _binary_##NAME##_start[]; \
                extern const uint8_t _binary_##NAME##_size[];
            #define DATA(NAME) _binary_##NAME##_start
            #define SIZE(NAME) (size_t)_binary_##NAME##_size
        
            int main() {
                EMBED(hello_world_txt);
        
                printf("%.*s", (int)SIZE(hello_world_txt), DATA(hello_world_txt));
            }
        EOF
        $ gcc hello-world.o embed.c -o hello-world
        $ ./hello-world
        Hello, world!
    • conradev8 hours ago
      I think this has been around for a while:

        $ echo 'test' | xxd -i -n foo
        unsigned char foo[] = {
          0x74, 0x65, 0x73, 0x74, 0x0a
        };
        unsigned int foo_len = 5;
      
      (edit: 30 years)
    • vintagedave12 hours ago
      And as a Windows programmer the use of a method called DrawTextEx surprised me :)

      A really neat sample. Shows the power of the ghosttty library very well. The author chose well with their other libraries, it’s the kind of demo that lets the code actually demo what to trying to without much else getting in the way. Rather inspirational to wrote my own terminal app now.

    • kingforaday12 hours ago
      For cross-compilation ease it makes sense if you don't care about the size explosion.
    • TacticalCoder10 hours ago
      > 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.

      • jrmg8 hours ago
        `man xxd`
  • lzhgusapp5 hours ago
    I switched to Ghostty a few months ago and it's become one of the apps I never close. The rendering speed is noticeably better than iTerm2, especially with large log outputs. Excited to see libghostty enabling projects like this — the idea of packaging TUIs as native desktop apps is really compelling for indie developers.
  • lindskogen5 hours ago
    I have an idea of a terminal emulator where you could maximize panes but using a nested structure, does anyone know of one?

    Standard "Zoom" features in tmux or iTerm2 only maximize the single active pane to the full window, hiding everything else. If I have a layout like this:

      _____________________
      |         |    B    |
      |    A    |---------|
      |         |    C    |
      |_________|_________|
    
    And I expand B, I want A to hide, while B and C remain visible together. Then I can create a new nested workspace in there and later zoom out when I’m done.

    Maybe this could be done arbitrarily deep?

    • aquariusDuean hour ago
      It's not really what you want but in a similar vein check out: zoom.el

      https://github.com/cyrus-and/zoom

      I guess it's also the kind of thing where screen real-estate is a must otherwise when you're at the "top-level" it would look weird-ish.

    • 0x696C6961an hour ago
      You can do this with i3
  • imiric12 hours ago
    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 good that OSC support is planned. A plugin-like system, similar to st's but less cumbersome, would be nice to have.

    • nixpulvis9 hours ago
      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!
      • hombre_fatal6 hours ago
        I've heard this a lot on HN over the years but it doesn't make much sense to me. Some thoughts:

        1. App tabs improves UX for 99.999% of users who aren't using a WM with a good tab solution (if one even exists).

        2. WM tabs means launching a new app instance for every tab you might want vs having lightweight app tabs.

        3. App tabs can do all sorts of app-level things and UX polish that dumb WM tabs can't do because they are so general. My terminal emulator tabs show a badge count of bell notifications, can be dragged around into groups, or dragging into other tabs as split panes. My browser tabs show you which tab is playing music and can impl right click -> mute.

        4. I bet even the biggest WM tab cheerleader still uses browser tabs.

        5. WM tabs are a different concern than app tabs, not a replacement. WM tabs are useful when you want tabs and the app doesn't provide a good tab metaphor or when you want to tile/group app instances a certain way. That doesn't mean it's not useful for the app instances themselves to have app tabs when it makes sense.

      • rane3 hours ago
        I like to manage tabs and windows through tmux and it suits my workflow very well. What are you going to do now?
      • theowaway2134569 hours ago
        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)
      • eddythompson807 hours ago
        Yes, we need tabs for RDR2 and Spotify.
        • esperent7 hours ago
          I would love tabs for Spotify. I just discovered I can at least open new windows from the linux YouTube music client by middle clicking, a revelation !
          • eddythompson807 hours ago
            Every application (or concept) can introduce “tabs”, but it means something wildly different for that particular application. Tabs (or instances) in an application immediately bumps into the concept of state (statefull vs stateless) in applications.

            Sometimes, it makes perfect sense. The reason tabs made sense for web browsers since 2004 is because each web page could be thought of as a “stateless” instance of an application. You’re not asking for “tabs”, you wish every application could be “Stateless”. Stateless is a beautiful thing, until you understand what state is, and who needs to manage it.

            If every “tab” of Spotify had no idea what the other “tab” is playing and you had to switch back and forth between tabs to pause-and-play songs, that would be a bug, not a feature. While 2 “windows” playing audio (if you instruct them to) is expected.

            • esperent39 minutes ago
              > Tabs (or instances) in an application immediately bumps into the concept of state (statefull vs stateless) in applications.

              Agreed, and this is why tabs need to work at the app level, not window manager/os level.

              That said, for Spotify specifically, it can already tell what I'm playing on an entirely different device. I think they can handle tabs.

    • qudat6 hours ago
      Interesting you mention tmux because it itself resembles a terminal emulator. It has its own terminal feature matrix that controls what your parent emulator can render. It sounds like you aren’t using tabs and splits in tmux but it does include them.

      It sounds like you could get away with using a tool like https://zmx.sh which only handles session persistence (attach/detach). It also uses libghostty but only for state restoration on reattach.

    • herewulf8 hours ago
      On tiling WMs I use rxvt-unicode with no window decorations, no gaps, 1 px border, no scrollbar. Then tmux does the rest, namely tabs and splits. Automatic session saving has been a life saver on more than one occasion.