Opening Konsole with Multiple Pre-loaded Tabs

Jerome Yuzyk jerome at supernet.ab.ca
Mon Jul 22 18:02:27 BST 2013


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 [1].

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 DBUS 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 [2] 
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: bss-gate;; 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 bss-gate 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.


This article is at http://blogs.bss.ab.ca/clippings.htm and any updates I 
make will be there.


[1] http://www.linuxjournal.com/content/start-and-control-konsole-dbus
[2] 
https://projects.kde.org/projects/kde/applications/konsole/repository/revisions/master/entry/src/Application.cpp

___________________________________________________
This message is from the kde mailing list.
Account management:  https://mail.kde.org/mailman/listinfo/kde.
Archives: http://lists.kde.org/.
More info: http://www.kde.org/faq.html.




More information about the kde mailing list