This can be accomplished using AutoHotkey. Can be a bit time consuming to work out though…
Have been using Actual Window Minimizer by Actual Tools for this as it’s really quick to get working; point and click, with a few tweaks.
Note that while AWM has a “Close minimizes to tray” option, which works with any “regularly titled app”, it doesn’t work well with these electron/chrome based apps, i.e. Obsidian. Nor does Obsidian create/expose the minimize button normally.
AWM has an option to put special overlay buttons. Note in the image below there is a little white dot under the regular minimize dash. That overlay makes the minimize button minimize to tray…
…and here it is nicely in the tray…

Will post back if I end up creating an AutoHotkey version, which should allow fixing of the close/minimize without overlay. Or resorting to a paid program (like Actual Window Minimizer). Though I will say at $20, I find it well worth it when I just want to minimize to tray with AHK programming fuss…
(no affiliation w/ Actual Tools, just a satisfied user)