Thread: Detect terminal emulator
hey,
have console application , i'm trying run instance of default terminal emulator, user can see output when program run within file manager.
right now, have this:
this works. kinda.code:const char* args[]={"gnome-terminal","-x",getexefilename().c_str(),"--nospawn",0}; execvp("gnome-terminal",const_cast<char**>(args));
problem creates terminal window when run terminal. , of course, fails when trying run outside of x environment.
there way reliably detect 2 situations in order avoid executing above code in cases?
i decided take advantage of fact output redirected .xsession-errors when program run file manager. in other cases, file name associated stdout /dev/ptsx or /dev/ttyx.
redirection .xsession-errors standard? file have same name on other (important) linux distributions?
edit: /usr/bin/x-terminal-emulator? points wrapper script default terminal emulator on ubuntu, true other distributions?
works expected now, i'm not sure if work fedora, arch, opensuse, etc..
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Detect terminal emulator
Ubuntu
Comments
Post a Comment