Expand format in `select-window`

17 views
Skip to first unread message

Michael Forster

unread,
Jun 25, 2022, 2:37:34 PM6/25/22
to tmux-...@googlegroups.com
Hi,

I currently have this line in my tmux config: 

    run "tmux select-window -t #{@unattached-window}"

It seems unfortunate that I have to execute a shell for a tmux command just so that formats get expanded. Is there a way to expand formats in arbitrary places without using a shell?

For context: This is the whole snippet where I need this:

      set-hook -g session-created {
        if -F "#{>:#{window_active_sessions},1}" {
          set -F @unattached-window "#{s/ .*//:#{W:#{?window_active_sessions,,#{window_id} }}}"
          if -F "#{@unattached-window}" {
            run "tmux select-window -t #{@unattached-window}"
          } new-window
        }
      }


I would be happy with alternative suggestions on how to achieve my goal of selecting the first window that doesn't have an active session...

Thanks,
Mike

Michael Forster

unread,
Jun 25, 2022, 5:55:36 PM6/25/22
to tmux-...@googlegroups.com
Nevermind. I found 

    run -C "select-window -t #{@unattached-window}"

on my own.

Sorry for the noise,
Mike

Nicholas Marriott

unread,
Jun 26, 2022, 3:05:42 AM6/26/22
to Michael Forster, tmux-users
You can use run -C instead.



--
You received this message because you are subscribed to the Google Groups "tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tmux-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tmux-users/CAAWozGNUcjPaNPVSMhWxfytdb%2ByGeAw1ER-Y3ek3o9%2B%3D%2BwBRuw%40mail.gmail.com.

Michael Forster

unread,
Jun 26, 2022, 5:34:39 AM6/26/22
to Nicholas Marriott, tmux-users
Great, thanks! 
Reply all
Reply to author
Forward
0 new messages