Let me guess.... this was on Windows, right?

Allow me to give you some advice -
never store crypto on Windows. All of the newbie hackers are targeting Windows. Because there are scripts and templates readily available to exploit this platform, even distributed freely.
It is far better to use Linux to run Electrum on. In fact, you stop almost all hacks like this, besides the most sophisticated ones (where they are targeting you in particular).
Why did you say (newbie hackers)?
This is not so true, hackers works like Gold miners who find golds anyhow, the prize is what matters to them, some windows OS users still store alot of Bitcoin on their PC, pro hackers know this too.
I mean, they knew about Electrum too, they know that it exists only for Mobile and PC, and in today's world windows OS is the most simplest of them all, Linux is complicated and many people avoids it because of this, Windows OS is still the most used OS around the world this is why pro hackers will never underestimate what they could hijack from windows PC.