I have a Logitec M705 mouse with the “free spinning” scroll wheel, which is very nice for quickly scrolling down a webpage or sifting through some code. I also use a lot of keyboard shortcuts that include the CTRL button. This often leads to the CTRL key being pressed while the mouse wheel is still scrolling, and that often leads to unwanted zooming. This mostly affects me when using Chrome (zooms the page in or out), or when using Sublime Text (increases or decreases the font size).
I finally got frustrated enough to look for a solution.
I found this article about setting up new key bindings using xbindkeys, and it turned out that I already had some shortcuts set up in there. Following the instructions on that page, I was able to determine that the mouse scroll up and down were assigned to b:4 and b:5, and after some experimentation, I was able to bind CTRL + Scrolling to /bin/true.
Here are the lines that I’ve added to the .xbindkeysrc file in my home directory. If you don’t have xbindkeys installed or set up, you can follow the instruction in the article I linked to above (be sure to set it up to auto-start).
# disable ctrl + scroll wheel by binding it to /bin/true "/bin/true" Control + b:5 + release "/bin/true" Control + b:4 + release
After updating .xbindkeysrc you’ll need to open your terminal and kill xbindkeys and restart it to get your changes to take effect.
killall xbindkeys && xbindkeys
If you get an error about the xbindkeys process not being found, then it’s either not installed, or wasn’t running. If it is installed, you can get it going by running the xbindkeys command in the terminal.
If everything worked correctly, CTRL + Scrolling will no longer cause zooming in any applications.