I'm having the same problem as this person: Fn Media keys slow/delayed on ubuntu gnome 17.04
I've already looked everywhere, and I could not find an answer. AskUbuntu, the Arch Wiki, Reddit, Discord, IRC, etc. Nothing. I don't think I can put much more detail into this because it's the same problem and it happens every time without fail. Not happening on Wayland, so indeed an Xorg issue.
This also happens on the Budgie desktop and on the default Gnome desktop, so I'm starting to think that this is something to do with Gnome/GTK but I have no idea how to fix it on my system, absolutely no clue.
I'm on Ubuntu 17.10, on Intel Integrated Graphics on an i3 3217U and 8GBs of RAM. Laptop model is an ASUS X550C.
Gustavo, I answered a similar question and I think it might help you:
Original answer on https://askubuntu.com/a/1072160/867840 :
For some reason my Gnome freezes when using Fn keys, or when I try to use 2 keyboards. A friend of mine pointed to me that it occurs when switching to a keyboard layout that has Scroll Lock enabled, so I disabled it in the X11 keyboard layout file for my language and it solved the problem.
The steps I followed are:
These steps are specific for the Brazilian Portuguese ABNT2 Layout and may not work for other layouts, but it can help you find a similar solution.
I had the same problem, but instead of FN keys my problem was with the CTRL key. Whenever I pressed CTRL, gnome-shell CPU usage spiked!
So I figured out that my keyboard layout was set to en-GB, United Kingdom while my keyboard layout is en-US! While the difference between the two layouts is minimal, it still somehow bugged the whole gnome-shell. So if anyone having the same problem, double check your keyboard layout from Gnome Settings!