On Linux (Ubuntu and Raspberry Pi OS) I use Visual Studio Code, but compiling or more specifically on the Terminal menu, Run Build Task defaults to Ctrl-Shift-B. Being lazy and a long time user of Visual Studio with it’s F6 key, I decided to change this.
First get the Keyboard Shortcuts form up. This is done by Ctrl K, Ctrl S. Jusr hold the control key down then press k then s. You should see this form appear.
Then type in Run B to have it filter and just show the Command we want to remap. Double click that first line and a popup will appear. Press the Scroll Lock key or some other key (warning, most seem to be used!) and press enter and voila, it now compiles when you press the Scroll Lock key. Another possibility is the Pause key which is next to it.