I guess you could set it to run in a single process (settings>general) and then change the executable for konsole to konsole --new-tab and make sure the tab bar is always visible.
Futhermore, you can also start konsole with a couple of predefined tabs.
You’d need to create such a file in ~/.konsole ( if needed, create the folder) and it should look something like, for example:
workdir: /home/john;; title: Htop;; command:htop
workdir: /home/john;; title: Ranger;; command:ranger
workdir: /home/john;; title: Cava;; command:cava
You start it with “konsole --tabs-from-file /path/to/the/file”. It’ll always have a default tab, regardless how many predefined tabs you create in that file)
In that same folder you can also create a konsole.css in case you should like some fancy like highlighting the current tab and what not. You can enable that css in konsole ( settings>tabbar/splitters).
Something like ( starting konsole with a bunch of preloads and css):
I tried to hack together a service menu in combination with a script that lets you choose the window you want to open the new tab in using qdbus (requires kdialog).
Only thing I couldn’t figure out was how to focus/raise the window where the tab is created.
Save in ~/.local/share/kio/servicemenus/openInKonsoleTab.desktop
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=inode/directory;
Actions=openKonsoleHere;openKonsoleTabHere;
X-KDE-AuthorizeAction=shell_access
X-KDE-Priority=TopLevel
[Desktop Action openKonsoleTabHere]
TryExec=konsole
Exec=konsole-new-tab Default %f
Icon=utilities-terminal
Name=Open Konsole Tab Here
Comment=Opens a new Konsole tab at the current directory
[Desktop Action openKonsoleHere]
TryExec=konsole
Exec=konsole --workdir %f
Icon=utilities-terminal
Name=Open Konsole Here
Comment=Opens a Konsole window at the current directory
Save in ~/.local/bin/konsole-new-tab
#!/usr/bin/env bash
# Default to "Default" profile and home dir (/home/USER/)
PROFILE="${1:Default}"
DIRECTORY="${2:-HOME}"
mapfile -t konsole_windows < <(qdbus "org.kde.konsole*")
echo "windows:" "$(printf "'%s' " "${konsole_windows[@]}")"
formatted_options=()
# Convert options to the desired format
for i in "${!konsole_windows[@]}"; do
# window_name=$(qdbus "${konsole_windows[$i]}" /MainApplication org.qtproject.Qt.QGuiApplication.applicationDisplayName)
window_title=$(qdbus "${konsole_windows[$i]}" /konsole/MainWindow_1 org.qtproject.Qt.QWidget.windowTitle)
window_sessions_count=$(qdbus "${konsole_windows[$i]}" /Windows/1 org.kde.konsole.Window.sessionCount)
formatted_options+=("$i" "Title: $window_title ($window_sessions_count open tabs)")
((i + 1))
done
# Show dialog to pick a window
selected_window=$(kdialog --title "New Konsole Tab" --menu "Select window to open $DIRECTORY in new tab:" "${formatted_options[@]}")
if [ $? -eq 0 ]; then
# user clicked OK, open new tab in selected window
qdbus "${konsole_windows[$selected_window]}" /Windows/1 org.kde.konsole.Window.newSession "$PROFILE" "$DIRECTORY"
fi
Oh, my bad. I was testing plasma 6 before, reverted to kf5/qt5 and is working now. I didn’t build Konsole from source so probably that was the reason --new-tab wasn’t working for me.
No it’s not. It only opens a new window if the setting “run in a single window” ( process) isn’t ticked ( as mentioned). The orange one is the new tab in the same window.
the easiest and best way i found to do that is just assign a shortcut to “open a new tab” in system settings>shortcuts>konsole, and enabling the “run all Konsole windows in a single process” in konsole configs