[Part 1]

Sadly, it sucks even more than some people imagine. So while I'm also not a lawyer, I will gladly play the Devil's advocate here.

If you have a salary, you are actually paid for the work product of the whole month. (As opposed to a wage for time worked.) Well, actually you are paid for honestly trying, but your contract transfers usage rights related to your work, so this has nothing to do with hours worked. They would also have to pay your salary, if they say you can stay at home and do nothing, because nothing to do.

Having your work time limited to 40h a week has nothing to do with transfer of rights, as it is a different realm of law. This is just to protect you (or your employer) from you being overworked. (Cynics might say: this was invented by politicians/unions to get votes, or by employers that don't want their human resources damaged.) Anyway: this has nothing to do with your pay and the rights you sell. It might even work against you, as you have to use your "free time", to get fit for work again. (Yes, yes!) While secondary employment is not generally forbidden in Germany (and contract clauses which say so don't last in court), except for competition, your employer of course needs to know, because he also has a say in whether or not your other activities are against their legitimate interest: e.g. if it is indeed to be deemed competion or you are overworking yourself this way and having this drain your energy away from your employers work might be a valid reason to stop it. (Of course: in the end, the court may decide if one side sues, hopefully in a commensurate way.) But you may say: but this is like overtime (it is not: you did it voluntarily and overtime is ordered), and overtime has to be paid even for salaried employees in certain cases (again: different laws, has nothing to with the rights you sell as part of your employment and only with protection from overworking and your compensation for time because of the imbalance between stipulatory and accomplished hours -- hint: if your employer or a labour court thinks your employer owes you (as a salaried employee) overtime compensation, it is because you are still way below a decent salary ... but this is getting off topic).

So while it is true you cannot transfer your Urheberrecht in Germany, as pizzapill wrote, (because it is connected to you as a person, with one exception: it is transfered to your heirs after your dead, but if you're dead, you rights are very limited anyway) you transfer the Nutzungsrechte (usage rights) as part of your contract. And here the employers try to get as much as possible. Not only because of greed (but we would not rule that out, would we?), but simply for legal safety: you cannot easily disentangle one work from another if it is basically the same in the law (like "computer program" -- if the creation of these type of work is your job). Sure you and I can easily see, this program has nothing to do with your dayjob, but can your employer? In a tiny shop, maybe. In a big corporation: not so much. A big software company has so many fields of business, products and services, your manager and their manager and their manager cannot possibly know if your free time project goes against the business interest of the company if you do it independently of the company, so the contracts generally assume it does. (And it probably actually does: given a big enough company you will most certainly have teams in other divisions building similar things as you do in your free time, even if it is only in some tiny research departement on the other side of the world. And I mean plural "teams": they often don't know from each other. Think your boring business software employer does not do cool IoT stuff in some unknown lab? Think again, you haven't networked enough and don't know your company.) And for the work time + work equipment / free time + private equipment argument: yeah, I would also say so, I am paid for this, but not for that ... but this is a very weak argument. Not only for the obvious reason that it would be very problematic if some employee chooses to do the work for this employer in his free time on his equipment and thus trying to circumvent the usage rights transfer, but also (and maybe more importantly) because this is all in your head and how do you prove it, that e.g. your private work and employer ordered work did not influence earch other. And what about employer-relevant work you were not ordered to do? Say e.g. something you think could be useful at work: this could easily go against your employers interest (if you try to sell it to them or the competition or even if you wrote it and they don't get it), which is at odds with your duty of loyality.

That being said, I doubt contract clauses which automatically transfer exclusive usage rights of your free time works to your employer without extra compensation are enforcable to the full extent in Germany for "everything copyrightable you might create regardless what". (Speaking of contracts, I don't think I have seen it in this form yet, the sane companies write it more like this: if you create some work out of your area of duty, you have to offer exclusive rights to us, like you do for on-duty work, except if it is obvious, we cannot use this in the company.)

So with a dayjob as programmer and writing poems / painting pictures in the evening, you can savely say: this has nothing to do with each other and therefore it is not the business of my employer.