termux-app icon indicating copy to clipboard operation
termux-app copied to clipboard

Add support for mouse gestures.

Open Neo-Oli opened this issue 8 years ago • 8 comments

In certain programs you can use mouse gestures to do various tasks, for example:

  • tmux lets you resize panes with click and drag.
  • weechat has swipe left and right gestures to switch buffer.

This works when connecting to termux via SSH from a computer with mouse but it does not work when using the termux app. I realize that this would cause a conflict with the swipe to scroll feature, but maybe we can come up with a solution that can incorporate both these features. Some ways I came up with:

  • Move the long press menu into the left side drawer and have long press function as a click and drag.
  • Have a switch (or one time function like select) in the long press menu to switch between click and drag and scroll. In the two programs I came across with mouse dragging it is not something you have to do all the time, so having an additional step between might not be that bad.

Maybe someone has a better idea?

Neo-Oli avatar Jan 06 '16 15:01 Neo-Oli

What do you think about doing the following for programs enabling terminal mouse events?

  1. One finger down and dragging: Treat as mouse button down and dragging mouse.
  2. Two fingers down and dragging: Treat as mouse wheel scroll events (this is what is currently done now regardless of fingers down).

fornwall avatar Jan 07 '16 00:01 fornwall

I like it, but then it should probably be an optional configuration. A first time user would probably be confused and it might be annoying for people who don't use programs with mouse dragging.

Neo-Oli avatar Jan 07 '16 08:01 Neo-Oli

I also need this feature. :-) It can really help a lot if I can drag the window easily (as well as selecting text).

sunziping2016 avatar May 24 '16 16:05 sunziping2016

I am now tring to add this feature by myself and I treate double tap and drag as mouse click down and drag. It seems awesome. I am going to do some further test.

sunziping2016 avatar May 25 '16 01:05 sunziping2016

If there is a way to tell that there is a physical mouse connected to device, and mouse events are coming from that physical mouse, then these could be handled differently. This would allow using mouse for some nice UI usability features, the one I would really love to have is a linux-style mouse select and copy/paste in the terminal

galets avatar Jun 23 '22 03:06 galets

I think the most refined way to implement this, is doing exactly what touchpads on laptops offer. It rests on decades of experience on what works best.

They have many variations, some more and some less annoying. My favorite ”average Joe“ one is:

  • Normal touching and moving one finger is moving the pointer with no clicking , aka our beloved and missed hovering! Tapping a second finger while doing that, causes a left click. One more finger a right click. Dragging with two fingers (position of first finger decides pointer position) causes selection or dragging (like of icons). Three fingers dragging would be (2D!) scrolling. Which sadly lacks the middle click that is quite important for Linux terminals as it usually means "paste" (like in GPM and X) or sometimes "close".
  • There is a stupid patent (it is not stupid, but that it is considered patentable is stupid) where clicks happen on lifting the finger. I implemented it once, and it has its own just as annoying/limiting problems.
  • A nice and more ”pro“ solution is to reserve a virtual mouse buttons area at the bottom, so the first finger is always just the hovering pointer, while the virtual buttons only respond to the second finger. This has the advantage that when the virtual buttons are made invisible or transparent, one can still use and click on the whole screen. Using the second finger outside of the buttons area would result in scroll wheel events, where the wheel direction is based on the second finger’s position, so the pointer position can stay usable. Very simple and elegant, while uncompromizing and full-featured. And it reduces accidential clicks when trying to hold a silly candy bar phone too. If that is added to Termux, I would have one additional killer feature to add, that I would not want to disclose otherwise.

I highly second configurability too. Look at how many options and ways to use it even the basic touchpad implementation e.g. on Linux Mint has. Lets everyone be happy, which is nice. :)

navid-zamani avatar Aug 17 '22 01:08 navid-zamani

@galets: The standard Unix way is that the different input devices are different (character) device files. You have the software read from the device file you want to use as input. This could be done by the terminal, or by the program running inside it itself. You can cat /dev/input/event* on Linux and watch the data mess up your terminal as you move the mouse. ;) Of course Android, as the saying goes, will fail to understand Unix, and reimplement it, badly, again. ^^ And /dev is not accessible to Termux anyway without root. (Damn n00bs! *shakes fist* :D) The above is the general principle for Linux programs too though.

navid-zamani avatar Aug 17 '22 01:08 navid-zamani

I think the most refined way to implement this, is doing exactly what touchpads on laptops offer. It rests on decades of experience on what works best.

I don't think that's a good idea, touchpads are typically used with the index finger so it's easy to use multiple fingers. Phones however are usually used with the thumb, so multi-finger operations are more inconvenient. I would assume scrolling in the terminal is used way more than hovering (which is pretty niche in a terminal), so having to use three fingers for scrolling while one finger is for hovering would be wildly inconvenient.

trygveaa avatar Aug 17 '22 10:08 trygveaa