I want to run a script in a new terminal window. I found several solutions such as this. However, they all provide terminal specific solutions. So konsole ./myscript.sh
works if I'm using konsole, but not if I'm using gnome-terminal or some other terminal program.
Is there a way to open a new terminal that is of the same type as the current one? Or equivalently, a way to locate the executable for the currently running terminal? Or am I misunderstanding something and this doesn't make sense in general, and I should just hardcode a few specific options.
I primarily use arch, debian, and ubuntu, so if there is a solution that works on just those three that would be fine, albeit suboptimal.
case $(cat /proc/$PPID/comm) in gnome-*) ... ;; konsole*) ...;; esac
(you cannot use the command name directly with gnome, since gnome-terminal does not start itself a shell process, but asksgnome-terminal-server
to do it for it. – Dec 05 '19 at 20:21$WINDOWID
environment variable (which could allow you to get the name of the terminal command via the_NET_WM_PID
orWM_COMMAND
properties), but it's not set by gnome-terminal. – Dec 05 '19 at 20:27