This is the part that does the SHIFT state.
The lookup table only does the first 128 ASCII characters so the 8th bit of the table is available for the SHIFT flag. What I would do is change the table to use 'uint16_t' instead of uint8_t. Then you can use the entire ISO Latin 1 character set and have 8 bits left over for flags such as SHIFT, CTRL, ALT, etc. Then you would need pgm_read_word() to get each entry from the table.