HID keyboard on leonardo only working on OS it was compiled on

Hey guys, this is a pretty strange issue but it’s been around since I first tried PIO a few months ago. The problem is exactly as the title says – the code only works correctly on the same OS that it was compiled on. I’ve tried compiling and uploading on Linux and it only works on Linux and i’ve tried compiling and uploading on Windows and it only works on Windows. It seems to me that this is a problem with using the keyboard library since everything else works correctly.

My code is here but I edited it slightly by declaring my functions so it would work with PlatformIO: GitHub

Does it work well with Arduino IDE?

Yes, it works perfectly on the Arduino IDE. Compile it on Windows, Linux, or OS X and it will work as a keyboard across the 3. This really is an unusual issue, but I did confirm that it was an issue with the keyboard library on the leonardo by stripping out the neopixel and bouce code as well. hastebin

Same thing still happens. It works fine on the operating system it’s compiled on (tested on my laptop running ubuntu 16.04 and a vm on my desktop running debian) but will not work on a different OS. Likewise, if I compile it on Windows it doesn’t work on my laptop and VM.