MAY
23
2007

The Road to KDE 4: Konsole Gets an Overhaul

Again, after a delay brought on by a bout Real Life (tm), we return to bring you updates on the state of Konsole, KDE's UNIX terminal program. Konsole has been a staple of KDE since KDE 1.0, as has been showing signs of a little bit of clutter and wear. So, Robert Knight has stepped in to clean up the program's code, and more than anything else, fix a cluttered and difficult interface. Read on for the details.

The goal of Konsole itself is pretty simple: provide a window to run a command prompt and command-line applications from. In fact, it has evolved from the very simple 'kvt' terminal program in the pre-KDE 1.0 days. An older KDE 1.x version of Konsole is pictured below:

Image courtesy of a (very old) book about Linux at linuxbook.orbdesigns.com licensed under the (also very old) Open Content License v1.

The version of Konsole from that era was very simple, but it wouldn't stay that way, as more and more features were added. Konsole users wanted transparency (shiny!), support for more text encoding schemes, ways to control every feature possible: Konsole ballooned into a monster. By KDE 3.x, it can best described as a highly-functional mess.

As an example of just how bad Konsole had become for KDE 3.x, I present the following screenshots, the first showing a normal Konsole window from KDE 3.5.6:

Possibly the worst settings menu of any KDE application in KDE 3.5.6 follows:

And if that isn't enough, actually going to the settings dialog makes the situation even worse.

If this isn't the most user-friendly theme dialog you've ever seen, then demand a refund. (I joke! It's actually terrible for many reasons, but the seemingly random nature of it is probably the best reason to dislike it).

The worst offenders are the settings menus, as you can see. An overly complex settings menu leads itself to an ugly settings dialog.

When the KDE 4 development series commenced, Robert Knight took over maintainership of Konsole. He decided that he would focus on bug reports and feature requests filed via the KDE Bugtracker, bugs.kde.org. Ever aware of the fact that users can be pretty picky about what features an application like Konsole needs to have, he created a few online surveys to help with the determination of the most common as well as fringe use cases. This feedback has driven much of the work.

The end result is a Konsole for KDE 4 that is visually very similar, functionally improved and with a settings system you can actually stomach. The screenshot below shows that the main window has not changed too much. The tabs are shown at the top in this screenshot, however Robert tells me that they have been defaulted to the bottom of the window as this article went to press. Additionally, you'll notice that the text on the tabs contains more helpful information. This is configurable is a friendly manner - see three shots down.

The once-intimidating settings menu now becomes very simple. It may look like the configuration options are gone, but they are still all available in a sanely organized fashion.

As you see below, the settings menu leads to a Profile selector, under which all the settings are kept separated. They are much more organized now, rather than an odd collection of random check boxes.

And lastly, the appearance people will appreciate this dialog: its implementation is effective and its use becomes obvious. Additionally, Robert has implemented style previews in an intuitive manner. As you mouse over the style, the Konsole window in the background automatically applies that style in an active preview. So you can very rapidly look through and appreciate the styles just by hovering over the list.

Side-by-side comparisons aside, Konsole also offers a number of other improvements. Among them, split-view mode, faster scrolling (thanks to a smarter line redrawing scheme), hotkeys and more.

Much of the inspiration for these improvements comes from analysing other programs. For example, the split-view mode, pictured below, is inspired by GNU Screen. It is a console output cloning tool so that you can see two views of the same scroll buffer. For example, if you are a developer, and you need to compile something really big (like say, KDE), then you can read through the scroll at your own pace on one side, while still monitor the output progress simultaneously. This is not a multi-panel model like Konqueror, so much as it is a cloning mode that lets you see more than one thing at a time within the same buffer. In this shot, the two sides are displaying the same output, just scrolled to different points.

There is friendly interaction between Konsole and some of its biggest users. In particular, Yakuake just recently implemented a Split View mode like the one listed above. When I asked Eike Hein about the relationship between the two projects, he said "I think Yakuake is beneficial to Konsole in KDE 4 in so much as Yakuake is a more demanding user of the Konsole KPart than most applications, so developing Yakuake has resulted in finding out a few things about how the KPart's interface can be improved :)"

Konsole has benefited from a few features that were requested by the Yakuake users. For example, there is a new hotkey that pops the terminal up and down quickly. This was in response to requests from the Yakuake users when Robert did his interface survey. Of course, like all things KDE, it is configurable. With Robert at the helm, it is even more user-friendly to configure it.

Future plans for Konsole include, among other things, ideas such as: tear off tabs, a commandline configuration interface, and making tea. I asked Robert if it would one day make coffee, but he's British and much prefers it to make tea it seems. Perhaps when it obtains beverage-making abilities, this argument will resurface once again. :)

On a side note, this is the first time I have attempted to write my article from within KDE 4 itself. While a few applications were not stable enough to use, including Kicker (which is dying anyway), the experience was good enough that I will probably do the same henceforth. Now that the libraries have mostly settled down (with a few exceptions), the changes are becoming more apparent in the applications. I'll be keeping an eye out for more things to feature in this series, but the next topic should be the KWin window manager, barring any major problems. Cheers.

Comments

That's really nice to hear - thanks for your reply!


By stormwind at Wed, 2007/05/23 - 5:00am

I agree. The only option of konsole i use at all is changing the encoding - at my work i need it almost all the time - it would be awkward if it's hidden in a menu.

stormwind


By stormwind at Wed, 2007/05/23 - 5:00am

great to hear the konsole gets enhancements for managing the configuration, it's necessary - but let's get back to earth - how often does the normal user change the configuration of konsole?

IMHO a first time run wizard should/could handle the most wanted features
* location of tabs top/bottom
* color scheme
* keyboard layout
* font
* encoding


By ferdinand at Wed, 2007/05/23 - 5:00am

I disagree with wizards as a rule. If a person has not used a program before, they have no experience to draw upon to make reasonable choices in the wizard, and can end up with some totally bizarre configuration. I'd rather see a sane default (which is not difficult to do for a terminal program), and a logical way to make tweaks, should the user require some changes. This way, they at least know that they have a preference, before asked to set their preferences. Or am I totally off my rocker on this one...


By Troy Unrau at Wed, 2007/05/23 - 5:00am

Dunno how it is "usability wise" since I'm just a normal user, but what you said sounds very reasonably.

I too love to make tweaks. However there are applications which I just use the default settings. Photoshop (yes, I use it instead of Gimp etc). I think a really good default setting should be the goal of all KDE apps, even if you may tweak it if you want.

To take it further, I think it applies to toolbars and such too. So the toolbar should IMHO be "locked" by default.


By Lans at Wed, 2007/05/23 - 5:00am

I *still* don't know what my preferences are for konsole :) every few months I go and tweak a setting or two to get it a bit closer to what I feel like I want at the time...


By Chani at Thu, 2007/05/24 - 5:00am

First-time wizards suck, because normally on public computers (at my uni, for example) a new user profile is created each time someone logs in, so you would have to put up with the wizard every time you started the app.


By AC at Wed, 2007/05/23 - 5:00am

A normal user doesn't use konsole :-)


By Waldo Bastian at Thu, 2007/05/24 - 5:00am

The only reason you need a first run wizard in an app is for apps that can't run without configuration - Kopete, KPPP, KMail are examples of this. Konsole, conversely, is perfectly runnable without any configuration.


By Will Stephenson at Thu, 2007/05/24 - 5:00am

In Konsole, does anyone know how to open a new tab (as with ctrl+alt+n) that would bring you to the same directory as the current tab? I have never found the way to do that.

As far as I remember, it is even the default behavior in gnome-terminal.

If it is not possible, I would suggest to put an option in the session(s) configuration (well, profile definition, if I got the changes right), and to enable distinct shortcuts for the sessions/profiles. The latter would be a very interesting feature by itself. :-)

Anyway, thanks for your work. Konsole is extensively used by many of us!


By Hobbes at Wed, 2007/05/23 - 5:00am

> I have never found the way to do that.

As far as I know, there isn't a simple and easy way to do that. Konsole/KDE 4 doesn't provide that option yet either, but I do plan to add it at some point.

> and to enable distinct shortcuts for the sessions/profiles.

The facility to define custom shortcuts for each profile and use them to create new tabs is already implemented.


By Robert Knight at Wed, 2007/05/23 - 5:00am

Couldn't you use a custom KHotKeys shell command with a few dcop calls ?


By Khotkeys ? at Thu, 2007/05/24 - 5:00am

That would be a really kludgy way to implement such a useful feature ;P. And horribly slow, also. I have already tried to make a KHotKeys command to open current folder from active Konq window in Yakuake, as a new tab. It worked, but took quite a time after the keypress ;P. Of course, you couldn't change the active window during that time xPPPPPPPPPP.


By zonk at Sat, 2007/05/26 - 5:00am

Bookmarks. Session->New Shell at Bookmark ->

Derek


By D Kite at Fri, 2007/05/25 - 5:00am

This will be a very useful feature. Since konsole lacks this feature , I am using gnome-terminal even though I did not like to use it. This is a feature for which everyone is looking after.


By Gvs at Thu, 2007/08/02 - 5:00am

It would be nice to cover also the new search bar in kosnole:
http://kdemonkey.blogspot.com/2007/03/konsole-progress-searching-history...

:)


By Roland Wolters at Wed, 2007/05/23 - 5:00am

My #1 wish for Konsole (and Yakuake) is the ability to make standard input a different color from standard output. When I scroll upwards, it is hard to find where I issued a given command, because it is lost among all the output. For example,

user@host:~$ sudo foo
...zillion lines of ouput...
user@host:~$ grep bar
...zillion lines of very similar output...

Currently, all the text is the same color. If the "user@host:~$ foobar" lines were a different color, they would be much easier to find.


By kwilliam at Wed, 2007/05/23 - 5:00am

> make standard input a different color from standard output.

Everything Konsole prints on screen is from the standard output. It just so happens that often the terminal echos the characters you enter via the standard input straight back to the output.

Changing the colour of the prompt is what you are after, and to do that you need to change the contents of the shell variable which produce the prompt.

A Google search for "bash change prompt color" (I take it that bash is the shell you are using) should turn up some helpful results.


By Robert Knight at Wed, 2007/05/23 - 5:00am

Sweet! Thanks. That will make life so much better. (I'll have to learn more about bash I guess.) Hopefully I can make that change automatic.


By kwilliam at Thu, 2007/05/24 - 5:00am

Cool. My new color scheme in ~/.bashrc.
PS1='\e[0;35m[\e[m\e[0;32m\u@\h\e[m\e[0;35m:\e[m\e[0;32m\W\e[m\e[0;35m]\e[m '

I must say though, that is about as crazy and convoluted a syntax I've ever seen. (sigh) Definately not newbie friendly. ;-)


By kwilliam at Thu, 2007/05/24 - 5:00am

So... don't trust everything you read on the internet. The code I mentioned doesn't work well, and caused Bash to do crazy things. I looked on google _again_. The first website had used "\e[0;xxm" syntax. Everyone else appears to be using "\[\033[1;xxm\]" syntax. I must say, this seemingly simple task has proved is incredibly difficult. I consider myself a moderate Linux geek, but this syntax makes editing xorg.conf look like a piece of cake. I finally ended up with:
GREEN='\[\033[1;32m\]'
PURPLE='\[\033[1;35m\]'
RESET='\[\033[00m\]'
PS1="${PURPLE}[${GREEN}\u@\h${PURPLE}:${GREEN}\W${PURPLE}]${RESET} "

I still think that Konsole is a logical place to adjust Bash prompt colors, although I understand if you think that is beyond the realm of Konsole. (Perhaps a stand-alone GUI is needed to help users configure .bashrc.) Regardless, I think I finally have this working, so I'm not too worried about it. Thanks again for the tip.


By kwilliam at Thu, 2007/05/24 - 5:00am

o.0
mine's been coloured for as long as I remember. dunno whether it came with kubuntu or I copied it from an older comp or what, but I found this line in my bashrc:
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

and I agree that the syntax is frigging scary.


By Chani at Thu, 2007/05/24 - 5:00am

oh, and for gentoo, I have a bright red prompt if I go root. very useful reminder to not do risky things at that prompt...

but in kubuntu I just use sudo :)


By Chani at Thu, 2007/05/24 - 5:00am

This discussion was very useful. Thanks for posting this issue and solutions!


By abcd at Sun, 2007/05/27 - 5:00am

The syntax is slightly better (and more portable to other terminals) if you use the tput command to generate the escape sequences. The trick is going through the terminfo(5) man page and determining what to give tput.

Bash's prompt syntax (at least for what I do) was one of the things that made me take so long to switch my shell from tcsh to bash.

In bash, I have: PS1="\[$(tput smso)\]\h \@\[$(tput rmso)\] \w\\$ "
In tcsh, I have (with a couple more minor features):
set prompt = "%S%m %t%s %c03%# %L"

Of course, I'm just inverting fg/bg colors rather than changing to purple or green. But it works well for me.


By Rob Funk at Thu, 2007/05/24 - 5:00am

- console settings have to be editable by console, either by editing config files or console commands
- you don't need n different settings for open windows and don't change them twice a day.

Conclusion: concole configuration can be left to an external graphical config tool, e.g. a KcontrolCenter Module. It is also better to make a program Konsoleprofile which generates konsolethemes and you as a user can only select from 5-12 predefined good themes for the konsole. You shouldn't invent them yourself and if so that is the task of another program, not for everyday settings. powerusers will edit the config files.

The settings-codes menu is obsolete.

And the Konsole handbook is absolutely not helpful for beginners. It includes everything you don't want to know.

Remove KDE 2.0 style usability hells like the marmor background prefab setting


By ben at Thu, 2007/05/24 - 5:00am

Please?


By superstoned at Thu, 2007/05/24 - 5:00am

>-console settings have to be editable by console, either by editing config files or console commands

Last I talked to Robert, this is definitely planned. I quote from email: "Something which isn't there yet but I plan to add is a command-line
tool to manage profiles ( saved terminal setups ). The dialogs are
useful when visual previews/feedback are desired, or to browse
available options. For people who know what they are doing though,
the command-line is a much faster way to get things done - hence the
reason why people still use terminals."

I didn't add that to the article because of length concerns more than anything else, but there you go :)


By Troy Unrau at Thu, 2007/05/24 - 5:00am

dbus?


By Aaron J. Seigo at Thu, 2007/05/24 - 5:00am

Thank you Troy for this nice report and thank you Robert for this very promising konsole. I use it all day long and i really appreciate your work improving it.


By Med at Thu, 2007/05/24 - 5:00am

Please, please, do something with the copy/paste shortcuts in Konsole (standard is CTRL+C/CTRL+V).


By JS at Thu, 2007/05/24 - 5:00am

I'm afraid that would be a very ill-advised move. AFAK CTRL-C is the standard means of killing a running application in a terminal. You'd risk challenging muscle memory of command line users obtained from several decades of use to accomodate comparatively more recent copy/paste shortcut usage.

Besides, most solely GUI based users wouldn't tinker with the command line anyway and it's far better not to alienate people accustomed to using a shell.


By Command line User at Thu, 2007/05/24 - 5:00am

Ctrl+C, Ctrl+V are reserved for use by terminal applications, so the closest alternatives ( Ctrl+Shift+C and Ctrl+Shift+V ) are used.


By Robert Knight at Thu, 2007/05/24 - 5:00am

i'm glad to hear this, as i am setting ctrl+shift+c as 'copy' whenever i use konsole for longer than a couple of commands ;)
i still use shift+ins for pasting, though.


By richlv at Mon, 2007/05/28 - 5:00am

Ummm... and break Ctrl+C being the kill signal to processes in the shell?

Ctrl+C isn't Copy for a very good reason.

And Ctrl+V also has special meaning to many console programs.


By StuP at Thu, 2007/05/24 - 5:00am

The standard behaviour of Ctrl+C pretty much anywhere, even on MS Windows, is to send a break signal. I don't know if Ctrl+V has a standard behaviour, but it appears to echo codes for special keys (on bash/rxvt at least).

The most widely accepted shortcuts for copy/paste seem to be Ctrl+Ins and Shift+Ins - again, even on Windows. A number GUI programs do offer Ctrl+C/V as an alternative to Ctrl/Shift+Ins, but I doubt that you'll ever see that in a mainstream console program.


By Daniel at Thu, 2007/05/24 - 5:00am

I never understood konsole settings - even the control centre is easy compared to that thing ;)

my favourite improvement: qt4 handles fonts much better, so I can actually see *all* the chinese characters in konsole and not just a fraction of them. :)


By Chani at Thu, 2007/05/24 - 5:00am

Well, I would say that is quite an improvement :-)


By The Vigilant at Thu, 2007/05/24 - 5:00am

I wish /anything/ from KDE4 alpha worked /at all/ on my computer :P I know it’s far from being done...

Yeah, the chinese characters issue in Qt3 is really annoying. I can’t read Chinese, but I prefer seeing characters instead of little bullets or boxes :)


By ralesk at Sat, 2007/05/26 - 5:00am

I use tab close and open buttons. Where they gone?


By sin at Thu, 2007/05/24 - 5:00am

I also like to know, what about the "new tab"-button on the left beside the tabs.


By Volker at Sat, 2007/05/26 - 5:00am

Also, where are the right click menus on the tabs? I use that to enable "Send Input To All" and it feels rather clunky now to have to 1 - Make sure I'm on tab I want to use as the input rather than simply right click on the tab I want, then 2 - Have to open the edit menu to select the "Send Input..."

Other than that, it's a very nice cleanup.

--Beemer


By Beemer at Wed, 2007/12/12 - 6:00am

Nice article all in all. But a bit of an emotional rollercoaster, I think the bashing of KDE3 Konsole goes too far. But all's well that ends well I guess.

Sure it's very nice that it's gotten some extra polish, but it wasn't that bad, neither is the rest of KDE3. It seems that a lot of people have bought into the GNOME "FUD" about KDE usability.

Don't believe it, as Will Stephenson writes here:
http://www.kdedevelopers.org/node/2816


By cb400f at Thu, 2007/05/24 - 5:00am

Emotional roller coaster! What do you mean! *stomps feet* (just kidding man).

I see your point, but I will suggest that it wasn't my intention to bash previous KDE versions which I have used and enjoyed for almost a decade now. What I did intend was to show progress, and without showing screenshots that compare the two, that is quite difficult for an application such as konsole, since well... the main functionality of the application has been there since KDE 1.0. That said, I still do believe that it had one of the worst configuration dialogs in all of KDE... but I don't believe in the gnome way of dealing with the problem. In that scenario, options would have been removed, but we have elected to reorganize them rather than remove them, preserving the power and flexibility of the application, without losing users in a poorly organized dialog. I hope you understand the subtle difference between the two philosophies. I feel it is really important not to hide or remove options, especially in a power user application like Konsole, and I hope you did not get that impression from the article.

Cheers


By Troy Unrau at Thu, 2007/05/24 - 5:00am

"In that scenario, options would have been removed, but we have elected to reorganize them rather than remove them, preserving the power and flexibility of the application, without losing users in a poorly organized dialog. I hope you understand the subtle difference between the two philosophies. I feel it is really important not to hide or remove options..."

It is not a subtle difference, it is a major and crucial one. It is what makes KDE the best DE ever. And I hope the rest of KDE4 team shares your vision.


By aha at Tue, 2007/05/29 - 5:00am

Do the tab improvements include optionally getting (part of) the tab title from the xterm window title that can be set from the shell?

I have this in my .bashrc:
case $TERM in
xterm*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}\007"'
;;
esac
So before every prompt, bash sets my window title to username@hostname. Sometimes this feature is used to show the current directory. It's always bugged my that this information doesn't appear on the tab title.


By Rob Funk at Thu, 2007/05/24 - 5:00am

In KDE 3 you can set the tab titles to match the window title via the "Set tab title to match window title" option in the General page of the settings dialog.

In KDE 4, you can include the window title set by the shell in addition to other text or dynamic elements.
The default tab title formats are "directory : program" for shells running 'local' commands and "host (user)" when you run ssh to connect to another computer ( the host/user information in that case is taken from the command-line arguments to ssh, so it may or may not be helpful depending on the way you work )


By Robert Knight at Thu, 2007/05/24 - 5:00am

I was wondering if it is also possible to assign very short names to the tabs to be able to have as many opened as the width of the screen allows. I am compiling lots of software in virtual machines and across the network so I need as many tabs opened as possible and the names need to be meaningful but short.

Is there or will there be any provision to set the names on the tabs to something like "Sxx" instead of "Shell no. xx"? Otherwise I'm fond of Konsole and have been using it for years and I'm looking forward to more nice things to come in KDE 4.


By Sunil Janki at Tue, 2007/05/29 - 5:00am

Just wondering if one could use Konsole for VT200-sessions instead of e.g. Reflections.
Would mean a lot to our production environment....


By Frits at Thu, 2007/05/24 - 5:00am

Thanks for the improved Konsole! :)

Also, could you remove (or make optional) the extra border in KDE 3.5.5 that makes a true full-screen console impossible?

thanks


By Helmudt at Thu, 2007/05/24 - 5:00am

Pages