Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Thank you very much, now I have an idea of how does mouse support work in a Linux terminal.

However, I still don't understand how does a program know it's connected to a terminal rather than some pipes.



Both the terminal or pipe show up as a preopened file descriptor to your process. You can pass that file descriptor to the isatty posix function call which will inform you whether the file is a tty (in most cases a terminal) or not.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: