Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one put the output of a command into a konsole title bar?

Through the clever use of some escape characters, I used to put the output of arbitrary commands (e.g. "dirs") into my xterm title bar. Can I do the same thing in konsole? If so, how?

like image 858
kc2001 Avatar asked Mar 21 '11 02:03

kc2001


People also ask

How do I run a command in Konsole?

To run a command, just type it in and press <Enter>. The command should run and print the output in the Konsole display. To create a new tab, click on File > New Tab. To create a new window, click on File > New Window. Once a new tab is created, it will show up in the tab bar.

How to save the output of Konsole terminal to a file?

The directory should be opened in Dolphin. To save the output of Konsole terminal to a file, click on File > Save Output As… Now, select a location and a filename and click on Save. You can click on the Filter dropdown menu and select between plain text document format (default) and HTML format.

How to use Konsole Terminal app in Linux?

This is how Konsole terminal app looks like. To run a command, just type it in and press <Enter>. The command should run and print the output in the Konsole display. To create a new tab, click on File > New Tab.

How to create a new tab or window in Konsole?

The command should run and print the output in the Konsole display. To create a new tab, click on File > New Tab. To create a new window, click on File > New Window. Once a new tab is created, it will show up in the tab bar. You can switch between them very easily.


1 Answers

It's a little tricky to do what you want, but you can change Konsole's title bar. Go to:

Settings > Edit current profile > Tabs > Tab title format

and change it to %w which means Window Title Set by Shell. I think you need to close Konsole and reopen it for the changes to take effect.

Anyway, go to the prompt and exec:

OUTPUT=`whoami`; echo -ne "\033]2;$OUTPUT\007"

and behold!

This example sets the title of the window temporarily to whatever is outputted by whoami.

like image 79
karlphillip Avatar answered Sep 30 '22 01:09

karlphillip