fathyb / carbonyl

Chromium running inside your terminal
BSD 3-Clause "New" or "Revised" License
14.65k stars 286 forks source link

Mouse unsupported #57

Open RafaelLinux opened 1 year ago

RafaelLinux commented 1 year ago

As "browsh" similar browser, when I'm in a true console (not emulated in Xorg) mouse is not recognized, so I can't do nothing but move up-down.

Binary-Eater commented 1 year ago

Personal untested suggestion: Use GPM to support mouse usage in Linux virtual consoles.

RafaelLinux commented 1 year ago

I wrote was not emulated, but real boot in PC ;)

Binary-Eater commented 1 year ago

GPM has nothing to do with QEMU vs real-boot. It works on real-boot systems. The common use case is in QEMU envs.

EDIT: and yes GPM was designed for getty consoles originally. Not Xorg. (I typically use the term emulated for QEMU, not xterm vs a Linux virtual console). Imagine being able to use your mouse in the booted console without Xorg. That's what GPM is for.

Binary-Eater commented 1 year ago
The gpm (general purpose mouse) daemon tries to be a useful mouse
server for applications running on the Linux console.  Its roots are
in the "selection" package, by Andrew Haylett, and the original code
comes from selection itself. This package is intended as a replacement
for "selection", to provide additional facilities.  From 0.18 onward
gpm supports xterm as well, so you can run mouse-sensitive
applications under X, and you can easily write curses applications
which support the mouse on both the Linux console and xterm. The xterm
code is portable to any U*x flavour (look at sample/README).

https://github.com/telmich/gpm

Binary-Eater commented 1 year ago

Some additional information on the term Linux virtual consoles (not equivalent to xterms/emulators).

https://en.wikipedia.org/wiki/Virtual_console

In the Linux console and other platforms, usually the first six virtual consoles provide a text terminal with a login prompt to a Unix shell. The graphical X Window System traditionally starts in the seventh virtual console (tty7), although this is configuration dependent.

RafaelLinux commented 1 year ago

Thanks for reply and for all links with very interesting information. I gather from the information that there is no immediate way to be able to use the mouse on a terminal without using X.org / Wayland, without the need to install additional software. I thought I could use both the mouse and the cursor movement keys to scroll through menus and links, but I can't, so this browser finally (for me) loses its usefulness as a web browser without a windowed environment.

Yamakuzure commented 1 year ago

What? gpm is not only tiny but also sort of standard tool. It is even listed in the BLFS book

The mouse is a hardware device. Complaining that Carbonyl does not drive a hardware device is like complaining that VI doesn't do it.

RafaelLinux commented 1 year ago

I must say that if I try to use mouse with MC (midnight commander) in a real command terminal (not a desktop window) doesn't work neither!!! while mouse works with MC in a desktop window ... :( Maybe there is no way to get mouse interactivity thru real console.

Binary-Eater commented 1 year ago

I must say that if I try to use mouse with MC (midnight commander) in a real command terminal (not a desktop window) doesn't work neither!!! while mouse works with MC in a desktop window ... :( Maybe there is no way to get mouse interactivity thru real console.

I don't really understand this complaint considering it is well documented that MidnightCommander, etc, needs GPM to use a mouse with what you are calling a "real console".

https://tldp.org/LDP/LG/issue23/wkndmech_dec97/mc_article.html

GPM was designed to be a way for people in the 1990s to be able to use their mouse devices with said "real console".

Btw, what you are calling a "real console" is typically called a "virtual console" since multiple tty devices are hooked into the system console functionality.

RafaelLinux commented 1 year ago

I'm sure I explained bad myself. When I talk about "real console" I'm talking about I'm booting a Linux without windows desktop, not a virtualized console in any way, so I'm working in an environment without GUI (init 3 state).

Binary-Eater commented 1 year ago

Yes, and you can use GPM in that state without any GUI to bring mouse support in that mode for MidnightCommander or carbonyl.

Binary-Eater commented 1 year ago

mouse support in xterms under X or at the Linux console via the gpm mouse server

This quote is from the documentation I linked in a previous message. It would be weird for mc and other programs to individually write mouse HW support when there is a universal mouse server program for Linux "real console" use.

traysh commented 1 year ago

@Binary-Eater I tried gpm. I can see the cursor moving, but it can't click or interact with anything. Did it work for you?

Binary-Eater commented 1 year ago

@Binary-Eater I tried gpm. I can see the cursor moving, but it can't click or interact with anything. Did it work for you?

Will test this out on the weekend and report back. Since mouse event handling is a standard, figured mouse clicks should register out of the box.

RafaelLinux commented 1 year ago

I expected Carbonyl was able to support mouse by itself.

Yamakuzure commented 1 year ago

I expected Carbonyl was able to support mouse by itself.

Nothing, and I literally mean nothing, supports a mouse in any tty without gpm. Once you have accepted that, we can move on.

However, I did try out carbonyl from a tty, and it is pretty much useless. The display is totally garbled, you can not make out any forms (Was a gitlab front page) and as RafaelLinux pointed out, the mouse does not really do anything when clicking anywhere.

It seems that carbonly currently needs an xterm, because using ssh to the same machine via konsole and starting carbonyl through that shows a beautiful gitlab login page. I can even watch videos on youtube with it. (Okay, that is not advisable, though, but the rendering speed is amazing!)

But to be honest, I kind of expected this, as carbonyl is based on chromium, using all sorts of libX* stuff. Even libwayland is linked to it. The pure rendering to ASCII-Art is not enough, or at least not really functional, yet.

@fathyb : Maybe libcaca (A library that creates colored ASCII-art graphics) or aalib (An ASCII-Graphics Library) may be helpful. A look at aview (An ASCII Image viewer) and how they do it might help.

RafaelLinux commented 1 year ago

I have to admit that I was surprised that neither MC or Yast supported the mouse by themselves, so I understand that you are right about that. I was unaware of the need to have GPM installed beforehand to be able to use the mouse, so I'm going to close this issue, as I understand that GPM is not normally installed in the vast majority of Linux distributions.

Thank you to all for helping

traysh commented 1 year ago

I'm not sure this should be closed, as mouse is not supported both with or without GPM.

Then, yes, carbonyl is useless in plain console, but that would be another bug.

RafaelLinux commented 1 year ago

I've closed it because I can't ask Carbonyl to have features implemented that other tools that have been in development for decades like Midnight Commander don't have either, so I deduce that enabling mouse functionality is something that should be implemented either in the kernel or by loading a module. Just my humble opinion.

fathyb commented 1 year ago

But to be honest, I kind of expected this, as carbonyl is based on chromium, using all sorts of libX* stuff. Even libwayland is linked to it. The pure rendering to ASCII-Art is not enough, or at least not really functional, yet.

FWIW I merged a commit yesterday that removed all X and Wayland dependencies. The next version only requires 4 dependencies: https://github.com/fathyb/carbonyl/blob/cbc0a5fd79d1895edba83f1fe00d06ec02f6852a/Dockerfile#L27

The same commit also brought a bitmap renderer:

https://user-images.githubusercontent.com/5746414/218641639-4520bcd4-8a66-4d1f-aca1-d2d5bb148bb0.mp4


I'd love to see this feature get implemented, so if you'd like native mouse support, feel free to re-open this issue or open a new one. I might not be able to implement it soon, but someone else might be. It should only require changes to the Rust code, so no need to be familiar with Chromium or build it.

Something we could also do is simply document how to get Carbonyl to work on a Linux virtual console.

Yamakuzure commented 1 year ago

That's absolutely amazing! Wow!

fanthos commented 1 year ago

I am using ssh and trying to run Carbonyl using docker. I can get mouse works in vim and nano, but not in Carbonyl. I tested Carbonyl using WSL2 Windows Terminal in Docker, mouse works good. Is there any configuration I missed to make Carbonyl to work?

john-peterson commented 3 months ago

i am no expert on mouse input just know that browsh works and carbonyl doesn't in termux. both natively and remote shell. although browsh crashed in remote shell and carbonyl show only a blank page natively

cli-mouse-test sought

i have looked for a cli mouse tester because I want to implement horizontal wheels in termux for horizontal swipe. we connect vertical swipe to vertical wheel