Window Activation, what’s that? In short: for some actions you want to activate your application window. How to do that differs from platform to platform.
Some weeks ago there was a post by Kai about window activation on Wayland.
It explains nicely how the XDG Activation protocol works and how the different parts of the KDE & Qt stack implement it to correctly allow to activate the right windows in your KDE Plasma Wayland session.
Yeah, it is all not that easy. Perhaps others have better ideas or one will be able to generalize some dbus api other terminal emulators could then expose, too. Or we see the solution is crap in real life ;)
The primary issue is always that the shell is an “unaware participant”, essentially blocking the flow of information between the terminal and the newly launched application. Your approach essentially creates a by-pass communication channel which is likely the least hackish way even if it might not feel like that.
I have tried to come up with alternative ideas but they all have their own difficulties.
One option would be to use a mechanism like LD_PRELOAD to intercept the shell’s exec-family calls and inject an updated activation token.
A rather wild idea was to run the shell in-process on a thread of the terminal. This would then allow access to the now shared environment.
Probably best to somehow get various terminal developers together to think about this. They all have this use case at hand and best understand how they are currently “embedding” the shell.