How to launch an application with default “terminal emulator” on Ubuntu?

I wanted to execute some command in terminal emulator, like Konsole, but I need to make this cross-desktop.

Is there some command like xdg-open, but for getting the default terminal emulator?

I’m using Ubuntu.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

In Debian, you could just call x-terminal-emulator -e /some/command, as this points to the terminal emulator configured by Debian’s “alternative” mechanism. It’s configured via

# update-alternatives --config x-terminal-emulator

which lets you chose which of the installed X11 terminal emulators to use as the default one, i.e. as x-terminal-emulator. In the end, it’s a symlink construction, e.g. for gnome-terminal:

$ which x-terminal-emulator
/usr/bin/x-terminal-emulator
$ ls -al /usr/bin/x-terminal-emulator 
lrwxrwxrwx 1 root root 37 Apr 26  2010 /usr/bin/x-terminal-emulator -> /etc/alternatives/x-terminal-emulator
$ ls -al /etc/alternatives/x-terminal-emulator
lrwxrwxrwx 1 root root 31 Apr 26  2010 /etc/alternatives/x-terminal-emulator -> /usr/bin/gnome-terminal.wrapper
$ file /usr/bin/gnome-terminal.wrapper
/usr/bin/gnome-terminal.wrapper: Perl script, ASCII text executable

Some remarks,


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x