Skip to content

config: add gtk-horizontal-tab-scroll option - #12659

Merged
jcollie merged 2 commits into
ghostty-org:mainfrom
00JCIV00:config/gtk-horizontal-tab-scroll
Jun 27, 2026
Merged

jcollie merged 2 commits into
ghostty-org:mainfrom
00JCIV00:config/gtk-horizontal-tab-scroll

Conversation

@00JCIV00

Copy link
Copy Markdown
Contributor

I've implemented a GTK toggle (gtk-horizontal-tab-scroll) for the 2-finger tab swiping introduced in #10575.

This resolves the issue presented in #11566. Simply put, this allows users to decide whether or not they want to use horizontal tab scrolling or just have the events passed through. Passing through the horizontal scroll events allows programs like Neovim to use them for horizontal scrolling.

This PR was largely generated by Claude Code and fully reviewed/refined by me.

Add a boolean config option to enable/disable two-finger horizontal
touchpad scrolling for switching tabs. Defaults to true to preserve
existing behavior.

When tab scrolling is disabled or the scroll source is not a touchpad,
forward horizontal scroll events to the terminal so applications like
neovim can handle them.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@00JCIV00
00JCIV00 requested a review from a team as a code owner May 11, 2026 15:51
@Ind-E

Ind-E commented May 12, 2026

Copy link
Copy Markdown

tested this, and it allows me to use touchpad and horizontal scroll wheel to scroll in nvim

Comment thread src/config/Config.zig
@jcollie
jcollie enabled auto-merge May 18, 2026 02:13
@sargunv

sargunv commented Jun 26, 2026

Copy link
Copy Markdown

I use a trackball with drag scrolling, so vertical scrolls often have some small horizontal delta too. This means when I'm scrolling quickly in Ghostty, I end up switching tabs accidentally, and it prevents me from switching to ghostty full-time on Linux.

Can confirm this PR resolves the issue for me.

@jcollie
jcollie merged commit e5b65a2 into ghostty-org:main Jun 27, 2026
90 checks passed
@github-actions github-actions Bot added this to the 1.4.0 milestone Jun 27, 2026
@3v1n0

3v1n0 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

@00JCIV00 this is a much appreciated option, although this is still a bit buggy, and you can feel when using devices such as a trackpoint:

  • While now horizontal scrolling does not switch tab anymore, it still "handled" as no-event.
  • That implies that when you scroll and you inadvertently also scroll a bit in the x axis, scrolling blocks

@00JCIV00

Copy link
Copy Markdown
Contributor Author

@3v1n0 I'm not fully understanding the issue you're describing. Can you layout your desired behavior and how this change goes against that?

The intent behind the change isn't to block horizontal scroll events, but rather to have them pass through to underlying processes instead of being consumed by Ghostty. This allows processes that support horizontal scrolling (such as neovim) to work properly.

Admittedly, I've only tested it on a touchpad and a mouse. If it's not doing the above on a trackpoint, I'm happy to take another look.

@3v1n0

3v1n0 commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Admittedly, I've only tested it on a touchpad and a mouse. If it's not doing the above on a trackpoint, I'm happy to take another look.

A trackball may behave the same, and also a touchpad; in general:

  • When you scroll up in the history, you may actually end up scrolling slightly (up-right or up-left)
  • If the left/right events (x axis) are present in the scroll event, then ghostty stops scrolling up completely rather than just continuing going up as it happens normally in any other window

if (priv.pending_horizontal_scroll_reset) |v| {
_ = glib.Source.remove(v);
priv.pending_horizontal_scroll_reset = null;
return @intFromBool(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is this one, it should return false otherwise we consume the event.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants