Jerome's
Blogs
     Clippings    Opening KDE's Konsole with Multiple Pre-loaded Tabs   
                 Here                                  There           
50    Clippings    Galleries    Golf   Bristol    Beach    Valley
  
Mail
Browse Me
Google
 I use a lot of links, and only thumbnail images open in a separate window. Middle-click or right-click a link to open it in a new window or tab.  

KDE's Konsole terminal has the ability to open multiple tabs for consoles, each tab opening a program, like an SSH session. These are notes on how.
 
< Previous
Clippings
     Start
........................................
     Next >
A Thanksgiving Treat: The Panasonic JE-855U Electronic Calculator
 

2013.07.22 Opening KDE's Konsole with Multiple Pre-loaded Tabs
 
Comment

 

 
2014-07-23 NOTE: The Konsole Help now contains all this material,
though this article is a good sample of how to use it.

While pursuing how to rename KDE's Konsole terminal emulator tabs programmatically I came across many people wanting to open and preload multiple Konsole tabs, the most-popular example being multiple SSH sessions.

There is a way to do this with D-Bus , described in this Linux Journal article.

I have wanted to open Konsole with multiple tabs after logging in, as part of an alternative to KWin's all-or-nothing approach to resuming sessions after login.

But for some years Konsole has had a built-in method to open with multiple preloaded tabs, without using D-Bus at all. Problem is, there are only hints at how to do this on the web and I only had a cobbled-together idea of how to use it and it only partly worked for me.

I finally got it to work correctly after reading the Konsole source for the function and would like to share how I use it to help fill in a little empty spot in the KDE documentation space.

I have a K Menu item configured to execute this command:

konsole --tabs-from-file /home/jerome/bin/konsole_Work

where /home/jerome/bin/konsole_Work is a text file that looks like this:

        title: Work;; workdir: ~/work;; command: vi _desk
        title: root;; command: sudo -i sysfiles
        title: gateway;; command: sshto gateway

When Konsole starts it will open 3 tabs doing 3 different things:

  • in Work I edit a file after cd-ing to a directory,

  • in root I run a script which edits a file, and

  • in gateway I run a script to ssh to my gateway server.

Each line of konsole_Work specifies a tab to open using up to 4 fields specifying how it is to open. Fields are delimited with ';;' and a field name must have a ':' appended.

title: a name for this tab, tab default if blank
workdir: working directory, ~ if blank
profile: a Konsole profile to use, the default if blank
command: a command to run

You must have one of profile or command. I only use one Konsole profile so I don't have experience with that option.

2014.07.24 Update:

A profile must be named fully - no extension is assumed. Luka from Croatia found this out by trial-and-error:

I use Konsole Version 2.13.2 from KDE Development Platform 4.13.2

... list of all profile names is most probably in home directory: ~/.kde/share/apps/konsole (it is list of all file names ending with .profile). My observation leaded me to the conclusion that default profile located there is named 'Shell' - while untouched. As soon as you change the attributes (color, font etc.) of the default profile, its name changes to Shell.profile. Also any additional custom profile created by user will get .profile extension to its name. The .profile extension can't be seen in GUI interface, while customizing and the name given, that's why all the confusion about.

Here is my konsole.tabs file:

    workdir: / ;; profile: Shell.profile
    workdir: /home/cavara/Downloads ;; profile: Shell.profile
    workdir: / ;; profile: user.profile
    workdir: ~ ;; profile: user.profile
    workdir: ~/Downloads ;; profile: user.profile
    workdir: ~/Downloads ;; profile: user.profile

With the command:

    konsole --tabs-from-file ~/konsole.tabs

I get konsole with six tabs launched (two with root color shema and four with user color shema).

 
 
< Previous
Clippings
     Start
........................................
     Next >
A Thanksgiving Treat: The Panasonic JE-855U Electronic Calculator
 
 

Jerome's
Blogs
     Clippings    Opening KDE's Konsole with Multiple Pre-loaded Tabs   
                 Here                                  There           
50    Clippings    Galleries    Golf   Bristol    Beach    Valley
  
Mail
Browse Me
Google
Document EQB/XRCL/0.1:2015.03.17    A branch of The BRIDGE Tree