讓 Byobu 的 status bar 使用 tmux multiline

tmux 在 2.9 的時候支援了 multiline,從 CHANGES 裡面可以看到說明:

Extend the #[] style syntax and use that together with previous format changes to allow the status line to be entirely configured with a single option.

Now that it is possible to configure their content, enable the existing code that lets the status line be multiple lines in height. The status option can now take a value of 2, 3, 4 or 5 (as well as the previous on or off) to configure more than one line. The new status-format array option configures the format of each line, the default just references the existing status-* options, although some of the more obscure status options may be eliminated in time.

Additions to the #[] syntax are: "align" to specify alignment (left, centre, right), "list" for the window list and "range" to configure ranges of text for the mouse bindings.

The "align" keyword can also be used to specify alignment of entries in tree mode and the pane status lines.

我桌機的螢幕是打直的,所以會希望拆成兩行儘量把 tmux 的 window 的資訊都顯示出來,不過我這邊還是希望保留 Byobu 的樣式,所以就翻到「Making byobu's (using tmux) status bar multi-line results in "session" and the date/time disappearing」這篇,作者貼了一個算是不完整的範例,看起來沒辦法直接用,所以還是得想辦法找出 Byobu 預設的 status-format[0]

後來找到的方法是在 Byobu 跑起來的環境裡面跑這個:

tmux display-message -p "#{status-format[0]}"

就會發現 status-format[0] 有夠大包... 接著把裡面的值拆開放到兩行,最後變成這樣 (這是從 Ubuntu 22.04 裡面的 Byobu 拆出來的):

source $BYOBU_PREFIX/share/byobu/profiles/tmux
set-option -g status 2
set -g status-format[0] '#[align=left range=left #{status-left-style}]#[push-default]#{T;=/#{status-left-length}:status-left}#[pop-default]#[norange default]#[list=on align=#{status-justify}]#[list=left-marker]<#[list=right-marker]>#[list=on]#{W:#[range=window|#{window_index} #{window-status-style}#{?#{&&:#{window_last_flag},#{!=:#{window-status-last-style},default}}, #{window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{window-status-bell-style},default}}, #{window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{window-status-activity-style},default}}, #{window-status-activity-style},}}]#[push-default]#{T:window-status-format}#[pop-default]#[norange default]#{?window_end_flag,,#{window-status-separator}},#[range=window|#{window_index} list=focus #{?#{!=:#{window-status-current-style},default},#{window-status-current-style},#{window-status-style}}#{?#{&&:#{window_last_flag},#{!=:#{window-status-last-style},default}}, #{window-status-last-style},}#{?#{&&:#{window_bell_flag},#{!=:#{window-status-bell-style},default}}, #{window-status-bell-style},#{?#{&&:#{||:#{window_activity_flag},#{window_silence_flag}},#{!=:#{window-status-activity-style},default}}, #{window-status-activity-style},}}]#[push-default]#{T:window-status-current-format}#[pop-default]#[norange list=on default]#{?window_end_flag,,#{window-status-separator}}}'
set -g status-format[1] '#[align=right]#(byobu-status tmux_right)'$BYOBU_DATE$BYOBU_TIME

我要的效果就出來了: