Minimize to tray keyboard shortcut

On Windows, you could write an AHK script for this (if Joplin is active, remap Esc to !F4, or more advanced like here), but that's still not ideal.., here's also a similar question: Close window with CTRL+W