I recommend § 18 and § 19 of said "Gesetz über Arbeitnehmererfindungen". They state that inventions that are clearly not done on the employers payroll (to paraphrase this) are so called free (you have to enable your employer to make that call and you could dispute him, if he tries to claim said invention) (§§18).
But you need to enable your employer to use said (free) invention with reasonable terms - but you dictate the terms (§§19). Your employer can dispute the conditions and a court of law then has to decide.
So clearly this law does not enable your employer to claim nearly every invention you could make in your free time.
At least as far as my understanding goes. But I might be totally wrong here. I am somewhat out of my experience here.
The problem in IT is that depending on what you do, everything might be related to a varying degree.