help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tab-bar] How to show something in the right side?


From: Stephen Berman
Subject: Re: [tab-bar] How to show something in the right side?
Date: Fri, 25 Jun 2021 23:18:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

On Fri, 25 Jun 2021 10:22:21 -0500 Rodrigo Morales 
<moralesrodrigo1100@gmail.com> wrote:

> * The question
>
> Have any of you managed to insert some content in the right side of the
> tab-bar (the one that is shown when tab-bar-mode is enabled)?
>
> For those who don't know, the current behavior of =tab-bar-mode= is to
> show the name of opened tabs starting from the left side, so if you have
> 3 tabs opened and your font is small enough, the names will fill the bar
> less than the middle of the screen. This means that there is an empty
> space that could be used for something else. For this reason, I would
> like to show the current time (i.e. 10:10AM) in that part of the screen
> because most of the time that part is empty. Some users use "polybar"
> for accomplishing this, but I was wondering whether it was possible to
> do this with "tab-bar-mode" without much tinkering.
>
> * Additional context
>
> I could also make the time be shown in my screen with
> =display-time-mode=, but I don't particularly like this because this
> makes the time be shown in all modelines, so if I have 4 buffers, the
> time is shown in the modeline of each buffer (i.e. 4 times). I would
> rather the time be shown just once.

Juri Linkov, the author of tab-bar-mode, offered this way to do that
(see https://lists.gnu.org/archive/html/emacs-devel/2019-10/msg00685.html):

(advice-add 'tab-bar-make-keymap-1 :around
  (lambda (orig-fun)
    (append (funcall orig-fun)
            `((display-time menu-item
               ,(concat
                 (propertize " " 'display '(space :align-to (- right 5)))
                 (format-time-string "%H:%M"))
               ignore))))
  '((name . tab-bar-display-time)))

Steve Berman



reply via email to

[Prev in Thread] Current Thread [Next in Thread]