-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create buttons in the terminal #118
Comments
CLUI has decent mouse support: |
@brandon93s That only works as a website themed as a terminal, not in an actual one. |
😅 I was duped by the demo! Wishful thinking I guess. |
@Richienb What problem are you trying to solve? Generally, I don't think people would expect to be able to use a mouse in the terminal. |
@sindresorhus Terminal buttons can be used instead of having to use Electron for small mockups. |
Emacs has support for renderinq its buttons and menus in terminal mode. It also has support for responding to taps in Termux, which makes me suspect that mouse support in the terminal is possible; but I might be wrong about that, it might be something fancy and unusual that Termux is doing. (Emacs' terminal buttons are the one thing that doesn't work very well with taps in Termux, and running it in an ordinary terminal on my laptop has never allowed me any mouse interaction at all.) All this leaves me unsure whether mouse interaction with terminals is a thing. If it is a thing, it probably is only possible on certain terminal emulators, and the code to use it might differ from one to the next. |
Windows Terminal/WSL also seems to have mouse support. (microsoft/terminal#5075) |
Using terminal-kit, it's possible to easily receive mouse events in the terminal. The only challenge here is detecting if the coordinates of the mouse click line up with those of the button of which somehow must be detected. |
This seems to be possible on macOS/Terminal/bash: https://stackoverflow.com/a/28916388/288906 But really… if I'm in the terminal I will continue using whatever interface with my keyboard. If you're looking to have an interactive UI in the terminal, perhaps look into https://github.com/vadimdemedes/ink |
@fregante The end goal is to create clickable elements in the terminal. An example of how this can be used is in emoj. It currently allows using the left and right arrow keys to scroll through options: Making these elements clickable is an incremental change that is definitely an improvement here. |
I have found a way to get the current cursor position in the terminal to detect where clickable elements are located so this should now be possible. |
I'm not sure if this is possible: create clickable buttons in the terminal that act in a similar way to links except they trigger a callback.
Support information
The text was updated successfully, but these errors were encountered: