Terminal key input library
Go to file
Přemysl Eric Janouch d47bcfb203
Make note of urxvt 9.25's 1006 support
2021-06-29 05:00:43 +02:00
cmake Get rid of one CMake dev warning 2020-09-14 18:00:31 +02:00
tests Implement de/focus event parsing 2020-09-14 17:55:41 +02:00
.gitignore Miscellaneous little changes 2015-04-11 18:58:14 +02:00
CMakeLists.txt CMakeLists.txt: make this build in OpenBSD 2020-10-29 15:53:04 +01:00
LICENSE Implement de/focus event parsing 2020-09-14 17:55:41 +02:00
README.adoc README.adoc: update to reflect the current state 2020-10-26 14:09:53 +01:00
config-version.cmake.in CMake-ify, rename to termkey2 for the time being 2014-10-09 23:47:24 +02:00
config.cmake.in Rename to termo 2014-10-14 00:08:15 +02:00
demo-async.c Get rid of most block comments 2014-10-14 21:19:20 +02:00
demo-draw.c Rewrite the mouse API 2014-11-19 03:19:13 +01:00
demo-glib.c Fix condition in demo-glib.c 2016-11-03 02:24:35 +01:00
demo.c Rewrite the mouse API 2014-11-19 03:19:13 +01:00
driver-csi.c Implement de/focus event parsing 2020-09-14 17:55:41 +02:00
driver-ti.c Make note of urxvt 9.25's 1006 support 2021-06-29 05:00:43 +02:00
termo-config.h.in Bump minimum CMake version to 3.0 2020-10-26 13:52:55 +01:00
termo-internal.h Don't interpret an n*<Esc> as (n-1)*<Alt>-<Esc> 2015-08-09 14:52:02 +02:00
termo.c Fix formatting 2021-06-29 04:59:15 +02:00
termo.h Implement de/focus event parsing 2020-09-14 17:55:41 +02:00

README.adoc

termo

termo is a library providing an alternative to ncurses' handling of terminal input. ncurses does a terrible job at that, mainly wrt. mouse support which was even completely broken for a few years, making it impossible to drag things around in applications. While that one bit has been fixed, it continues to lack support for rxvt-unicodes 1015 mode and its generally incapable of relaying certain key combinations.

Since terminal I/O is really complicated and full of special cases, this project doesnt aspire to also replace the output part of ncurses, but is rather complementary to it. In the end it makes use of its terminfo library.

The API can be considered stable. This project is in maintenance mode.

Building and Installing

Build dependencies: cmake >= 3.0, pkg-config
Optional dependencies: Unibilium (alternative for curses), GLib (for the demos)

$ git clone https://git.janouch.name/p/termo.git
$ mkdir termo/build
$ cd termo/build
$ cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug

To install the library, you can do either the usual:

# make install

Or you can try telling CMake to make a package for you. For Debian it is:

$ cpack -G DEB
# dpkg -i termo-*.deb

To see the library in action, you can try running the demos, which are statically linked against the library, and hence they can be run as they are:

$ make demos

Whats Different From the Original termkey?

The main change is throwing out any UTF-8 dependent code, making the library capable of handling all unibyte and multibyte encodings supported by iconv on your system. The characters are still presented as Unicode in the end, however, as the other sensible option is wchar_t and that doesnt really work well, see http://gnu.org/software/libunistring/manual/libunistring.html#The-wchar_005ft-mess

To make the mouse parsing support actually useful, some API has been added to set the proper modes on request, and unset them appropriately while destroying. You can have a look at demo-draw.c for an example.

Another change worth mentioning is the usage of CMake instead of the problematic libtool-based Makefile. Now you can include this project in your other CMake-based projects and simply import the target. No package maintainer action is needed for you to enjoy the benefits of proper terminal input.

The rest is just me going silly over formatting and various unimportant stuff. Oh, and Ive deleted the manpages.

Contributing and Support

Use https://git.janouch.name/p/termo to report any bugs, request features, or submit pull requests. git send-email is tolerated. If you want to discuss the project, feel free to join me at ircs://irc.janouch.name, channel #dev.

Bitcoin donations are accepted at: 12r5uEWEgcHC46xd64tt3hHt9EUvYYDHe9

License

termo is based on the termkey library, originally written by Paul Evans <leonerd@leonerd.org.uk>, with additional changes made by Přemysl Eric Janouch <p@janouch.name>.

You may use the software under the terms of the MIT license, the text of which is included within the package, see the file LICENSE.