With the open source application AutoHotkey you can define hotkeys for the mouse and keyboard, remap keys or buttons and autocorrect-like replacements.
We want to use it to enable Long press on any key. If the key is pressed for a certain period of time, a defined character will be written, otherwise the regular character of the key will be used.
Here is an example of a script that changes the "-" key to the german "ß":
$-:: ;-------------------- Long press (> 0.5 sec) on "-" key
KeyWait, -, T0.5 ;-------- Wait no more than 0.5 sec for release (also suppress auto-repeat)
If ErrorLevel
{ ;----------------------- timeout, so long press
SendInput, {ASC 225} ;---- send special char using ASCII codes
KeyWait, - ;-------------- suppress sending another char at key release
}
Else
Send {-} ;---------------- send regular char if no long press
Return
You can repeat this for the keys "[", ";" and "'" to map the other german special characters.