Currently, I am trying to call the external terminal without any keyboard maestro environment variables. The reason being, I need to pass in some flags and options, so I cannot simply use the built-in "activate a certain program".
However, when I run the shell script, all the keyboard maestro variables are exported into the sub-shell: if I echo $KMVAR_kmvar, I get back the predefined string.
On the off chance, is there any option to run a script without exporting the environment variables? If not, are there other ways to call an external shell with flags/parameters without opening a Terminal/iTerm/kitty instance itself?
Why do you care? The shell often has lots of irrelevant environment variables in it - unless you reference them, or unless you actually run out of environment variable space why would it matter? Environment variables don't affect anything unless they are explicitly used for something or have a pre-defined meaning (which KMVAR variables do not).
But if you really really want to get rid of them, do it in the script - go through all the environment variables and unset all the KMVAR ones (I don't have shell code to do that offhand but it cannot be that hard).
Thank you both for pointing me in the right direction.
As I want usually want at least one terminal (interactive) instance open, I wanted to mimic activate kitty.app without the special KM variables in my main interactive session. Personal preference, I guess, aligning with the philosophy of using local variables in KM as well.
Currently, the other alternative to unsetting variables I see is to just open a terminal, run my command (/usr/local/bin/kitty --bunch-of-flags), but I can't close the parent shell, otherwise it would terminate my kitty instance. I know it's going off topic now, but Google searches led me to the bg, disown commands, but honestly I'm at my limits.
Which leads me to a general, final question: is there a native way to run background scripts preferably via hotkeys?