https://github.com/jarun/googler/blob/7b6ad41226d00386a88fe369d02abce43be90a29/googler#L2084-L2094
You'll probably get a `FileNotFoundError` first. Just typing away without testing, but what about:
```py
# try copying the url to clipboard using native utilities
copier_params = []
if sys.platform.startswith(('linux', 'freebsd', 'openbsd')):
if shutil.which('xsel'):
copier_params = ['xsel', '-b', '-i']
elif sys.platform == 'darwin':
copier_params = ['pbcopy']
elif sys.platform == 'win32':
copier_params = ['clip']
if not copier_params and os.getenv('TMUX_PANE'):
copier_params = ['tmux', 'set-buffer'] # Use the full command instead of the shortcut as no one's typing this
if not copier_params:
printerr('failed to locate suitable clipboard utility')
```
By the way, I'm not sure that using a tmux buffer unconditionally within tmux instead of a system-wide clipboard is actually a good idea.
EDIT: Okay, apparently it could be used as a fallback, I guess.
IIRC the correct way to detect tmux is to check the `TMUX_PANE` env var (the `TMUX` env var is probably set, too, but IIRC it's not documented). `TERM` is not a reliable indicator at all; I have
```tmux
set -g default-terminal "screen-256color"
```
in my `.tmux.conf`, for instance.
EDIT: On second thought, checking `$TMUX` should be fine, as tmux itself uses `$TMUX` for nesting detection:
> sessions should be nested with care, unset $TMUX to force