This is a fork of Aetf kwin-maximize-to-new-desktop. Link to his work.
MACsimize is a KWin script that moves maximized windows to a new virtual desktop, moves back to original desktop if restored or closed. Each window takes place on a new virtual desktop, there's no need to add desktops manually.
See CHANGELOG.md.