[Top][All Lists]

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

Re: Configuring tabs line format

From: TatriX
Subject: Re: Configuring tabs line format
Date: Thu, 17 Oct 2019 14:34:23 +0200

Thank you very much! It was a bit surprising to learn that appearance of the tab-bar is controller by the keymap ;)
I was using `header-line` as a panel with EXWM, but it didn't work well with modes like info which define their own header-line.
Now it's much better!

On Thu, Oct 17, 2019 at 12:15 AM Juri Linkov <address@hidden> wrote:
> Is it possible to change how tab-bar is formatted?
> For example I'd like to put display-time-string there.

Yes, everything is possible.  You need just a few lines of code:

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

and if you want also a timer to redraw the tab-bar during idle times.

This has one problem - the clock is located on the left side.  When
Android moved the status bar clock from the right corner to the left,
it caused backward-compatibility problems for millions of users, and
still it's impossible to move the clock back to the right on Android.

But in Emacs everything is extensible and customizable.  So it's easy
to move the clock to the right on the tab-bar with another few lines:

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

Now the tab-bar clock looks exactly like the desktop top panel clock:

Attachment: emacs.png
Description: PNG image

reply via email to

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