Skip to contentSkip to conversation

infra: display current task as title of the term window

PATCH New Francois Perrad 6 participants 17 messages Aug 6, 2013 – Mar 15, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 infra: display current task as title of the term window

---
 package/pkg-utils.mk |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/pkg-utils.mk +2 -1
index 15db096..8572cb1 100644
@@ -64,7 +64,8 @@ INFLATE.xz   = $(XZCAT)
 INFLATE.tar  = cat
 
 # MESSAGE Macro -- display a message in bold type
-MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)"
+MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)" && \
+              echo -e "\033]2;$($(PKG)_NAME) $($(PKG)_VERSION) $(1)\007"
 TERM_BOLD  := $(shell tput smso)
 TERM_RESET := $(shell tput rmso)
 
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 infra: display current task as title of the term window

Hi Fran?ois,

Quoted 10 lines · Francois Perrad
---
 package/pkg-utils.mk |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/pkg-utils.mk +0 -0
index 15db096..8572cb1 100644

package/pkg-utils.mk INFLATE.xz = $(XZCAT) · line 70

Quoted 8 lines
package/pkg-utils.mk +2 -1
@@ -64,7 +64,8 @@ INFLATE.xz   = $(XZCAT)
 INFLATE.tar  = cat
 
 # MESSAGE Macro -- display a message in bold type
-MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)"
+MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)" && \
+              echo -e "\033]2;$($(PKG)_NAME) $($(PKG)_VERSION) $(1)\007"
 TERM_BOLD  := $(shell tput smso)
 TERM_RESET := $(shell tput rmso)

Although I like the idea, it does not work for me. I'm running Linux Mint, with a Konsole terminal. The above does nothing at all. I also tried manually:

echo -ne "\033]0;something\007"

but it doesn't change a thing.
It does work in gnome-terminal. I haven't tested in other situations.

Could you have a look at Konsole?

I know that Gentoo has this feature for its portage package installation/compilation tool. When you run 'emerge', the titles are constantly updated with the package that is being handled, also in Konsole. You may be able to find out what the 'right way' is based on their sources.

Thanks,
Thomas

#2 lore raw

PATCH 1/1 infra: display current task as title of the term window

Hello Thomas,

Am 07.08.2013 08:44, schrieb Thomas De Schampheleire:

Quoted 3 lines

echo -ne "\033]0;something\007"

but it doesn't change a thing.

I think the quoting and controling syntax is wrong. The following string works here fine in a Gnome terminal.

Quoted 1 line

echo -ne "\033[2msomething\033[0m other text\n"

Or with a underline and in green.

Quoted 1 line

echo -ne "\033[4;32msomething\033[0m other text\n"

You need to set up the starting thing with '\033["$foo-color"' and finally switch at the end to the to the default back '\033[0m'

More info around colors in the Bash can be found on
http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
But that's only for the Bash!

Hope that helps.

Regards
Carsten

#3 lore raw

PATCH 1/1 infra: display current task as title of the term window

Hi Carsten,

Quoted 14 lines · Carsten Schoenert

Hello Thomas,

Am 07.08.2013 08:44, schrieb Thomas De Schampheleire:

Quoted 3 lines

echo -ne "\033]0;something\007"

but it doesn't change a thing.

I think the quoting and controling syntax is wrong. The following string works here fine in a Gnome terminal.

Quoted 1 line

echo -ne "\033[2msomething\033[0m other text\n"

Or with a underline and in green.

Quoted 8 lines
Quoted 1 line

echo -ne "\033[4;32msomething\033[0m other text\n"

You need to set up the starting thing with '\033["$foo-color"' and finally switch at the end to the to the default back '\033[0m'

More info around colors in the Bash can be found on
http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
But that's only for the Bash!

The change Fran?ois is suggesting is for the terminal title window, it does not change anything about coloring.
The above commands you gave do not change anything in the title bar for me, nor in Konsole, nor in gnome-terminal. The second command does show the green underlined text in both terminals, but as said the title bar is unchanged.

Best regards,
Thomas

#4 lore raw

PATCH 1/1 infra: display current task as title of the term window

Hello Thomas,

Am 07.08.2013 10:20, schrieb Thomas De Schampheleire:

Quoted 2 lines

The change Fran?ois is suggesting is for the terminal title window, it does not change anything about coloring.

Ah yes, I misunderstand. Sorry.

Quoted 4 lines

The above commands you gave do not change anything in the title bar for me, nor in Konsole, nor in gnome-terminal. The second command does show the green underlined text in both terminals, but as said the title bar is unchanged.

So I take a look at the titel in the console (I didn't before), works here. I can set the name to what ever I want. Maybe you have unset some variables or so? But I don't think it's depend on this.

Quoted 4 lines
$ env | grep  "SHELL\|TERM"
TERM=xterm
SHELL=/bin/bash
COLORTERM=gnome-terminal

Regards
Carsten

#5 lore raw

PATCH 1/1 infra: display current task as title of the term window

Quoted 1 line · Carsten Schoenert

env | grep "SHELL\|TERM"

In my case:

SHELL=/bin/bash
TERM=xterm

#6 lore raw

PATCH 1/1 infra: display current task as title of the term window

In reply to Thomas De Schampheleire

2013/8/7 Thomas De Schampheleire <[email protected]>:

Quoted 26 lines

Hi Fran?ois,

Quoted 10 lines · Francois Perrad
---
 package/pkg-utils.mk |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
package/pkg-utils.mk +0 -0
index 15db096..8572cb1 100644

package/pkg-utils.mk INFLATE.xz = $(XZCAT) · line 70

Quoted 8 lines
package/pkg-utils.mk +2 -1
@@ -64,7 +64,8 @@ INFLATE.xz   = $(XZCAT)
 INFLATE.tar  = cat
 
 # MESSAGE Macro -- display a message in bold type
-MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)"
+MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)" && \
+              echo -e "\033]2;$($(PKG)_NAME) $($(PKG)_VERSION) $(1)\007"
 TERM_BOLD  := $(shell tput smso)
 TERM_RESET := $(shell tput rmso)

Although I like the idea, it does not work for me. I'm running Linux Mint, with a Konsole terminal. The above does nothing at all. I also tried manually:

Quoted 1 line

echo -ne "\033]0;something\007"

Thomas,

at the end of the command, the initial title is restored, so try something like :

$ echo -e "\033]2;Foo\007" && wait

Fran?ois

Quoted 18 lines

but it doesn't change a thing.
It does work in gnome-terminal. I haven't tested in other situations.

Could you have a look at Konsole?

I know that Gentoo has this feature for its portage package installation/compilation tool. When you run 'emerge', the titles are constantly updated with the package that is being handled, also in Konsole. You may be able to find out what the 'right way' is based on their sources.

Thanks,
Thomas
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#7 lore raw

PATCH 1/1 infra: display current task as title of the term window

Quoted 6 lines · Fran?ois Perrad

Thomas,

at the end of the command, the initial title is restored, so try something like :

$ echo -e "\033]2;Foo\007" && wait

This also doesn't change anything for me.

#8 lore raw

PATCH 1/1 infra: display current task as title of the term window

Quoted 10 lines · Thomas De Schampheleire
Quoted 6 lines · Fran?ois Perrad

Thomas,

at the end of the command, the initial title is restored, so try something like :

$ echo -e "\033]2;Foo\007" && wait

This also doesn't change anything for me.

For what it's worth - It didn't appear to do anything on my Ubuntu 12.04 - because the "wait" ended immediately. But if I replace the "wait" with a "sleep", then the window title persists for the entire sleep time. So, for example, this worked for me:

echo -e "\033]2;Buildroot menuconfig\007" && make menuconfig

(But only if I hadn't set a Title already from the window's drop-down menu.) -------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130807/ab729d77/attachment.html>

#9 lore raw

PATCH 1/1 infra: display current task as title of the term window

In reply to Thomas De Schampheleire
Quoted 31 lines · Thomas De Schampheleire

Hi Fran?ois,

Quoted 10 lines · Francois Perrad
---
  package/pkg-utils.mk |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
package/pkg-utils.mk +0 -0
index 15db096..8572cb1 100644

package/pkg-utils.mk INFLATE.xz = $(XZCAT) · line 70

Quoted 8 lines
package/pkg-utils.mk +2 -1
@@ -64,7 +64,8 @@ INFLATE.xz   = $(XZCAT)
  INFLATE.tar  = cat
 
  # MESSAGE Macro -- display a message in bold type
-MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)"
+MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION) $(1)$(TERM_RESET)" && \
+              echo -e "\033]2;$($(PKG)_NAME) $($(PKG)_VERSION) $(1)\007"
  TERM_BOLD  := $(shell tput smso)
  TERM_RESET := $(shell tput rmso)

Although I like the idea, it does not work for me. I'm running Linux Mint, with a Konsole terminal. The above does nothing at all. I also tried manually:

echo -ne "\033]0;something\007"

but it doesn't change a thing.
It does work in gnome-terminal. I haven't tested in other situations.

Quoted 7 lines

Could you have a look at Konsole?

I know that Gentoo has this feature for its portage package installation/compilation tool. When you run 'emerge', the titles are constantly updated with the package that is being handled, also in Konsole. You may be able to find out what the 'right way' is based on their sources.

Are you sure this works for you with emerge? I RTFM'ed it and according
to the konsole manual, you have to add '%w' to the tab title string to get the string set by the shell. Perhaps Gentoo simply sets the default tab title string to something including %w.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#10 lore raw

PATCH 1/1 infra: display current task as title of the term window

Quoted 10 lines · Arnout Vandecappelle
Quoted 7 lines · Thomas De Schampheleire

I know that Gentoo has this feature for its portage package installation/compilation tool. When you run 'emerge', the titles are constantly updated with the package that is being handled, also in Konsole. You may be able to find out what the 'right way' is based on their sources.

Quoted 5 lines

Are you sure this works for you with emerge? I RTFM'ed it and according to
the konsole manual, you have to add '%w' to the tab title string to get the string set by the shell. Perhaps Gentoo simply sets the default tab title string to something including %w.

It does work for emerge, but it seems you are right: the default tab title in Gentoo is set to %w (I didn't set it explicitly). I tried Francois' patch on a non-gentoo system before (didn't work for Konsole) but after explicitly setting %w in the tab title it also works there. So that issue is cleared out.

However, while testing again, I noticed an annoyance: if the build process stops prematurely, for example because the build fails or the user interrupts it, the last tab title remains. I would much prefer that we can cleanly restore this no matter how buildroot/make stops.

Best regards,
Thomas

#11 lore raw

PATCH 1/1 infra: display current task as title of the term window

Quoted 24 lines · Thomas De Schampheleire
Quoted 10 lines · Arnout Vandecappelle
Quoted 7 lines · Thomas De Schampheleire

I know that Gentoo has this feature for its portage package installation/compilation tool. When you run 'emerge', the titles are constantly updated with the package that is being handled, also in Konsole. You may be able to find out what the 'right way' is based on their sources.

Quoted 5 lines

Are you sure this works for you with emerge? I RTFM'ed it and according to
the konsole manual, you have to add '%w' to the tab title string to get the string set by the shell. Perhaps Gentoo simply sets the default tab title string to something including %w.

It does work for emerge, but it seems you are right: the default tab title in Gentoo is set to %w (I didn't set it explicitly). I tried Francois' patch on a non-gentoo system before (didn't work for Konsole) but after explicitly setting %w in the tab title it also works there. So that issue is cleared out.

Quoted 4 lines

However, while testing again, I noticed an annoyance: if the build process stops prematurely, for example because the build fails or the user interrupts it, the last tab title remains. I would much prefer that we can cleanly restore this no matter how buildroot/make stops.

Won't that be the case regardless of whether the build fails or succeeds?

I think this patch is only really suitable for people who have
something similar in their PS1. Otherwise it will just mess up your window title.

Also, it should only be done if $TERM == xterm, otherwise you get
annoying stuff when running buildroot from a text console. And in fact, the same is true of the colouring itself, so we don't get these annoying escape characters in log files and continuous integration web interfaces.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#12 lore raw

PATCH 1/1 infra: display current task as title of the term window

Op 19-aug.-2013 19:09 schreef "Arnout Vandecappelle" <[email protected]> het volgende:

Quoted 4 lines · Thomas De Schampheleire
Quoted 2 lines

On Tue, Aug 13, 2013 at 7:36 AM, Arnout Vandecappelle <[email protected]>

Quoted 13 lines · wrote:
Quoted 13 lines
Quoted 13 lines · Thomas De Schampheleire
Quoted 8 lines

I know that Gentoo has this feature for its portage package installation/compilation tool. When you run 'emerge', the titles are constantly updated with the package that is being handled, also in Konsole. You may be able to find out what the 'right way' is based on their sources.

Quoted 1 line
Quoted 1 line
Quoted 1 line

Are you sure this works for you with emerge? I RTFM'ed it and

according to

Quoted 1 line
Quoted 1 line
Quoted 1 line

the konsole manual, you have to add '%w' to the tab title string to get

the

Quoted 1 line
Quoted 1 line
Quoted 1 line

string set by the shell. Perhaps Gentoo simply sets the default tab

title

Quoted 10 lines
Quoted 10 lines
Quoted 2 lines

string to something including %w.

It does work for emerge, but it seems you are right: the default tab title in Gentoo is set to %w (I didn't set it explicitly). I tried Francois' patch on a non-gentoo system before (didn't work for Konsole) but after explicitly setting %w in the tab title it also works there. So that issue is cleared out.

Quoted 7 lines
Quoted 4 lines

However, while testing again, I noticed an annoyance: if the build process stops prematurely, for example because the build fails or the user interrupts it, the last tab title remains. I would much prefer that we can cleanly restore this no matter how buildroot/make stops.

Won't that be the case regardless of whether the build fails or succeeds?

Currently it is indeed, but that could easily be fixed by adding an extra such print at the end.

Quoted 2 lines

I think this patch is only really suitable for people who have something

similar in their PS1. Otherwise it will just mess up your window title.

Quoted 2 lines

Also, it should only be done if $TERM == xterm, otherwise you get

annoying stuff when running buildroot from a text console. And in fact, the same is true of the colouring itself, so we don't get these annoying escape characters in log files and continuous integration web interfaces.

Agreed.

Best regards,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130819/e2974fda/attachment.html>

#13 lore raw

PATCH 1/1 infra: display current task as title of the term window

On 19/08/13 20:49, Thomas De Schampheleire wrote:
[snip]

Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

However, while testing again, I noticed an annoyance: if the build process stops prematurely, for example because the build fails or the user interrupts it, the last tab title remains. I would much prefer that we can cleanly restore this no matter how buildroot/make stops.

Won't that be the case regardless of whether the build fails or succeeds?

Currently it is indeed, but that could easily be fixed by adding an extra such print at the end.

A print of what? An empty string? Then your window won't have a title
anymore... There is no way to save the previous window title, so I really think that if PS1 doesn't set the window title, then buildroot shouldn't either.

Regards,
Arnout

Quoted 16 lines
Quoted 3 lines

I think this patch is only really suitable for people who have

something similar in their PS1. Otherwise it will just mess up your window title.

Quoted 2 lines

Also, it should only be done if $TERM == xterm, otherwise you get

annoying stuff when running buildroot from a text console. And in fact, the same is true of the colouring itself, so we don't get these annoying escape characters in log files and continuous integration web interfaces.

Agreed.

Best regards,
Thomas

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#14 lore raw

PATCH 1/1 infra: display current task as title of the term window

Op 21-aug.-2013 00:32 schreef "Arnout Vandecappelle" <[email protected]> het volgende:

Quoted 11 lines · Thomas De Schampheleire

[snip]

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

However, while testing again, I noticed an annoyance: if the build process stops prematurely, for example because the build fails or the user interrupts it, the last tab title remains. I would much prefer that we can cleanly restore this no matter how buildroot/make stops.

Won't that be the case regardless of whether the build fails or

succeeds?

Quoted 6 lines
Quoted 3 lines

Currently it is indeed, but that could easily be fixed by adding an extra such print at the end.

A print of what? An empty string? Then your window won't have a title

anymore... There is no way to save the previous window title, so I really think that if PS1 doesn't set the window title, then buildroot shouldn't either.

Other programs, like gentoo portage, are able to restore the window title correctly. I don't know how, but it is possible.

That said, although I like the idea of easily seeing which package is currently building, I also think it should either be perfect or not be at all.

As an alternative, is it possible to count the number of make targets / packages remaining, and show that in the MESSAGEs? Then you only have to scroll up to the last message to get an idea...

Best regards,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130821/514d36d8/attachment.html>

#15 lore raw

PATCH 1/1 infra: display current task as title of the term window

Hi Francois,

Quoted 30 lines · Thomas De Schampheleire

Op 21-aug.-2013 00:32 schreef "Arnout Vandecappelle" <[email protected]> het volgende:

Quoted 13 lines · Thomas De Schampheleire

[snip]

Quoted 9 lines
Quoted 7 lines
Quoted 4 lines

However, while testing again, I noticed an annoyance: if the build process stops prematurely, for example because the build fails or the user interrupts it, the last tab title remains. I would much prefer that we can cleanly restore this no matter how buildroot/make stops.

Won't that be the case regardless of whether the build fails or

succeeds?

Quoted 8 lines
Quoted 2 lines

Currently it is indeed, but that could easily be fixed by adding an extra such print at the end.

A print of what? An empty string? Then your window won't have a title
anymore... There is no way to save the previous window title, so I really think that if PS1 doesn't set the window title, then buildroot shouldn't either.

Other programs, like gentoo portage, are able to restore the window title correctly. I don't know how, but it is possible.

Quoted 7 lines

That said, although I like the idea of easily seeing which package is currently building, I also think it should either be perfect or not be at all.

As an alternative, is it possible to count the number of make targets / packages remaining, and show that in the MESSAGEs? Then you only have to scroll up to the last message to get an idea...

Are you still interested in pursuing the principle of this patch? If so, what about adapting the MESSAGEs instead, as suggested above. This does not have the problem of not correctly restoring the window title on abort...

Thanks,
Thomas

#16 lore raw

PATCH 1/1 infra: display current task as title of the term window

In reply to Arnout Vandecappelle

2013/8/13 Arnout Vandecappelle <[email protected]>:

Quoted 47 lines · Thomas De Schampheleire
Quoted 37 lines

Hi Fran?ois,

Quoted 15 lines · Francois Perrad
---
  package/pkg-utils.mk |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
package/pkg-utils.mk +0 -1
index 15db096..8572cb1 100644
@@ -64,7 +64,8 @@ INFLATE.xz   = $(XZCAT)
  INFLATE.tar  = cat
 
  # MESSAGE Macro -- display a message in bold type
-MESSAGE     = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION)
Quoted 6 lines

$(1)$(TERM_RESET)"
+MESSAGE = echo "$(TERM_BOLD)>>> $($(PKG)_NAME) $($(PKG)_VERSION)
$(1)$(TERM_RESET)" && \
+ echo -e "\033]2;$($(PKG)_NAME) $($(PKG)_VERSION) $(1)\007"
TERM_BOLD := $(shell tput smso)
TERM_RESET := $(shell tput rmso)

Although I like the idea, it does not work for me. I'm running Linux Mint, with a Konsole terminal. The above does nothing at all. I also tried manually:

echo -ne "\033]0;something\007"

but it doesn't change a thing.
It does work in gnome-terminal. I haven't tested in other situations.

Quoted 7 lines

Could you have a look at Konsole?

I know that Gentoo has this feature for its portage package installation/compilation tool. When you run 'emerge', the titles are constantly updated with the package that is being handled, also in Konsole. You may be able to find out what the 'right way' is based on their sources.

Quoted 5 lines

Are you sure this works for you with emerge? I RTFM'ed it and according to
the konsole manual, you have to add '%w' to the tab title string to get the string set by the shell. Perhaps Gentoo simply sets the default tab title string to something including %w.

I found the same tip for Konsole, see
http://stackoverflow.com/questions/5373253/how-can-one-put-the-output-of-a-command-into-a-konsole-title-bar
So, the patch must work everywhere echo $TERM returns 'xterm'.

Fran?ois

Note : minor improvement in the patch, replace echo -e by echo -ne

Quoted 16 lines

Regards,
Arnout

--

Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot