Search code examples
tmux

How can I send URLs from tmux to my browse with urlscan?


I would think the following snippet in my tmux.conf would work:

bind-key C-u run-shell "tmux capture-pane -Jp | urlscan -d"

But all I get with <prefix> C-u is:

'tmux capture-pane -Jp | urlscan -d' returned 1

Solution

  • According to tmux manual:

    • run-shell [ -bC] [-d delay] [ -t target-pane] [shell-command]
      ( alias: run )

      Execute shell-command using /bin/sh or (with -C) a tmux command in the background without creating a window. [...]

    Since urlscan requires a tty to work properly it does not work when it is run in the background.

    I guess this is what you want:

    bind-key C-u run "tmux popup -E -b double -w 100% -h 100% \
                      sh -c 'tmux capture-pane -Jp | urlscan -d' "
    

    enter image description here