Can swipe left and right be captured as an escape sequence.

130 views
Skip to first unread message

Greg Field

unread,
Aug 19, 2022, 8:04:38 AM8/19/22
to iterm2-discuss
Some time ago a nice feature was introduced that swiping left and right on the Apple mouse top causes iTerm to jump to the adjacent open iTerm tab, on the left or right.

Can these mouse actions be re-directed to output an escape sequence which I can then capture and map to a scroll left and right in my software ? (an editor)   https://groups.google.com/g/open-ed

If that is not possible, is there a setting in preferences to disable this feature ? I use swipe gestures (up and down) a lot in my software and I am often causing this (left-right) action accidentally.

-G

Richard Mitchell

unread,
Aug 19, 2022, 8:22:01 AM8/19/22
to iterm2-discuss

The Window menu bar tab has this:

MenuBar.png

There is also this under Preferences -> Advanced -> Tabs

Advanced.png

Maybe between the two, you can get it to work the way you want ?

Greg Field

unread,
Aug 21, 2022, 2:46:04 AM8/21/22
to iterm2-discuss
Hi Richard.

Thanks for replying, but unfortunately the best this allows is to turn swipe off.

I used Settings > Mouse > ‘Swipe between pages’  to turn it off.

What would be great is for swipe left and right to generate an escape sequence.

I suspect an escape sequence to report current status and set swipe action would be needed too.

Is there an iTerm wish list somewhere ?

Thanks. 
-G

Richard Mitchell

unread,
Aug 21, 2022, 8:47:45 AM8/21/22
to iterm2-discuss

George Nachman

unread,
Aug 22, 2022, 3:43:58 PM8/22/22
to iterm2-...@googlegroups.com
Sorry, this feature is hard-coded to switch tabs. It’s mean to implement the standard swipe gesture in macOS and isn’t amenable to sending an escape sequence since it is a highly interactive gesture. 

Although the mouse reporting spec has a way of communicating extra buttons (so you could map horizontal scrolling to some of them) I’m not aware of an application that could take advantage of it. What did you have in mind?

--
You received this message because you are subscribed to the Google Groups "iterm2-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iterm2-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iterm2-discuss/fcfa7df0-54b6-4bb6-98b4-22aec1063f4fn%40googlegroups.com.

Greg Field

unread,
Aug 23, 2022, 12:58:38 AM8/23/22
to iterm2-discuss
Hi George.

My software is a text editor that uses ncurses extensively and has extended features for iterm2.

It is the same app that you fixed iterm2 to do italics for, many many years ago. :-)

 If the terminal is iterm2, then I have hooks to do other iterm2 features such as changing the cursor between block and vertical line while inserting text.

I use ncurses mouse handling to add vertical scrolling. See  man getmouse. In the MEVENT word, besides the documented BUTTON_ events, there are also undocumented events for scrolling up and down. I return these to my app as MOUSE_SCROLL_UP and MOUSE_SCROLL_DOWN and these are a joy to use while moving around coding text. You can scroll up and down in text by line or page. This is with the Magic Mouse upper scroll surface.

When left and right scrolling started changing iterm2 tabs, the thought jumps out to do left and right scrolling within the page of text in my app. It would not matter that these are not in ncurses : I am pretty good at writing hooks around that.

However as soon as I saw that to turn off left/right swipes is in Macos > Settings > Mouse, as Richard showed, then I realised it may not be controllable by iterm2. 

If it is not easy, then at least I asked and it is in the iterm2 suggestion box. Thank you for listening. :-)

Cheers
-Greg.

George Nachman

unread,
Aug 23, 2022, 1:46:59 AM8/23/22
to iterm2-...@googlegroups.com
A two finger horizontal motion on a trackpad is first presented to a cocoa app as a scroll event, and apps may choose to handle scroll events by entering the tab switching mode, so it’s totally doable.

I guess it wouldn’t be hard to extend (Neo)vim to support horizontal scrolling. I’d like to have plans for support from other apps before adding the feature, since otherwise it’s a good bit of work with a relatively small benefit.


Greg Field

unread,
Aug 24, 2022, 12:10:16 AM8/24/22
to iterm2-discuss
I would be the first to say, if it is not easy, then make it a low priority.

For the record, on the mouse these are single finger gestures. Two finger on the trackpad seems to equate to single finger on the mouse.
So it would be a two finger gesture on the trackpad and single finger on the mouse, as it currently works for scroll up/down. (I think).

Reply all
Reply to author
Forward
0 new messages