3

I would like the title my frames to show "<name of tab>: <name of buffer in active window>".

Presently, frame-title-format has its default value of %b, which shows only the name of the buffer in the selected window. There does not appear to be a percent-code for the current tab name.

I can use set-frame-parameter to assign a value for the name of the frame. The name of the current tab is easily found using tab-bar--current-tab. It is easy enough to concatenate the name of that tab to the name-of-buffer-in-active-window. But, that's a one-time execution. The frame title does not auto-update when the focus shifts to a different window within the frame.

How can I include the tab name while maintaining auto-update of the buffer name for the currently selected window?

Drew
  • 75,699
  • 9
  • 109
  • 225
midas0441
  • 304
  • 1
  • 7

1 Answers1

2

Auto-updating on every window switch in a hook would be too irrational. Better would be to include an eval form in frame-title-format like:

(setq frame-title-format
      '((:eval (if tab-bar-mode
                   (cdr (assq 'name (tab-bar--current-tab))) ""))
        ": %b"))
link0ff
  • 1,081
  • 5
  • 14