Is there anyways to determine which ide the terminal is running in?


I'm running tmux in my terminal. I've managed to get tmux to load different default settings based on the terminal emulator. Currently, I'm getting the terminal with:

echo $(basename "/"$(ps -f -p $(cat /proc/$(echo $$)/stat | cut -d \ -f 4) | tail -1 | sed 's/^.* //'))

That works for identifying the terminal emulator. The only issue is RubyMine and CLion use the same terminal. Is there anyway to determine which ide is running the terminal from a .zshsrc file?

Comment actions Permalink

In IDE Terminal settings one can specify the shell path. You can try a workaround with a custom wrapper script for the shell path that will set some environment variable and then call the actual shell. Then you will be able to tell that the shell was called from the IDE by this environment variable.

You can also try to query the parent process information to know that it's launched from an IDE.

Comment actions Permalink

Alright, and at some point up the chain of parent processes I'm bound to find which IDE. Thanks.


Please sign in to leave a comment.