Imitate "dolphin --new-tab"

It makes sense to open a USB device just plugged in or the Trash folder in a new window, which means the checkbox “Open new folders in tabs” in Dolphin Settings should better be kept clear.
But what if one would like to open that symlinked folder using the real path in a new tab in the current window?
Unfortunately, Dolphin does not have a “–new-tab” option, although it has a “–new-window” option.
I use a servicemenu item for this purpose, and it works essentially like this:

sed -i ‘s/OpenExternallyCalledFolderInNewTab=false/OpenExternallyCalledFolderInNewTab=true/’ “$HOME/.config/dolphinrc”
sleep 1
for dir in “$@”; do
dolphin “$(readlink -f “$dir”)” &
done
sleep 1
sed -i ‘s/OpenExternallyCalledFolderInNewTab=true/OpenExternallyCalledFolderInNewTab=false/’ “$HOME/.config/dolphinrc”

Although I wish I knew a better way of achieving this. Any ideas???

You can middle click on the folder, or use the current “Open in new tab” context menu action for folders.

It would depend on your dolphin version, you didn’t specify your distro or versions.

Sorry, apparently I forgot to mention that the idea is to open a symlinked folder in its real path, as done in the script below (I use Dolphin 23.08.1, KDE Plasma 5.27.11, Debian Trixie by the way).
For instance, for ease of use, I have a symlink of the folder ~/.config (and some other hidden folders and files) in ~/.local/share, which is bookmarked. When I open them directly, the search function doesn’t return any results, for instance, because it has not opened in its real path. So, I would rather have such symlinked folders opened in their real paths.

If I get this right, the search function doesn’t work in a symlink folder?
If so, you could create a servicemenu and have an exec like:

Exec=dolphin --select “$(realpath %f)” && dolphin %f

That will open the link in its real path and open it while you’re at it. That is. If you already have a dolphin window open. Otherwise it’ll just highlight the real path in a dolphin window and you’ll have to click it to show the content.

Thanks. I think you meant this:
dolphin --select "$(readlink -f %f)" && dolphin %f
But it executes both commands, opening two new windows; one the real path of the symlink, the other its parent (just like “Show Target” in the context menu), following the default behavior of Dolphin to open new folders in a new window.
Probably there’s no simpler way of doing this other than the script I have written.

It works flawless if you have “in new tab” ticked. I use it as such cause I don’t want the clutter of a bunch of windows.

Yes, in that case, your method does it. Actually, I would like to see a new Dolphin window only when I click that Trash icon on desktop, or the “Mount and Open” prompt for a newly plugged in USB device. Maybe it’s better to use the existing “dolphin --new-window” option for them, and then change the default behavior.

Oh yes, indeed. Fairly sure you can set those parameters for just a few. I mean, I’m using a single not too big monitor. So real estate matters. But I guess if you have a pool table size screen it doesn’t really matter.