Hello, i am trying to solve this one aswell for monitoring my system status. Found this on reddit:
For people that stumbled upon this post expecting a solution, here’s mine. It launches a new Konsole window with 4 splitted views. If you want just a one splitted view, delete the last three lines.Paste this code to a new file and make it an executable with chmod +x. You can even create a shortcut to use with KDE, just remember to add the path of the directory containing the script to the ~/.profile file so KDE shell will see it.
[link which i cannot post on KDE forums due to limitations]
{line}: {Simple explanation}
3: We launch a new konsole
4: We catch it’s pid, we need it for qdbus
6: Stops the script for 0.5 sec. You may need to make it longer, for me it was necessary because qdbus would return errors before Konsole fully launches
8: Split view vertically
9: Whenever we split the window, the focus seems to always be in the new session, so now we split the RIGHT window horizontally
10: Before this line we have a 1 window on the left and two windows on the right with the focus on the newest window (bottom-right). If we’re just gonna split view top bottom now, we would have 1 window on the left and 3 on the right. The split is always called on a window (session) that currently has the focus, that’s why this line sets the focus to the session with id 1, which is the lonely window on the left.
11. Simply split the left window horizontally.
I’ve personally added a -f flag to have an option to launch it in fullscreen, but I’ve removed it for the sake of simplicity. If someone’s interested just tell me. I hope you’ll find it helpful.
EDIT: For the reasons beyond me Reddit messes the formatting of my comment whenever I try to format this code properly, so I’ve moved it to a pastebin.
However, it does not invoke any commands, but shows how to change the focus withing the konsole. Then i found this:
I’m trying to write a script that will create a split Konsole & run a bunch of commands, similar to tmuxinator. Konsole has arguments to run commands in tabs, but the only way I found to do it in splits is via qdbus. Per this post:
qdbus org.kde.konsole-<pid> /konsole/MainWindow_1 org.kde.KMainWindow.activateAction split-view-left-right
- Find which session you want to run the command in
qdbus org.kde.konsole-<pid> /Sessions/1 org.kde.konsole.Session.runCommand "echo"
In step 3, if I use Sessions/1
it runs the command in the ‘first’ split, as expected. However, I can’t seem to figure out how to run a command in any of the others - any value other than ‘1’ throws an error.
If anyone knows how to figure out the ‘session’ needed to run a command in any of the other (non-primary) splits, I’d greatly appreciate any pointers. Sadly I’m completely inexperienced with qdbus, and haven’t turned up much after quite a bit of Googling.
On that matter, i have found this one:
qdbus org.kde.konsole-$the_pid /Windows/1 sessionList
Tried it out myself: