0

I'm working on a desktop app that uses a terminal popup to show the user what processes it is doing such as git cloning, installing packages, etc. The problem is that my team and I have resorted to installing and using Xterm for all users which looks out-of-place most of the time. I've been trying to find a reliable method to simply grab the system's default terminal emulator and launch it.

I've been told from someone to run os.system('basename "/"$(ps -f -p $(cat /proc/$(echo $$)/stat | cut -d \ -f 4) | tail -1 | sed \'s/^.* //\')') which will use bash to detect the terminal. Unfortunately this seems to only read the name of the file the command was executed from. It prints python from a Python shell, test.py from a script, and konsole from konsole. I tried using the command in a bash script and calling that but it only printed the name of the file it was in.

I've also been told to use os.system('echo $TERM') but it only outputs xterm-256color no matter what.

I tried pstree -sA $$ | head -n1 | awk -F "---" '{ print $(NF-1) }' and calling directly through Python and through bash script through Python and still no luck. Just exporting python.

Does anyone have a solution to check the default terminal? This must be able to run in a Python script to be stored as a variable. I simply need a native terminal emulator.

Edit: I'm running Arch Linux with the KDE desktop environment. This is being designed to run across any and every desktop environment.

0 Answers0