Saturday, June 2, 2007

konsoleprofile

I added a handy little tool to Konsole recently.

konsoleprofile allows any profile options to be set from the command line. This means that it is possible to change the color scheme, font, tab titles, menu bar mode, scrollback size, icon, key bindings, cursor options and others without resorting to the GUI.

For example, running:

konsoleprofile colors=GreenOnBlack

Inside the shell will change the active tab to use the green-text-on-a-black-background color scheme.

konsoleprofile icon=kde

Will set the icon for the active tab to the KDE icon.

konsoleprofile showmenubar=false

Will hide the menu bar.

The actual parsing of the commands are done inside konsole. konsoleprofile is just a trivial shell script which puts some magic markers around the command so that Konsole interprets it as a profile change request. Aside from simplicity, this has an advantage over the D-COP days of old because it doesn't matter when it is being run locally or on another computer being accessed via SSH. The tool currently affects every tab using the same profile as the current tab, that is clearly not always desirable, but I plan to fix that shortly.

14 comments:

Anonymous said...

Neat feature - looks like Konsole is in very capable hands :)

sebas said...

I can imagine a lot of funky stuff with zsh's pre- and post-exec hooks, such as setting the icon to busy while commands run, changing the colorprofile based on who's logged in or under what privileges a user runs, different colorprofiles for hosts, ...

Nice work, Robert!

Unknown said...

Nice and useful.. but why that strange notation? Why not standard unix way: konsole --colors=GreenOnBlack or short konsole -c GreenOnBlack ?

Unknown said...

> but why that strange notation

The dashes are there in most Unix commands to distinguish flags ( from a subset of the available options ) from the main arguments - the file to operate on, the host to connect to and so on.

In this case the argument is simply a semi-colon separated list of key/value pairs which the terminal interprets and applies to the current session - so there isn't really a need for the dashes.

The reason why a separate "konsoleprofile" script is being used rather than just konsole with some command-line arguments is so that the script can be copied around onto various servers (including those with no GUI applications on them) or wherever it is useful to have it.

Anonymous said...

Nice Feature.
I was wondering, would it be possible to have the profile to remember the colors of each tab (and maybe the directory to start with)?.

Anonymous said...

Really nice way to bridge the gap between GUI and command line. Full screen xterm posers, Konsole will assimilate you! :)
Robert, this is really good work you are doing on Konsole. It was already the best before you started and now it's even better.
Configurable tab captions for local and remote are really cool, for example [I suggested them in the survey :)) ]. Not to mention the new configuration dialog...

Anonymous said...

aefUnb Your blog is great. Articles is interesting!

Anonymous said...

QtRUG9 Please write anything else!

Anonymous said...

actually, that's brilliant. Thank you. I'm going to pass that on to a couple of people.

Anonymous said...

Nice Article.

Anonymous said...

Wonderful blog.

Anonymous said...

Good job!

Anonymous said...

Thanks to author.

Anonymous said...

konsoleprofile color=colorname works fine. But how could i set a font? konsoleprofile Font=Courier or "Courier,16" does not work. What is the exact syntax?