Live data from Hacker News

Writing Programs with Ncurses

invisible-island.net

51–60 of 93 posts

Re: Writing Programs with Ncurses

#51
post #30

Earlier quoted context omitted.

I don't think it is exactly TUI vs GUI, but more keyboard-first vs mouse-first, i.e. how you interact with it. Granted, Desktop GUI are usually developed mouse-first, but it doesn't have to be that way: if you take windows 98 / windows 2000, you could get everything done more efficiently with a keyboard than with a mouse. Just think about the difference between an app developed specifically for the desktop (mouse) or…

Right. Plus responsiveness. Terminal apps have faster response time than GUIs. And when someone is typing like 10 chars per seconds it matters. The usecase is different between terminal vs GUI. Where in GUI you look - choose - decide and click. And in terminal you blindly storm on the keyboard as fast as you can.

> The usecase is different between terminal vs GUI. Where in GUI you look - choose - decide and click. And in terminal you blindly storm on the keyboard as fast as you can.

Actually I think it is more nuanced than that.

Some GUI programs are well optimized for fast keyboard only usage even if you can use point and click. NetBeans, Eclipse, IntelliJ, Sublime Text and VS Code are on top of my mind but even some old web applications used to be quite usable I think.

Re: Writing Programs with Ncurses

#53
post #46

Earlier quoted context omitted.

It feels like we live in a pretty good time for writing TUIs, CLIs and also small self-contained tools (thanks to languages like Go, which have a lot of libraries, are easy to use, but also compile to statically linked executables). What stuck with me was using the Typer library for a Python tool that i wrote: https://typer.tiangolo.com/ It made regular shell scripts into a fully fledged CLI with nested commands than…

> Developing a GUI feels awfully complicated It’s kind of a language thing. When Visual Basic came out, it’s UI builder was ahead of anything I’ve ever seen on a GUI and more versatile than HyperCard (and much faster). A decent GUI builder attached to an IDE and some nice language support goes a long way. That’s the opposite of the experience you get when using, say, Flutter or React Native. The language is better th…

Sadly it seems a thing of the times, perhaps due to the direction the industry has gone in.

I recall creating GUIs in Lazarus/FreePascal was really easy and an enjoyable experience, however there are so few libraries and integrations for it, that it's a non starter for new projects.

There is Swing for Java which had a really nice GUI builder in NetBeans, but the other IDEs are somewhat lacking in comparison and then JavaFX/OpenJFX came out, which didn't integrate quite as nicely and complicated things further.

As for .NET, it has always had lovely GUI options, especially with WinForms/WPF in Visual Studio, yet it has always lacked cross platform options for the most part.

How we got from being able to drag and drop components to create fully functional GUIs to embedding browsers and creating apps with full webdev stacks locally never ceases to surprise me in a bad way.

Re: Writing Programs with Ncurses

#55

I don't like text UIs. They try to emulate GUI but do it poorly. You should either make a classic console program, that can be scripted, piped, etc., or a real GUI.

Eh there is plenty room for all gray areas of tui. You are talking about CLI and not TUI, completely different world. TUI is great if you work remote and can present a lot of information quickly in such situations. Plus some people prefer them and that's all it really requires for there to be some awesome TUI programs. All you really have to do is ignore them if you don't like them.

Re: Writing Programs with Ncurses

#56
post #34
post #21

Any examples of modern apps with rich terminal GUI?

I love mu4e. I don't know if running in Emacs qualifies as "terminal GUI" though. https://www.djcbsoftware.nl/code/mu/mu4e.html

It certainly qualifies. TUI stands for text UI not terminal UI

Re: Writing Programs with Ncurses

#57
post #5

While discussing ncurses, has anyone ever seen any attempt to make accessible interfaces? Nowadays when making a quick interface I tend to use a web-based interface -- while they are much heavier it's fairly easy to make fully blind accessible interfaces, I (very briefly) looked to see if any terminal based libraries supported anything similar, and the only thing which seems to be trying is emacs, with emacsspeak (wh…

It would be nice if curses programs all had a standard keymapping or signal that would invoke one of curses screen dump functions. Lacking that, a screenreader would have to jump through a lot of hoops to even know what's on the screen. I suppose you could use tmux instead...it seems to be able to dump the current screen. Either way, still a lot of work to do after you have the raw data.

You don't need to dump the screen, the screen reader takes care of letting you explore the screen by line, word, character, etc.

Some curses programs work reasonably well with screen readers (e.g. Mutt and WeeChat). One useful way to make them more accessible is to put the hardware cursor somewhere useful, even if hidden. Mutt puts it on the same line as the currently-selected message, and if braille_friendly is set, onto the first line of message content when opening one.

WeeChat puts it on the input line. Where this goes wrong is when trying to use fset, where I have no way to move it to the list of options.

Re: Writing Programs with Ncurses

#58
post #47
post #16

Earlier quoted context omitted.

It sounds you had a much bigger budget than we had ;) BTW, the Mainframe had a sql-database (DB2) and was attached to Active-Directory already, the Reports/Print-jobs where send to a Linux Machine, it was actively maintained and not some old crusty 70's System.

The only sad part here is that you didn’t get your own 3278 with beam spring keyboard ;-) People often equate a later fad with “modernisation” when a well architected app can be easy to manage even if written in COBOL and running under CICS. If a person can learn Java, they can learn to read COBOL.

>The only sad part here is that you didn’t get your own 3278 with beam spring keyboard ;-)

Hey! I have my beloved HHKB Professional 2 since years :-)

>If a person can learn Java, they can learn to read COBOL.

Well...well yes! That's true especially the modern one's.

Re: Writing Programs with Ncurses

#59
post #19
post #13

Earlier quoted context omitted.

Wanted to hear this. This had been my experience too. But no one on the net seem to talk about it. It was always "we are stuck with mainframe due to politics..." But this isn't about mainframe vs Java. I have a feeling it's about Terminal user interface vs GUI. A modern terminal app, will be just as much fast as those old mainframe apps, is my feeling.

Mainframes do have a more sensible way to build a TUI than something like curses. A 3270 TUI is very similar to using html forms. The fields are named, have attributes, validation, and a so on. The mainframe sends the form, the user interacts with the form, and nothing is sent back to the server until either a field validation is needed or the "Enter" key is pressed. More detail: http://bitsavers.trailing-edge.com/pd…

Did you mean to link to a 380 page PDF book? Sure, it fits with the literal meaning of "more detail", but it doesn't feel helpful in a discussion context like this...

I clicked on that link hoping to see one or two pages of info that made it clear how the whole system worked with more detail than you gave, but not a whole book of minutia that I don't have enough reason to care about at this point in the discussion.

Re: Writing Programs with Ncurses

#60
post #50

Earlier quoted context omitted.

It feels like we live in a pretty good time for writing TUIs, CLIs and also small self-contained tools (thanks to languages like Go, which have a lot of libraries, are easy to use, but also compile to statically linked executables). What stuck with me was using the Typer library for a Python tool that i wrote: https://typer.tiangolo.com/ It made regular shell scripts into a fully fledged CLI with nested commands than…

I recently came across YAD ( https://sourceforge.net/projects/yad-dialog/ ), which is a improved version of dialog. Allows you to create a simple GUI, where all the entries are written to STDOUT. So, you can interface with your favorite language. For examples, see this page: http://smokey01.com/yad/

Note that the project hasn't been contributed to since 2017, and contains unfixed bugs from six years ago.

Might be worth a fork or a rewrite.

Post reply on HN