TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Writing Programs with Ncurses

280 pointsby ComradeUlyanovover 3 years ago

18 comments

ho_schiover 3 years ago
I love TUIs. They are clear, quick and easy to use. Probably because they require straightforward design.<p>I just read the following links to build up foundation of knowledge first - low-level:<p><a href="http:&#x2F;&#x2F;%CA%9E.cc&#x2F;irl&#x2F;term.html" rel="nofollow">http:&#x2F;&#x2F;%CA%9E.cc&#x2F;irl&#x2F;term.html</a><p><a href="https:&#x2F;&#x2F;viewsourcecode.org&#x2F;snaptoken&#x2F;kilo&#x2F;02.enteringRawMode.html" rel="nofollow">https:&#x2F;&#x2F;viewsourcecode.org&#x2F;snaptoken&#x2F;kilo&#x2F;02.enteringRawMode...</a><p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;ANSI_escape_code#Colors" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;ANSI_escape_code#Colors</a><p>Other libraries:<p># C, C++, Python and Rust<p><a href="https:&#x2F;&#x2F;github.com&#x2F;dankamongmen&#x2F;notcurses" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dankamongmen&#x2F;notcurses</a><p># Python, more polished presentation - but I cannot judge the technical foundation<p><a href="https:&#x2F;&#x2F;github.com&#x2F;willmcgugan&#x2F;rich" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;willmcgugan&#x2F;rich</a>
评论 #28355081 未加载
评论 #28355380 未加载
评论 #28356174 未加载
评论 #28360333 未加载
gonzusover 3 years ago
I have looked into this in the past, and have always felt discouraged by the lack of good support for modern keyboards and mice. With ncurses and similar, you can only detect (a subset of) keys modified by Ctrl and Alt; I would like a portable way of finding about multiple combinations of modifiers, with any key in the keyboard, including function keys, home, end, up, down, etc. Ideally, I would also like to detect mouse events (including &quot;window&quot; clicked position) and even mouse events when holding Ctrl, Alt, etc. And I would like to do all this <i>without</i> having to parse multiple escape codes, implement timers or whatnot.<p><a href="https:&#x2F;&#x2F;sw.kovidgoyal.net&#x2F;kitty&#x2F;keyboard-protocol&#x2F;" rel="nofollow">https:&#x2F;&#x2F;sw.kovidgoyal.net&#x2F;kitty&#x2F;keyboard-protocol&#x2F;</a> is a very promising step on this direction. Maybe next time I have to work on a TUI I will look into it.
评论 #28364825 未加载
CJeffersonover 3 years ago
While discussing ncurses, has anyone ever seen any attempt to make accessible interfaces?<p>Nowadays when making a quick interface I tend to use a web-based interface -- while they are much heavier it&#x27;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 (which I&#x27;ve heard good things about but haven&#x27;t tried, as I&#x27;m not an emacs user).
评论 #28354925 未加载
评论 #28354879 未加载
评论 #28355455 未加载
dmuxover 3 years ago
Plain old HTML + forms can go a long way when accessed through the Lynx or w3 web browsers. I think the first time I encountered a system where this was the preferred path was in Kannel [0].<p><a href="https:&#x2F;&#x2F;kannel.org&#x2F;download&#x2F;1.4.5&#x2F;userguide-1.4.5&#x2F;userguide.html#AEN993" rel="nofollow">https:&#x2F;&#x2F;kannel.org&#x2F;download&#x2F;1.4.5&#x2F;userguide-1.4.5&#x2F;userguide....</a>
评论 #28355913 未加载
tavisoover 3 years ago
That&#x27;s funny, I had this tab open this weekend while I was trying to make a silly terminal game, where each sprite is an ncurses window. I didn&#x27;t really make much progress, but got the physics and sprite drawing working.<p><a href="https:&#x2F;&#x2F;lock.cmpxchg8b.com&#x2F;img&#x2F;ncurses.gif" rel="nofollow">https:&#x2F;&#x2F;lock.cmpxchg8b.com&#x2F;img&#x2F;ncurses.gif</a>
评论 #28357692 未加载
dankamongmenover 3 years ago
why merely write programs with NCURSES when you can hack the planet with notcurses? enjoy the free book:<p><a href="https:&#x2F;&#x2F;nick-black.com&#x2F;htp-notcurses.pdf" rel="nofollow">https:&#x2F;&#x2F;nick-black.com&#x2F;htp-notcurses.pdf</a>
ivanalejandro0over 3 years ago
I can&#x27;t access the site...<p>Access Denied - Sucuri Website Firewall Block reason: Access from your Country was disabled by the administrator.<p>In case someone else experience the same and wants an alternate link: <a href="http:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20210531163620&#x2F;https:&#x2F;&#x2F;invisible-island.net&#x2F;ncurses&#x2F;ncurses-intro.html" rel="nofollow">http:&#x2F;&#x2F;web.archive.org&#x2F;web&#x2F;20210531163620&#x2F;https:&#x2F;&#x2F;invisible-...</a>
评论 #28355163 未加载
mprovostover 3 years ago
Thomas Dickey has been maintaining this code by himself for years (decades?). Along with the timezone database, the terminal info database is a huge SPOF. It&#x27;s too bad that this effort is mostly unrecognised.
bo1024over 3 years ago
One really nice thing about ncurses (which I used in python to make an email user agent) —- you can run ncurses apps in an ssh session.
incanus77over 3 years ago
I had always wanted to write something in this and got my chance last year when I finally decided to write a utility for Safari tab management:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;incanus&#x2F;fari" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;incanus&#x2F;fari</a><p>Since then, however, I’ve switched to the Min browser. But it was super empowering to make a console-based interface and I’m looking forward to trying it again soon.
ivarsover 3 years ago
Any examples of modern apps with rich terminal GUI?
评论 #28355937 未加载
评论 #28355975 未加载
评论 #28356789 未加载
评论 #28356241 未加载
评论 #28356067 未加载
评论 #28376638 未加载
评论 #28358087 未加载
评论 #28356303 未加载
评论 #28356036 未加载
评论 #28361143 未加载
ape4over 3 years ago
The &quot;n&quot; in &quot;ncurses&quot; is for new. Its not so new any more ;)
评论 #28362828 未加载
CyberShadowover 3 years ago
For whatever reason, my country is banned from accessing this website.<p><a href="https:&#x2F;&#x2F;dump.cy.md&#x2F;7065a236c07f22558d3f1422c986a243&#x2F;1630343129.713585664.png" rel="nofollow">https:&#x2F;&#x2F;dump.cy.md&#x2F;7065a236c07f22558d3f1422c986a243&#x2F;16303431...</a>
评论 #28361687 未加载
dTalover 3 years ago
For a low-mental-overhead alternative to curses, I just discovered this lovely little library:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;termbox&#x2F;termbox&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;termbox&#x2F;termbox&#x2F;</a>
评论 #28362501 未加载
codedokodeover 3 years ago
I don&#x27;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.
评论 #28360691 未加载
评论 #28356547 未加载
评论 #28356148 未加载
评论 #28358213 未加载
ToddWBurgessover 3 years ago
Hearing the word ncurses brings back memories of second year computer science for me. Once upon a time. In a galaxy far far away
floor_over 3 years ago
I wish there was a list of all the quirkiness of ncurses back when I wrote a win32 port of it for a game.
nathiasover 3 years ago
curses are awesome, there is also a react wrapper that makes it easier to implement