Live data from Hacker News

Ghostling

github.com

31–40 of 72 posts

Re: Ghostling

#31
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.

Re: Ghostling

#32
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?

Re: Ghostling

#33

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.

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.

Re: Ghostling

#34

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.

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  embed.c
      #include 
      #include 
  
      #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!

Re: Ghostling

#35
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!

I like to manage tabs and windows through tmux and it suits my workflow very well. What are you going to do now?

Re: Ghostling

#36
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

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.

Re: Ghostling

#37

Earlier quoted context omitted.

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…

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.

Re: Ghostling

#38

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 tog…

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.

Re: Ghostling

#39

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 tog…

You can do this with i3

Re: Ghostling

#40

Earlier quoted context omitted.

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 !

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 app…

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

Post reply on HN