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).
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.
There is an option for creating a tabs layout which accepts commands. If you don't need splits, this would be the proper way of working. The argument is --tabs-from-list
What would be ideal, is to be able to somehow make both work together. I tried adding the options that I get with --list-profile-properties to the JSON file, but they are ignored. And opening a tabs file and a layout opens the layout as one tab (or a series of them) and the tabs in the tabs file as extra, unsplit, tabs...