membrane-term

sheluchin 2025-05-15T16:18:36.047589Z

@alex.sheluchin has joined the channel

sheluchin 2025-05-15T17:16:40.641629Z

Hi @smith.adriane, I'm wondering if it's possible to use this to display an interactive https://github.com/junegunn/fzf picker. I have more in mind for my end goal (wrapping some input elements around it for controls), but to start I just want to know if I can embed an interactive CLI program in a membrane-term layout.

phronmophobic 2025-05-15T17:18:32.403289Z

probably, but it's probably a pain to get the selection/data out

phronmophobic 2025-05-15T17:19:12.300309Z

I haven't tried fzf specifically, but I've tried several complex terminal applications like emacs/vim and don't know of any issues.

sheluchin 2025-05-15T17:21:52.727469Z

Do you happen to have any of those experiments public somewhere or could you suggest how to accomplish it from a high level?

phronmophobic 2025-05-15T17:24:11.988239Z

https://github.com/phronmophobic/easel/blob/main/src/com/phronemophobic/easel/term.clj This is code for the terminal in easel which I use everyday. I've been doing most of my development using emacs running in this terminal.

phronmophobic 2025-05-15T17:25:15.789419Z

but fwiw, I don't really recommend the approach of using terminal UIs when you could just build a regular UI

phronmophobic 2025-05-15T17:25:54.849649Z

There's a file selector example in the membrane repo: https://github.com/phronmophobic/membrane/blob/master/src/membrane/example/file_selector.clj

sheluchin 2025-05-15T17:27:35.621979Z

> but fwiw, I don't really recommend the approach of using terminal UIs when you could just build a regular UI I basically want to add some ability to provide more inputs to fzf to extend my https://github.com/sheluchin/phuzql experiment. Do you mean that membrane-term wouldn't be a good fit for this?

phronmophobic 2025-05-15T17:29:43.426309Z

membrane-term is for including a terminal emulator ui component in an application

phronmophobic 2025-05-15T17:30:11.201559Z

It doesn't really help if you want to make a terminal application that runs in a regular terminal

phronmophobic 2025-05-15T17:31:49.041609Z

Are you trying to build an application with 2d graphics or a command line application that runs in a terminal?

sheluchin 2025-05-15T17:34:54.478249Z

Hmm, how would you classify fzf itself? I think that falls more within the first category.

sheluchin 2025-05-15T17:35:52.433409Z

fzf provides me with a single text input and a picker. I need to keep all that while adding some controls for pagination and additional parameters.

phronmophobic 2025-05-15T17:37:20.366909Z

afaict, fzf is a command line application that runs in terminal

sheluchin 2025-05-15T17:39:25.089499Z

TBH it's not totally clear to me what the distinction is. After it's initially invoked from the CLI it draws out some shapes and provides interactivity.

phronmophobic 2025-05-15T17:45:05.879159Z

> fzf provides me with a single text input and a picker. I need to keep all that while adding some controls for pagination and additional parameters. I don't know how to do that. As far as I know, there are no reusable pieces, constructs, or otherwise that would make that approach worth the effort.

phronmophobic 2025-05-15T17:47:34.605669Z

> TBH it's not totally clear to me what the distinction is. After it's initially invoked from the CLI it draws out some shapes and provides interactivity. The terminal essentially divides up space into rectangles corresponding to some monospaced font. You draw "graphics" by setting these rectangles to a characters in that monospaced font using ansi codes or something like it. An application with 2d graphics usually let's you draw any shapes, text, and images that you want with fewer limitations.

phronmophobic 2025-05-15T17:49:44.754039Z

Terminal applications are usually a bit easier to use over the network, but they're quite limited compared to regular applications.

sheluchin 2025-05-15T18:15:21.238749Z

Thanks for helping me understand the difference, that definitely adds some clarity. I think it could work as a CLI app if fzf can be extended to support additional inputs. It might be possible through --bind, but you could be right that it's not worth the effort. I'll take a look at the easel code to see if there's something I can use in there, or if I need a totally different approach.