unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Configuring tabs line format
@ 2019-10-16 13:18 TatriX
  2019-10-16 22:12 ` Juri Linkov
  0 siblings, 1 reply; 9+ messages in thread
From: TatriX @ 2019-10-16 13:18 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 124 bytes --]

Hi all,

Is it possible to change how tab-bar is formatted? For example Id' like to
put display-time-string there.

Thanks!

[-- Attachment #2: Type: text/html, Size: 212 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring tabs line format
  2019-10-16 13:18 Configuring tabs line format TatriX
@ 2019-10-16 22:12 ` Juri Linkov
  2019-10-16 22:40   ` Ergus
  2019-10-17 12:34   ` TatriX
  0 siblings, 2 replies; 9+ messages in thread
From: Juri Linkov @ 2019-10-16 22:12 UTC (permalink / raw)
  To: TatriX; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1303 bytes --]

> 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
               ,(concat
                 (propertize " " 'display '(space :align-to (- right 5)))
                 (format-time-string "%H:%M"))
               ignore))))
  '((name . tab-bar-display-time)))

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


[-- Attachment #2: tab-bar-clock.png --]
[-- Type: image/png, Size: 17499 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring tabs line format
  2019-10-16 22:12 ` Juri Linkov
@ 2019-10-16 22:40   ` Ergus
  2019-10-16 22:46     ` Ergus
  2019-10-17 22:09     ` Juri Linkov
  2019-10-17 12:34   ` TatriX
  1 sibling, 2 replies; 9+ messages in thread
From: Ergus @ 2019-10-16 22:40 UTC (permalink / raw)
  To: Juri Linkov; +Cc: TatriX, emacs-devel

Hi Juri:

Some of the recent changes made the tab-bar not to work for me either in
tui or gui.

emacs -Q
C-x 6 f file RET
and there is not tab at all.

In the gtk interface it shows nothing and with -nw it adds an extra row
where before was the tab-bar.

I have not follow the tab thread recently, does something changed that
requires special intervention?

On Thu, Oct 17, 2019 at 01:12:29AM +0300, Juri Linkov 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
>               ,(concat
>                 (propertize " " 'display '(space :align-to (- right 5)))
>                 (format-time-string "%H:%M"))
>               ignore))))
>  '((name . tab-bar-display-time)))
>
>Now the tab-bar clock looks exactly like the desktop top panel clock:
>





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring tabs line format
  2019-10-16 22:40   ` Ergus
@ 2019-10-16 22:46     ` Ergus
  2019-10-17 22:09     ` Juri Linkov
  1 sibling, 0 replies; 9+ messages in thread
From: Ergus @ 2019-10-16 22:46 UTC (permalink / raw)
  To: Juri Linkov; +Cc: TatriX, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1935 bytes --]

Attached image of tui bar image. In gtk there is nothing to show, no bat
at all.



On Thu, Oct 17, 2019 at 12:40:44AM +0200, Ergus wrote:
>Hi Juri:
>
>Some of the recent changes made the tab-bar not to work for me either in
>tui or gui.
>
>emacs -Q
>C-x 6 f file RET
>and there is not tab at all.
>
>In the gtk interface it shows nothing and with -nw it adds an extra row
>where before was the tab-bar.
>
>I have not follow the tab thread recently, does something changed that
>requires special intervention?
>
>On Thu, Oct 17, 2019 at 01:12:29AM +0300, Juri Linkov 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
>>              ,(concat
>>                (propertize " " 'display '(space :align-to (- right 5)))
>>                (format-time-string "%H:%M"))
>>              ignore))))
>> '((name . tab-bar-display-time)))
>>
>>Now the tab-bar clock looks exactly like the desktop top panel clock:
>>
>
>
>

[-- Attachment #2: Screenshot_2019-10-17_00-45-00.png --]
[-- Type: image/png, Size: 16290 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring tabs line format
  2019-10-16 22:12 ` Juri Linkov
  2019-10-16 22:40   ` Ergus
@ 2019-10-17 12:34   ` TatriX
  2019-10-17 22:09     ` Juri Linkov
  1 sibling, 1 reply; 9+ messages in thread
From: TatriX @ 2019-10-17 12:34 UTC (permalink / raw)
  To: Juri Linkov; +Cc: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 1704 bytes --]

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 <juri@linkov.net> 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
>                ,(concat
>                  (propertize " " 'display '(space :align-to (- right 5)))
>                  (format-time-string "%H:%M"))
>                ignore))))
>   '((name . tab-bar-display-time)))
>
> Now the tab-bar clock looks exactly like the desktop top panel clock:
>
>

[-- Attachment #1.2: Type: text/html, Size: 2254 bytes --]

[-- Attachment #2: emacs.png --]
[-- Type: image/png, Size: 503544 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring tabs line format
  2019-10-17 12:34   ` TatriX
@ 2019-10-17 22:09     ` Juri Linkov
  2019-10-18  8:33       ` TatriX
  0 siblings, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2019-10-17 22:09 UTC (permalink / raw)
  To: TatriX; +Cc: emacs-devel

> 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!

Nice!  If we are going the route of allowing the tab-bar to be the
frame global mode-line, then maybe we could also support mode-line
constructs like global-mode-string.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring tabs line format
  2019-10-16 22:40   ` Ergus
  2019-10-16 22:46     ` Ergus
@ 2019-10-17 22:09     ` Juri Linkov
  2019-10-18 13:47       ` Ergus
  1 sibling, 1 reply; 9+ messages in thread
From: Juri Linkov @ 2019-10-17 22:09 UTC (permalink / raw)
  To: Ergus; +Cc: TatriX, emacs-devel

> Some of the recent changes made the tab-bar not to work for me either in
> tui or gui.
>
> emacs -Q
> C-x 6 f file RET
> and there is not tab at all.
>
> In the gtk interface it shows nothing and with -nw it adds an extra row
> where before was the tab-bar.
>
> I have not follow the tab thread recently, does something changed that
> requires special intervention?

Please try the fix that Martin installed yesterday.



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring tabs line format
  2019-10-17 22:09     ` Juri Linkov
@ 2019-10-18  8:33       ` TatriX
  0 siblings, 0 replies; 9+ messages in thread
From: TatriX @ 2019-10-18  8:33 UTC (permalink / raw)
  To: emacs-devel

Juri Linkov <juri@linkov.net> writes:

> Nice!  If we are going the route of allowing the tab-bar to be the
> frame global mode-line, then maybe we could also support mode-line
> constructs like global-mode-string.

I think it can be useful. I assume a lot of Emacs users use multiple
windows and at the same time there are mods like `display-time` and I
prefer having only one clock on my desktop. The same goes for other
global info I'd like to see on my screen. It especially useful with EXWM.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Configuring tabs line format
  2019-10-17 22:09     ` Juri Linkov
@ 2019-10-18 13:47       ` Ergus
  0 siblings, 0 replies; 9+ messages in thread
From: Ergus @ 2019-10-18 13:47 UTC (permalink / raw)
  To: Juri Linkov; +Cc: TatriX, emacs-devel


On Fri, Oct 18, 2019 at 01:09:56AM +0300, Juri Linkov wrote:
>> Some of the recent changes made the tab-bar not to work for me either in
>> tui or gui.
>>
>> emacs -Q
>> C-x 6 f file RET
>> and there is not tab at all.
>>
>> In the gtk interface it shows nothing and with -nw it adds an extra row
>> where before was the tab-bar.
>>
>> I have not follow the tab thread recently, does something changed that
>> requires special intervention?
>
>Please try the fix that Martin installed yesterday.
>
Yes it works pretty fine now.



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-10-18 13:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 13:18 Configuring tabs line format TatriX
2019-10-16 22:12 ` Juri Linkov
2019-10-16 22:40   ` Ergus
2019-10-16 22:46     ` Ergus
2019-10-17 22:09     ` Juri Linkov
2019-10-18 13:47       ` Ergus
2019-10-17 12:34   ` TatriX
2019-10-17 22:09     ` Juri Linkov
2019-10-18  8:33       ` TatriX

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).