In a bash script, I want to get the count of windows in current tmux session.
I found tmux display-message -p '#I'
get count of pane in current window. But how can I get count of windows instead?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityIn a bash script, I want to get the count of windows in current tmux session.
I found tmux display-message -p '#I'
get count of pane in current window. But how can I get count of windows instead?
#I is not the number of panes in the window, it is the pane index - for number of panes you want '#{window_panes}'.
Similarly, for number of windows in a session you can do '#{session_windows}'.