ImTui: Immediate Mode Text-based User Interface

Overview

imtui

Actions Status ImTui v1.0.3 badge Dear ImGui version badge

ImTui is an immediate mode text-based user interface library. Supports 256 ANSI colors and mouse/keyboard input.

imtui-sample

wtf-tui-demo

imtui-screenshot-0

imtui-screenshot-1

Live demo in the browser

Eventhough this library is supposed to be used in the terminal, for convenience here is an Emscripten build to demonstrate what it looks like, by simulating a console in the browser:

Note: the demos work best with Chrome

Details

This library is 99.9% based on the popular Dear ImGui library. ImTui simply provides an ncurses interface in order to draw and interact with widgets in the terminal. The entire Dear ImGui interface is available out-of-the-box.

For basic usage of ImTui, check one of the available samples:

Building

ImTui depends only on libncurses

Linux and Mac:

git clone https://github.com/ggerganov/imtui --recursive
cd imtui
mkdir build && cd build
cmake ..
make

./bin/imtui-example-ncurses0

Windows:

Partial Windows support is currently available using MSYS2 + MinGW + PDCurses:

# install required packages in an MSYS2 terminal:
pacman -S git cmake make mingw-w64-x86_64-dlfcn mingw-w64-x86_64-gcc mingw-w64-x86_64-pdcurses mingw-w64-x86_64-curl

# build
git clone https://github.com/ggerganov/imtui --recursive
cd imtui
mkdir build && cd build
cmake ..
make

./bin/hnterm.exe

For more information, checkout the following discussion: #19

Emscripten:

git clone https://github.com/ggerganov/imtui --recursive
cd imtui
mkdir build && cd build
emconfigure cmake ..
make
Issues
  • Cursor position desync after moving a window

    Cursor position desync after moving a window

    After moving a window, the cursor selects buttons slightly higher then were the cursor is drawn. I'm talking about moving an ImTui window, not the whole browser window. Having the issue on Firefox 71.0 (64-bit).

    bug 
    opened by FrankvdStam 10
  • Missing ImGui Tables demo

    Missing ImGui Tables demo

    Currently, Imtui seems to support Imgui v1.81 whose demo has a bunch of table related stuff, which Imtui seems to be missing.

    ImGui Demo v1.81 (has lots of table related demo items):

    image

    ImTui (master) (ncurses_demo) (doesn't have majority of table related items):

    image

    enhancement 
    opened by dufferzafar 5
  • ncurses example is not working (cannot click on things)

    ncurses example is not working (cannot click on things)

    I'm unable to click on anything in ncurses example. It just selects text (even title says that, it changes from <path_to_exe> to Select <path_to_exe>). Right-click or pressing some key resets select mode, but there is no way for me to make example application work unfortunately.

    I'm compiling with MSYS2 64-bit with MinGW-w64 64-bit compiler on Windows 10. I had issue with compilation as mentioned in issue #1, maybe it is relevant to this problem in some way.

    help wanted 
    opened by WSSDude420 5
  • No display on tmux

    No display on tmux

    It might be more like an issue of tmux. Both hnterm and imtui-example-ncurses0 worked well in my terminal, but when I run them using tmux, I didn't see anything.

    That happened on macOS Catalina with any kind of terminal. I used default .tmux.conf.

    bug 
    opened by toyboot4e 4
  • It would be so nice

    It would be so nice

    If we could say farewell to the 70's. Why we are still fixated to the idea that everything is a tty and we need to use ANSI escape codes to hack around the fact the 70's is over and you don't have a line-printer in your living room? Why nobody (literally, nobody) attempts to make any real changes, like you know, to create hi-res modern command-line (ow, you can't fallback then to runlevel1 to run our superduper (TM) program! You would actively exclude users!!!! NONONO). This is all bullsit, to ride on the existing terminal, and you know what, the silly thing is even the terminal emulators doing things differently, so at the end of the day libs like this and the retarded ncurses will be full of hack and cases and still it will provide some features which won't be supported by all term emulators. But noooooo, we can't do anything new, we have to sit in this swamp created by made-up scientists in the 70's, not because they were evil or something, but because they were employed by telecommunication. But no, linux, unis, bsd, mac and everybody thinks nooo, U CANT TOUCH THIS!! You know what? I would like to beat everybody up who is responsible for the sorry state of the modern personal computing, and for the available operating systems. There was nice ideas, but NOOOO, we had to settle down with the worst possible option. unix, were we bolt and glue layers above layers and above layer.

    Fck you for continuing this. But really. Fuck you! Your are ALSO the reason why we can't have nice things.

    Now go and close this ticket without spending any minute to think about why the "Beat up a programmer, he will know why he got it" movement exist and why they beat up programmers.

    So again: fuck you.

    opened by extrowerk 3
  • Linking problem with ImTui

    Linking problem with ImTui

    Hello,

    I am currently trying to include ImTui to my current console project. I followed instructions and it seems there is some linking problems (probably trivial, I am not too familiar with c/c++ world). I am using CMake and linked all ImTui .a files, I also have ncurses linked to my project. Result when I try to build and run my project:

    /usr/bin/ld: /home/shardine/projects/neonlit/client/../lib/libimtui-ncurses.a(imtui-impl-ncurses.cpp.o): in function `ImTui_ImplNcurses_Init(bool, float, float)':
    imtui-impl-ncurses.cpp:(.text+0xd2): undefined reference to `initscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xd7): undefined reference to `use_default_colors'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xdc): undefined reference to `start_color'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xe1): undefined reference to `cbreak'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xe6): undefined reference to `noecho'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xed): undefined reference to `curs_set'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xf4): undefined reference to `stdscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0xfe): undefined reference to `nodelay'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x105): undefined reference to `stdscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x10c): undefined reference to `wtimeout'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x116): undefined reference to `set_escdelay'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x11d): undefined reference to `stdscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x127): undefined reference to `keypad'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x25b): undefined reference to `stdscr'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x313): undefined reference to `mouseinterval'
    /usr/bin/ld: imtui-impl-ncurses.cpp:(.text+0x31f): undefined reference to `mousemask'
    

    so all the link problems seems to be with ncurses. Do you know what I am doing wrong here?

    Best regards.

    build problem 
    opened by SeveriSuominen 3
  • Experiencing slow framerate

    Experiencing slow framerate

    [MSVC 15 2017 Win32], Windows 10 Command Prompt, using PDCurses I had to fiddle a bit to make it work ( tweaking small things in the CMakeLists.txt to link PDCurses properly ). Then, even in release build, the refresh is very slow in the imtui-example-ncurses0 demo executable. I experience approximately 10fps, even the Web Assembly demo is faster and more responsive. It looks like it is spending a lot of time in ImTui_ImplNcurses_NewFrame > wgetch > sleep. Disabling the std::this_thread::sleep_for did not help either. I can provide more information if needed.

    bug 
    opened by Clement-Praxinos 3
  • Unnecesarily restrict C++ standard on CMake

    Unnecesarily restrict C++ standard on CMake

    The CMakeLists file sets C++17 as the necessary C++ standard to compile imtui (https://github.com/ggerganov/imtui/blob/418552cbd35a2b468bcac5026903a0b7d3997815/CMakeLists.txt#L85) but the project compiles and runs correctly on C++11 (tested with gcc 4.8.5 on rhel7).

    Is there a real need for that?

    opened by JoseTomasTocino 3
  • Moving outside popup menu title does not close menu

    Moving outside popup menu title does not close menu

    Repro:

    • Open https://imtui.ggerganov.com/
    • Open subsection "Popups & Modal windows"
    • Open subsection "Popups"
    • Click "File"
    • Move cursor down from "(dummy menu)" past "Save As.." to "Options"
    • Move cursor one entry down

    Expected:

    "Options" menu closes

    Actual:

    "Options" menu stays open

    Unrelated, it would appear as though there is a small rendering issue with the menu itself (screenshot attached) Screenshot from 2019-12-27 11-02-39

    bug 
    opened by tekknolagi 3
  • Help using imtui in personal project

    Help using imtui in personal project

    First of all apologies for this newbie question, but I am struggling with too many things at the same time: imtui, c++, cmakefiles, static vs dynamic libraries, etc. so I am not sure where the error may be, or whether my approach may not be the better one.

    Let me try to break out my problem in parts to make it easier for you to understand and advice

    First of all, what I actually want to do I want to create a dummy hello-world imtui example from scratch, and build it in my own ~/projects/imtui-hello folder, with as minimal cmake/dependencies as possible. This is, ideally I'd like to have a hello-imtui.cpp file so I can do something like g++ -Wall [-I SOME_INCLUDE -DSOME_OPTION -SOMETHING_ELSE] ./imtui.cpp.

    Can I do a simple build like that or do I actually need to use a CMakeFileLists.txt? Do I need to have the imgui forked dependency cloned on my hello-world folder (i.e. as in imtui/third-party/imgui? What if I install (make install) the (forked) imgui on its own to my system so I do not need to have a cloned imgui for each dummy folder I want to experiment with?

    Now, I know there is an examples/ncurses0 but I want to do something much more minimal (dummy box with "hello world" text) than this. Additionally, I am also totally getting lost with the amount of CMake stuff that I do not know how to "re-use" it for this bare minimum experimentation folder

    What I have done I've properly build imtui, and ran the examples that are generated on bin folder. I have also installed imtui by issuing a make install. This is, imtui is working and, in theory, properly installed.

    I am on Fedora 35 if that's of any help


    Again, apologies if I am missing something basic here...

    question build problem 
    opened by kiteloopdesign 2
  • cmake error linux

    cmake error linux

    `-- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
    -- Found CURL: /usr/lib64/libcurl.so (found version "7.69.1")
    -- Configuring done CMake Error at third-party/CMakeLists.txt:15 (add_library): Cannot find source file:

    imgui/imgui/imgui.cpp
    

    Tried extensions .c .C .c++ .cc .cpp .cxx .cu .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx

    CMake Error at third-party/CMakeLists.txt:15 (add_library): No SOURCES given to target: imgui-for-imtui

    CMake Generate step failed. Build files cannot be regenerated correctly.`

    build problem 
    opened by 0xtrzy 2
  • No output in tmux / screen

    No output in tmux / screen

    Using imtui from within a tmux session, I get a completely blank screen. Looking in the debugger, the render loop does appear to be running, but nothing is visible. I believe tmux uses the alternate screen itself, so maybe we're toggling out of that mode and sending output to the wrong place? I also tested from screen and see the same behaviour, so I don't think it's a bug in tmux.

    opened by davidchisnall 2
  • Upstreaming plans?

    Upstreaming plans?

    Do you have plans to upstream your changes to Dear ImGui? I would like to be able to dynamically choose between a TUI and a GUI (ideally even a remote web GUI) in a single binary but that requires a single version of Dear ImGui that I can use and have different code paths to enable backend-specific configurations within my tool.

    question 
    opened by davidchisnall 2
  • Navigation borders are huge and confusing

    Navigation borders are huge and confusing

    When keyboard navigation is enabled, the borders around the selected control are drawn two characters wide, with one character of space between them and the selected control. This is huge in general and in things like combo boxes is incredibly confusing.

    This can be fixed by patching ImGui::RenderNavHighlight method to disable both of the if (flags & ... blocks. It would be nice if the back end had some mechanism for telling Dear ImGui not to render these borders.

    bug 
    opened by davidchisnall 3
  • Mouse movement does not work under ncurses-6.2

    Mouse movement does not work under ncurses-6.2

    terminal emulator : windows terminal preview 1.12.2931.0 ncurses : 6.2

    Cannot receive mouse movement events

    Mouse movement works under ncurses-5.x, but not reporting mouse movements after columns 94

    opened by hardboydu 0
  • Mouse scrolling

    Mouse scrolling

    Is it possible to get mouse scrolling to work? So that it correctly scrolls regions with vertical tabbar.

    For eg, in this demo window, clicking on the scrollbar and dragging it works, but scrolling via mouse scroll button doesn't.

    image

    enhancement 
    opened by dufferzafar 3
  • Missing ImGUI controls

    Missing ImGUI controls

    Some controls are not rendered correctly in ImTUI. Here are some some obvious ones:

    • Separator
    • Spacing
    • Password InputText flag has no effect

    I wish you could add support for these controls too. I guess the problem comes from how these elements are rendered.

    enhancement 
    opened by afshinpir 2
Releases(v1.0.5)
:computer: C++ Functional Terminal User Interface. :heart:

FTXUI Functional Terminal (X) User interface A simple C++ library for terminal based user interface. Demo: Feature Functional style. Inspired by [1] a

Arthur Sonzogni 3k May 12, 2022
Command-Based Text Editor written in cpp using Linked Lists and Stack

Command Based Text Editor Our goal in this project is to write a command-based text editor in cpp using linked lists and stack. This text editor will

bedirhanbardakci 3 Jun 9, 2021
Library for creating terminal applications with text-based widgets

Library for creating terminal applications with text-based widgets FINAL CUT is a C++ class library and widget toolkit with full mouse support for cre

Markus Gans 625 May 11, 2022
Draw sequence diagram in text from terminal.

sequence-diagram-cli Draw seqence diagram from terminal.

null 42 Feb 28, 2022
Add a scrollbar to the kakoune text editor (experimental!)

Scrollbar.kak This is a scrollbar for kakoune, the educated programmer's terminal editor of choice. It uses the line-flagging feature and a compiled s

Sawdust & Diamonds 12 Nov 9, 2021
led is a line-oriented text editor in command line

led is a line-oriented text editor in command line. This editor is similar to the standard program on unix systems - GNU ed. But i'm not going to make an exact clone of that program, it's just a pet project.

Artem Mironov 9 Mar 4, 2022
udmp-parser: A Windows user minidump C++ parser library.

udmp-parser: A Windows user minidump C++ parser library. This is a cross-platform (Windows / Linux / OSX / x86 / x64) C++ library that parses Windows

Axel Souchet 86 May 1, 2022
CLI11 is a command line parser for C++11 and beyond that provides a rich feature set with a simple and intuitive interface.

CLI11: Command line parser for C++11 What's new • Documentation • API Reference CLI11 is a command line parser for C++11 and beyond that provides a ri

null 2.1k May 10, 2022
CLIp is a clipboard emulator for a command line interface written in 100% standard C only. Pipe to it to copy, pipe from it to paste.

CLIp v2 About CLIp is a powerful yet easy to use and minimal clipboard manager for a command line environment, with no dependencies or bloat. Usage Sy

A.P. Jo. 12 Sep 18, 2021
Collection of human friendly terminal interface for git.

A collection of human friendly terminal user interface for git.

Arthur Sonzogni 60 May 5, 2022
Add a command-line interface to any C++ program

Add a command-line interface to any C++ program

Empirical Software Solutions, LLC 402 May 10, 2022
A Command-Line-Interface Debugger for 64-bit Windows written in C.

Debugger-For-Windows A command-line-interface debugger for 64-bit Windows. [email protected]:/mnt/c/Projects/C/Debugger$ ./Debugger.exe ./Tests/test.ex

Tomer Gibor 1 Nov 3, 2021
C++ functions matching the interface and behavior of python string methods with std::string

Pystring is a collection of C++ functions which match the interface and behavior of python's string class methods using std::string. Implemented in C+

Sony Pictures Imageworks 717 May 8, 2022
This is a simple CLI interface helper library for C.

LIBCCLI This is a very simple shell like interface for CLI activities. More will be added to this, but for now, this is the basic idea:

Steven Rostedt 37 Apr 3, 2022
Alternative firmware for IP cameras based on the HiSilicon (and other) SoC's

OpenIPC v2.1 (experimental, buildroot based..) Alternative firmware for IP cameras based on the HiSilicon (and other) SoC's More information about the

OpenIPC 214 May 14, 2022
The KISS file manager: CLI-based, ultra-lightweight, lightning fast, and written in C

CliFM is a CLI-based, shell-like (non-curses) and KISS terminal file manager written in C: simple, fast, and lightweight as hell

leo-arch 481 May 10, 2022
Fegeya Freud, CLI FPaper renderer, based on Totem (`less`-like tool without `--help`)

Fegeya Freud, CLI FPaper renderer, based on Totem (`less`-like tool without `--help`)

Ferhat Geçdoğan 3 Jun 11, 2021
sc4cpp is a shellcode framework based on C++

sc4cpp is a shellcode framework based on C++

null 55 May 4, 2022
Simple, command line based player toolkit for the Ironsworn tabletop RPG

isscrolls - Command line based player toolkit for the Ironsworn tabletop RPG isscrolls is a simple toolkit for players of the Ironsworn tabletop RPG.

null 4 Mar 4, 2022