disable scroll wheel (mouse/trackpad) from zooming when you're typing (or just ever)

505 views
Skip to first unread message

Jonathan Zacsh

unread,
Feb 12, 2016, 1:02:59 PM2/12/16
to chromium-hterm
tl;dr maybe add the following JS to the "scroll-wheel-move-multiplier=0" setting?

So I just figured out that *sometimes* my hterm zooms in and out unexpectedly because my Thinkpad's trackpad detects touch from my palm, while i'm typing. I'd thought I disabled this by setting the hterm option "scroll-wheel-move-multiplier" to zero, but the problem is this happens when I'm holding down Control key (ie: lots of tmux actions).

To reproduce:
- set scroll-wheel-move-multiplier to zero
- open hterm
- hold control key
-- two-finger scroll on trackpad
- bug: zoom happens

solution: open js console and add:
  window.onwheel = function(e) { e = e || window.event; e.preventDefault(); e.returnValue = false; };

Maybe the above options and "ctrl-plus-minus-zero-zoom" could just covered in a single new option that's, "try-really-really-hard-to-prevent-browser-zoom"?

Cheers,
Jon

Jonathan Zacsh

unread,
Feb 12, 2016, 1:07:07 PM2/12/16
to chromium-hterm
perhaps relevant thread: https://groups.google.com/a/chromium.org/d/msg/chromium-hterm/DB90V55mjfs/gxqtj1s4SXsJ

I think Robert felt there wasn't a need to do this, so I'll just add: in my case, I never want my terminal to know about scrolling (I think this is "scrollback buffer" in other emulators? I usually set that to zero if I recall correctly), because I use a multiplexer and it just causes all kinds of confusion.

Robert Ginda

unread,
Feb 12, 2016, 1:20:38 PM2/12/16
to Jonathan Zacsh, chromium-hterm
Which multiplexer do you use?  tmux supports xterm mouse mode, and if you enable it, click (and therefore scroll wheel) events should get sent to tmux rather than to the scrollbars.  As a bonus, you may even be able to get tmux to do the right thing with the scroll events.

--
You received this message because you are subscribed to the Google Groups "chromium-hterm" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-hterm/CAAH9RPWZOSXRetKJ%3DO4v7VJBt%3Ds0xWkpg5jjGMX%3DFDXx%3D8fFvw%40mail.gmail.com.

Jonathan Zacsh

unread,
Feb 12, 2016, 1:34:30 PM2/12/16
to Robert Ginda, chromium-hterm
Oh, this is really interesting. Thanks for explaining. I've not heard of this before. (Yes, I'm using tmux)

So, if I understand correctly, my palm-detection-issues (read: linux trackpad palm detection is awful) will just be sent further down the line. If that's the case, that's certainly much better than hterm taking on the burden of this problem.

Perhaps the best solution (aside from palm detection being better) is that I just inject my snippet into hterm with a user-js extension...

Thanks again, Robert!

Robert Ginda

unread,
Feb 12, 2016, 2:20:24 PM2/12/16
to Jonathan Zacsh, chromium-hterm
On Fri, Feb 12, 2016 at 10:33 AM, Jonathan Zacsh <jza...@gmail.com> wrote:
Oh, this is really interesting. Thanks for explaining. I've not heard of this before. (Yes, I'm using tmux)

So, if I understand correctly, my palm-detection-issues (read: linux trackpad palm detection is awful) will just be sent further down the line. If that's the case, that's certainly much better than hterm taking on the burden of this problem.

Yeah, it is sort of kicking the can down the line to tmux, but you can probably tell tmux to either deal with the wheel events in a sane way or ignore them altogether.


Perhaps the best solution (aside from palm detection being better) is that I just inject my snippet into hterm with a user-js extension...


I'm not sure if you can target the user-js extension at a chrome extension, maybe.
 
Thanks again, Robert!


You're welcome!

Brad Town

unread,
Feb 12, 2016, 3:41:12 PM2/12/16
to Robert Ginda, Jonathan Zacsh, chromium-hterm

Since scroll support between hterm and tmux is something I’ve been tweaking in my own setup recently, I thought I’d share my own setup.

In hterm’s settings, I have scroll-wheel-move-multiplier set to 1. The relevant portion of my .tmux.conf (I’m running tmux 2.1 – these settings as written probably won’t work with earlier versions):

# Enable mouse support.
set -g mouse on

# Toggle mouse support.
bind-key M set -g mouse \; display "Mouse mode #{?mouse,on,off}."

# Send mouse-scroll-down to the correct pane.
bind-key -T root WheelDownPane select-pane -t {mouse} \; send-keys -M

# Automatically enter edit mode when we see mouse-scroll-up.
bind-key -T root WheelUpPane if-shell -F -t {mouse} "#{mouse_any_flag}" "send-keys -M" "if-shell -F -t {mouse} '#{pane_in_mode}' 'send-keys -M' 'select-pane -t {mouse} ; copy-mode -e ; send-keys -M'"

# Enters copy mode in the mouse's pane for Ctrl+<mouse-scroll-*>.
bind-key -T root C-WheelDownPane select-pane -t {mouse} \; copy-mode -e \; send-keys -M
bind-key -T root C-WheelUpPane select-pane -t {mouse} \; copy-mode -e \; send-keys -M

# Considering these.
bind-key -t emacs-copy C-WheelDownPane halfpage-down
bind-key -t emacs-copy C-WheelUpPane halfpage-up
bind-key -t vi-copy C-WheelDownPane halfpage-down
bind-key -t vi-copy C-WheelUpPane halfpage-up

If you don’t want tmux doing anything with the scroll wheel, you can use settings similar to these (you still need tmux’s mouse support for these to work):

# Eat scroll wheel events.
bind-key -T root WheelDownPane run "true"
bind-key -T root WheelUpPane run "true"
bind-key -T root C-WheelDownPane run "true"
bind-key -T root C-WheelUpPane run "true"
# TODO(townba): Do I need other modifier-key versions? How about *Border or
# *Status versions?

As a side note, if you’re on a Mac and OS X is zooming when you’re pressing Control and using the scroll wheel, you can change that behavior by going to System Preferences → Accessibility → Zoom. You should see “Use scroll gesture with modifier keys to zoom” is enabled and set to “⌃ Control”. Consider either disabling it or changing the modifier keys to “⌘ Command” (an option in the drop list) or maybe “⌃⌘” (put focus in the edit control and press “Control” and “Command” together).

Brad Town


To unsubscribe from this group and stop receiving emails from it, send an email to chromium-hter...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-hterm/CA%2BSC%2BVqdFXWb2pdp7o-qsfG_O1cxf9OXjV_nr-UjKfJA229EXg%40mail.gmail.com.

Reply all
Reply to author
Forward
0 new messages