alacritty icon indicating copy to clipboard operation
alacritty copied to clipboard

Increase/Decrease font size with Mouse Wheel

Open raphaelfournier opened this issue 4 years ago • 8 comments

I would like to map the IncreaseFontSize and DecreaseFontSize actions to my mouse wheel up and down movements, with a Shift (or Ctrl) mod (so that the regular scrolling is also preserved).

This works (obviously):

mouse_bindings:
  - { mouse: Middle, mods: Shift, action: IncreaseFontSize }

I read in the config comments: "- Numeric identifier such as 5". But this does not work:

mouse_bindings:
  - { mouse: 5, mods: Shift, action: IncreaseFontSize }

By "does not work", I mean: in AwesomeWM, "mousewheel up" is bound to 4, and "mousewheel down" to 5. I tried with several other integers, to no avail.

Is there a simple command to know which are the codes sent by the mouse wheel movements?

I tried with my current MX Master 3 mouse, but also with an old no name usb mouse.

System

OS: Linux Version: alacritty 0.8.0 (a1b13e68) Linux/BSD: X11, AwesomeWM

raphaelfournier avatar Jul 01 '21 09:07 raphaelfournier

Binding to scrollwheel is not possible. I'm also not entirely sure how useful that is.

chrisduerr avatar Jul 01 '21 16:07 chrisduerr

OK, thanks for the very quick answer. Regarding the usefulness: I regularly switch between a "laptop only" mode and 2 different "external displays" setups. So I often need to change the font size quickly and significantly, according to the display configuration I am using (even aggravated by the fact that I have a high myopia). The keyboard shortcuts are useful (thanks!), but I found that I had to type a lot of times and wondered if it could be better. A feature which would help (but won't probably happen): a hadful of font size presets, quickly available with shortcuts.

However, I still wonder: what are the possibilities behind "- Numeric identifier such as 5" in the "mouse binding" section of the config file? What (integers) can we bind and how can we know what codes are sent by our mouse buttons?

raphaelfournier avatar Jul 01 '21 16:07 raphaelfournier

However, I still wonder: what are the possibilities behind "- Numeric identifier such as 5" in the "mouse binding" section of the config file? What (integers) can we bind and how can we know what codes are sent by our mouse buttons?

It's for extra mouse buttons.

chrisduerr avatar Jul 01 '21 16:07 chrisduerr

Just to be clear: I wouldn't be opposed to this in theory, it's just that scrolling is never sent to us as button presses and things like touchpads obviously behave a bit differently when it comes to this. So I believe that implementing this would probably get a bit messy trying to special-case this.

chrisduerr avatar Jul 01 '21 16:07 chrisduerr

Hey there, I will jump on this bandwagon because I think it fits my question and is quite recent.

I was looking for something similar (different fontsize presets) not for different monitors, but for screen sharing. I always increase the fontsize a bit for presentations.

There is a keybinding for ResetFontSize, what about introducing SetFontSize n? (without looking at the code) I would naively assume that those commands would/could do the same, and Reset is just Set with a default argument (the standard font size)

nbiederbeck avatar Aug 05 '21 10:08 nbiederbeck

I have the same use case, using ctrl+scroll to increase/decrease font size for screen sharing. konsole does it & would be great if alacritty could as well. I'm still using X11, not Wayland.

josephtingiris avatar Jan 26 '23 14:01 josephtingiris

Hope to add this feature! Konsole has this, use Ctrl + mouse wheel to increase/decrease font size (it feels like zoom in and out, focus on specific part or output of terminal) and it feels very smooth and free.

thomjiji avatar Dec 16 '23 13:12 thomjiji

Ctrl+scroll to increase/decrease font size is kind of a standard feature. Chrome, Firefox, Cygwin, Konsole, Kate, just to name a few.

danielfaust avatar Jan 26 '24 18:01 danielfaust

duplicate of #2512

kchibisov avatar Feb 23 '24 13:02 kchibisov