I did it on Ubuntu 20.04
Thanks to Zatigem's answer on a question about the Sleep button
I found it by chance so maybe it helped that I started by disabling "start the calculator" in Ubuntu Shortcuts, as well as
$ gsettings set org.gnome.settings-daemon.plugins.media-keys calculator-static "['']"
Let's find the code
$ xmodmap -pk | grep -i calc
148 0x1008ff1d (XF86Calculator) 0x0000 (NoSymbol) 0x1008ff1d (XF86Calculator)
Edit /usr/share/X11/xkb/keycodes/evdev
as root.
Comment the line containing the number you saw (148
for me) by adding //
at the beginning
// <I148> = 148; // #define KEY_CALC 140
Restart the gnome GUI (you won't lose any open app):
Press Alt+F2, type the letter r, press Enter
gnome takes some seconds to come back to normal.
Now pressing the Calc button does nothing, but you can't use anymore in shortcuts.
So let's re-enable it, by editing again the evdev
file and removing the //
we put.
Restart gnome GUI again.
Now the Calc button does nothing and you can use it in shortcuts.
(I'm not sure all the steps are necessary, and if it still works after reboot.)