Tuesday, December 13, 2005

Mini-tip

For want of anything more interesting to write about, here's a little tip I came up with in response to a user's question on #kde.

The situation was this: The user has a konsole open with four tabs, each one showing the output of some "tail -f" command (with a different file for each tab). The question: how to have this setting saved and restored at login?

Well, my solution is a bit of a hack, and probably isn't the simplest way to do it, but it shows how a little knowledge of KDE internals can do almost anything you want :-). Here goes:

We create a new "Session Type" for each tail command we want to run. I couldn't see a GUI-based way to do it, but the commandline way isn't very hard: Just put a tailn.desktop file in ~/.kde/share/apps/konsole/ with the following content:

[Desktop Entry]
Encoding=UTF-8
Type=KonsoleApplication
Name=Tail command n
Exec=tail -f /path/to/somefile
Cwd=
Tips=false

Repeat that for each command you want to run in a tab. Now (after running kbuildsycoca, or restarting KDE), you can use konsole's session menu to start tabs for all of these commands. The command will run in its own tab, and on logout/login, the tabs (and commands) will be restored :-).

1 Comments:

At 9:49 PM, Blogger Oleksandr said...

Man, thanks a bunch for this tip. :D

 

Post a Comment

<< Home