unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Stephen Berman <stephen.berman@gmx.net>
To: Rodrigo Morales <moralesrodrigo1100@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: [tab-bar] How to show something in the right side?
Date: Fri, 25 Jun 2021 23:18:23 +0200	[thread overview]
Message-ID: <87zgvdtzhc.fsf@gmx.net> (raw)
In-Reply-To: <875yy2ufyq.fsf@gmail.com> (Rodrigo Morales's message of "Fri, 25 Jun 2021 10:22:21 -0500")

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	other threads:[~2021-06-25 21:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25 15:22 [tab-bar] How to show something in the right side? Rodrigo Morales
2021-06-25 21:18 ` Stephen Berman [this message]
2021-06-28 12:16 ` Eric S Fraga
2021-06-28 12:17 ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgvdtzhc.fsf@gmx.net \
    --to=stephen.berman@gmx.net \
    --cc=help-gnu-emacs@gnu.org \
    --cc=moralesrodrigo1100@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).