tmux panes are simply logical windows emulated within a single text field. This means that the OSX system-level text handling does not recognize the tmux panes as separate fields. To get the behavior you desire you'll need to override or simply not use the default OS behavior.
Instead, you'll need to learn to use tmux's own internal selection/copy ...
I ran into this issue today. I would command-click on a URL in iTerm2 (Mac) and the app would seemingly lose focus but the link wouldn't open in a browser (Chrome, in my case). This used to work fine for me so I was a little confused and the other answers here didn't work for me.
It seemed to me that Chrome was "trying" to open but failing for some reason. ...
Things you need to make this happen on macos:
1. Terminal emulator that supports sixel
iTerm2 recently added sixel support for viewing inline images. You'l need iterm 3.3 or later, which at time of writing is in beta, available in the test releases section of the downloads page.
2. Utility for converting images to sixel format
I used img2sixel.
You can now do automated session logging in iTerm. The docs on this aren't super clear but the feature does exist.
To enable session logging for a single session: Session > Log > Start
To disable it Session > Log > Stop
To automate this for all sessions of a given profile e.g., Default:
Preferences > Profiles > Default > Session > ...
It appears a script like this could work for you. This is using zsh, but should work or only require a little bit of editing to work with bash.
Essentially what it does is aliases ssh to this color ssh command which changes the color of the tab and then runs ssh.