Yes, I'd love to do that. There is in fact already an app that does this on macOs (https://github.com/johnste/finicky). And you can chain them so that finicky runs first and then calls a chooser UI "browser" as a fallback. But I would like to incorporate it into my app so that I don't have to run two apps (and so that I can make it work cross-platform).