Skip to content

Instantly share code, notes, and snippets.

@michaelbutler
Last active June 17, 2022 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelbutler/723156c84a3c6eaa53f898f5b9021f9b to your computer and use it in GitHub Desktop.
Save michaelbutler/723156c84a3c6eaa53f898f5b9021f9b to your computer and use it in GitHub Desktop.
Auto open and split multiple Konsole tabs in KDE using a simple script

How to script and configure Konsole Splits and Tabs Automatically

Screenshot_20220617_144315

Find yourself repeatedly opening new tabs and splitting consoles every time you restart your machine? I made a shell script (and a json file) to set up Konsole exactly how I want it just by running a single command (also linked with a Desktop shortcut).

How To

First create a file called tab.layout.json and store it in $HOME.

{
    "Orientation": "Vertical",
    "Widgets": [
        {
            "SessionRestoreId": 1
        },
        {
            "SessionRestoreId": 0
        }
    ]
}

Then create another text file (shell script) konsole-splits.sh and put it where you want. I put it in ~/bin which I have configured as part of my $PATH for executing. Use chmod +x konsole-splits.sh to make it executable.

#!/bin/bash

# konsole-splits.sh

konsole --layout tab.layout.json --new-tab &
konsole --layout tab.layout.json --new-tab &
konsole --layout tab.layout.json --new-tab &
konsole --layout tab.layout.json --new-tab &

Now whenever you run konsole-splits.sh, it will open Konsole with 4 tabs, each tab with a horizontal split (one terminal on top of another one). You can customize the script and the json file to your liking. If Konsole is already running, it will add 4 new tabs each time.

Screenshot_20220617_145240

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment