Is it possible to make a shell script to open browser tabs like Plasma search does?

hii! im new here(and a bit new to linux :D) just wanted to know if its possible to replicate the Plasma ability to open browser tabs:

is it possible for me to make a command on a file that opens a tab if I give it a string like open-tab.sh "youtube" "``https://www.youtube.com/``" and it tries to find that tab open in the background, & if not it opens aa new one?

I’m only now starting to learn this but at least I know I can open links like this :stuck_out_tongue:
❯ xdg-open "https://www.youtube.com/`"`

Thanks in advance.

Yes, and you already answered your own question. xdg-open.
What’s the exact logic you wanna achieve?

The Plasma search can detect tabs you have open already on the browser and bring them up, I wanna replicate that
if i run “xdg-open https://discuss.kde.org/t/is-it-possible-to-make-a-shell-script-to-open-browser-tabs-like-plasma-search-does/49077” on the console its gonna open a new tab instead of bring up this one that is already open

so I wanted to know how plasma search finds and activates browser tabs like it shows on the second screenshot.

Interesting. I didn’t know that that’s a thing. I was actually looking for a way to do that myself: open a tab but only if it’s not open already (e.g. automated bash script that starts a vite server and opens it in the browser if the tab is not already open). I haven’t found any solutions to this but if Plasma Search already offers that then I’d be interested to know how it does that

All this functionality, also with history and some other stuff is handled by Plasma Browser Integration. Given it’s a combo of host daemon and a browser extension, I fear it’s going to be hard to replicate or even integrate with only a shell script.

I see. Yes, when I did my research to achieve what I wanted I did find that one possible solution is to write a custom extension that exposes currently open tabs in a json file or similar but yeah you’d have to write an extension

a bit late but thanks for the reply, I guess the next step for me is to look at the that extentions source code to see if I can replicate it somehow.