Discussion:
Spec to define the default terminal?
Thomas Gläßle
2015-10-20 10:23:01 UTC
Permalink
Hello freedesktop.org,

This is a follow up on a bug to xdg-utils about xdg-open not spawning
terminals for .desktop files with Terminal=true entry [1]. Rex Dieter
suggested to start a discussion here before taking further steps.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=92514


To summarize the issue:

There is currently no uniform way to set the default terminal across the
system and so everyone seems to be doing their own thing:

- xdg-open does not know how to spawn terminals (leading to the
application aborting or even worse: suppressed output)
- mimeopen uses an environment variable $TERMINAL in the form
TERMINAL="xterm -e"
- rifle (file opener, part of the ranger file manager) uses an
environment variable $TERMCMD in the form TERMCMD="xterm"
- in awesome (window manager), you usually configure the terminal in
your lua.rc file
- not sure what desktop environments are doing in their code base, maybe
hardcoding their own terminals
- xdg-terminal (unreleased, part of xdg-utils) currently even looks at
$TERM and uses xterm as hardcoded fallback
- probably tons of others...


In the thread attached to the bug report we had several (not necessarily
exclusive) thoughts about how to tackle the issue:

1 a) invent a new variable e.g. $TERMINAL or similar that works like
$BROWSER, i.e. something of the form TERMINAL=urxvt:gnome-terminal:xterm

1 b) invent a new variable e.g. $TERMINAL or similar that works like the
one used by mimeopen, i.e. TERMINAL="xterm -e"

2) encourage the use of (and possibly semi-mandatory dependency on)
gvfs-open/kde-open

3). invent a mimetype for terminal applications so available terminals
can be iterated via .desktop files and a default can be requested in the
mimeapps.list file, e.g.:

[Desktop Entry]
name=terminator
GenericName=X Terminal Emulator
Exec=terminator -x %F
MimeType=x-terminal-emulator



My personal opinions:

concerning 1 a)

- [+] nice and simple
- [-] have to hardcode command line options, e.g. terminator uses "-x"
rather than "-e"
- considering $TERMINAL is already used in a different fashion by
mimeopen (and mimeopen is used as fallback by xdg-open), I'd rather tend
towards a different name for the variable, e.g. $TERMCMD which would be
upward compatible to how its used by terminator


concerning 1 b)

- [+] no need to hardcode command line options
- [+] compatible with existing mimeopen behaviour
- [-] contains more than just a executable name, may be less simple to
analyze


concerning 2)

- [+] easy out without much coding for xdg-open
- [-] doesn't really solve the problem that "everyone uses their own
mechanism"
- [-] I didn't look at gvfs-open/kde-open so far, but I'm afraid, they
don't allow the user to specify their preferred terminal as easily
- [-] seems like a heavy dependency


concerning 3)

- [+] uses an established config format
- [+] can configure multiple terminals with correct command line
options and the default
- [-] not sure if the mimetype concept applies to this problem very well
- [-] maybe too complex for such a simple goal
Thomas Gläßle
2015-10-20 10:37:27 UTC
Permalink
Post by Thomas Gläßle
1 a) invent a new variable e.g. $TERMINAL or similar that works like
$BROWSER, i.e. something of the form TERMINAL=urxvt:gnome-terminal:xterm
1 b) invent a new variable e.g. $TERMINAL or similar that works like the
one used by mimeopen, i.e. TERMINAL="xterm -e"
2) encourage the use of (and possibly semi-mandatory dependency on)
gvfs-open/kde-open
3). invent a mimetype for terminal applications so available terminals
can be iterated via .desktop files and a default can be requested in the
I forgot to mention option 4 which I saw lurking around:

4) use the binary x-terminal-emulator which is to be symlinked to
whatever terminal one wants to use.

- [+] nice and simple
- [+] possibly already supported by several subsystems?
- [-] system-wide config (you have to modify PATH in order to change
it for users)
Post by Thomas Gläßle
concerning 1 a)
- [+] nice and simple
- [-] have to hardcode command line options, e.g. terminator uses "-x"
rather than "-e"
- considering $TERMINAL is already used in a different fashion by
mimeopen (and mimeopen is used as fallback by xdg-open), I'd rather tend
towards a different name for the variable, e.g. $TERMCMD which would be
upward compatible to how its used by terminator
concerning 1 b)
- [+] no need to hardcode command line options
- [+] compatible with existing mimeopen behaviour
- [-] contains more than just a executable name, may be less simple to
analyze
concerning 2)
- [+] easy out without much coding for xdg-open
- [-] doesn't really solve the problem that "everyone uses their own
mechanism"
- [-] I didn't look at gvfs-open/kde-open so far, but I'm afraid, they
don't allow the user to specify their preferred terminal as easily
- [-] seems like a heavy dependency
concerning 3)
- [+] uses an established config format
- [+] can configure multiple terminals with correct command line
options and the default
- [-] not sure if the mimetype concept applies to this problem very well
- [-] maybe too complex for such a simple goal
Jerome Leclanche
2015-10-20 11:21:11 UTC
Permalink
This is something I tried solving quite a few times. There was an
intents spec (a la android) in the works which was subsequently picked
up by GNOME, I don't know where it's at now but it's the more correct
fix.
Post by Thomas Gläßle
Post by Thomas Gläßle
1 a) invent a new variable e.g. $TERMINAL or similar that works like
$BROWSER, i.e. something of the form TERMINAL=urxvt:gnome-terminal:xterm
1 b) invent a new variable e.g. $TERMINAL or similar that works like the
one used by mimeopen, i.e. TERMINAL="xterm -e"
2) encourage the use of (and possibly semi-mandatory dependency on)
gvfs-open/kde-open
3). invent a mimetype for terminal applications so available terminals
can be iterated via .desktop files and a default can be requested in the
4) use the binary x-terminal-emulator which is to be symlinked to
whatever terminal one wants to use.
- [+] nice and simple
- [+] possibly already supported by several subsystems?
- [-] system-wide config (you have to modify PATH in order to change
it for users)
Post by Thomas Gläßle
concerning 1 a)
- [+] nice and simple
- [-] have to hardcode command line options, e.g. terminator uses "-x"
rather than "-e"
- considering $TERMINAL is already used in a different fashion by
mimeopen (and mimeopen is used as fallback by xdg-open), I'd rather tend
towards a different name for the variable, e.g. $TERMCMD which would be
upward compatible to how its used by terminator
concerning 1 b)
- [+] no need to hardcode command line options
- [+] compatible with existing mimeopen behaviour
- [-] contains more than just a executable name, may be less simple to
analyze
concerning 2)
- [+] easy out without much coding for xdg-open
- [-] doesn't really solve the problem that "everyone uses their own
mechanism"
- [-] I didn't look at gvfs-open/kde-open so far, but I'm afraid, they
don't allow the user to specify their preferred terminal as easily
- [-] seems like a heavy dependency
concerning 3)
- [+] uses an established config format
- [+] can configure multiple terminals with correct command line
options and the default
- [-] not sure if the mimetype concept applies to this problem very well
- [-] maybe too complex for such a simple goal
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
Vladimir Kudrya
2015-10-20 12:57:31 UTC
Permalink
x-terminal-emulator is used in Debian as a part of 'alternatives'
symlink system. And IMHO it works pretty well.

Option 3 looks more promising though, because it can solve the problem
of different exec arguments for different terminals and can be
overridden on user-level. But yes, mime type is not a correct mechanism
in this case. Some changes to desktop entry spec may be needed.

Dependencies on DE-specific tools are bad.
Post by Jerome Leclanche
This is something I tried solving quite a few times. There was an
intents spec (a la android) in the works which was subsequently picked
up by GNOME, I don't know where it's at now but it's the more correct
fix.
Post by Thomas Gläßle
Post by Thomas Gläßle
1 a) invent a new variable e.g. $TERMINAL or similar that works like
$BROWSER, i.e. something of the form TERMINAL=urxvt:gnome-terminal:xterm
1 b) invent a new variable e.g. $TERMINAL or similar that works like the
one used by mimeopen, i.e. TERMINAL="xterm -e"
2) encourage the use of (and possibly semi-mandatory dependency on)
gvfs-open/kde-open
3). invent a mimetype for terminal applications so available terminals
can be iterated via .desktop files and a default can be requested in the
4) use the binary x-terminal-emulator which is to be symlinked to
whatever terminal one wants to use.
- [+] nice and simple
- [+] possibly already supported by several subsystems?
- [-] system-wide config (you have to modify PATH in order to change
it for users)
Post by Thomas Gläßle
concerning 1 a)
- [+] nice and simple
- [-] have to hardcode command line options, e.g. terminator uses "-x"
rather than "-e"
- considering $TERMINAL is already used in a different fashion by
mimeopen (and mimeopen is used as fallback by xdg-open), I'd rather tend
towards a different name for the variable, e.g. $TERMCMD which would be
upward compatible to how its used by terminator
concerning 1 b)
- [+] no need to hardcode command line options
- [+] compatible with existing mimeopen behaviour
- [-] contains more than just a executable name, may be less simple to
analyze
concerning 2)
- [+] easy out without much coding for xdg-open
- [-] doesn't really solve the problem that "everyone uses their own
mechanism"
- [-] I didn't look at gvfs-open/kde-open so far, but I'm afraid, they
don't allow the user to specify their preferred terminal as easily
- [-] seems like a heavy dependency
concerning 3)
- [+] uses an established config format
- [+] can configure multiple terminals with correct command line
options and the default
- [-] not sure if the mimetype concept applies to this problem very well
- [-] maybe too complex for such a simple goal
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
Thomas Gläßle
2015-10-20 13:44:32 UTC
Permalink
Post by Jerome Leclanche
This is something I tried solving quite a few times. There was an
intents spec (a la android) in the works
I assume you are referring tot (sorry, I didn't do my homework earlier):

http://lists.freedesktop.org/archives/xdg/2014-January/013068.html

I didn't have time to read the whole thread so far, I'll have to go
through it in more depth tonight.
Post by Jerome Leclanche
which was subsequently picked
up by GNOME, I don't know where it's at now but it's the more correct
fix.
All I was able to find In terms of actual implementation for gnome was a
section in the glib sources using a hardcoded list of terminals:

https://git.gnome.org/browse/glib/tree/gio/gdesktopappinfo.c#n2434

(but I admit, I didn't look too long, so I'm not entirely sure that's
the code being used for gvfs-open)
Per Olofsson
2015-10-20 12:57:25 UTC
Permalink
Hi,
Post by Thomas Gläßle
- xdg-open does not know how to spawn terminals (leading to the
application aborting or even worse: suppressed output)
Only in generic mode. When running under a desktop environment xdg-open
calls e.g. gvfs-open, kde-open5, exo-open. In that case it is their
responsibility to open a terminal window.
Post by Thomas Gläßle
- not sure what desktop environments are doing in their code base, maybe
hardcoding their own terminals
Many use gsettings or config files.

Apparently GNOME removed the UI for choosing terminal so you have to use
the gsettings command to change it.
Post by Thomas Gläßle
- xdg-terminal (unreleased, part of xdg-utils) currently even looks at
$TERM and uses xterm as hardcoded fallback
Again, only in generic mode.
Post by Thomas Gläßle
1 a) invent a new variable e.g. $TERMINAL or similar that works like
$BROWSER, i.e. something of the form TERMINAL=urxvt:gnome-terminal:xterm
Again, the variable would be mostly for generic mode, not DEs.
Post by Thomas Gläßle
3). invent a mimetype for terminal applications so available terminals
can be iterated via .desktop files and a default can be requested in the
[Desktop Entry]
name=terminator
GenericName=X Terminal Emulator
Exec=terminator -x %F
MimeType=x-terminal-emulator
I was sceptical at first but now I think it might be a good idea,
although strictly speaking it is an abuse of MIME types. It is similar
to how URIs are handled, with x-scheme-handler/<scheme>.

The Exec field would need to be specified differently though. %F is
defined as a list of files, not a command.

Also it needs to be implemented in desktop environments. There's no
point in only implementing it in xdg-open/xdg-terminal.
Post by Thomas Gläßle
concerning 1 a)
- [+] nice and simple
- [-] have to hardcode command line options, e.g. terminator uses "-x"
rather than "-e"
There's nothing stopping you from using commands with arguments. It
works in $BROWSER and $MAILER.
--
Pelle
Bastien Nocera
2015-10-20 13:10:24 UTC
Permalink
On Tue, 2015-10-20 at 14:57 +0200, Per Olofsson wrote:
<snip>
Post by Per Olofsson
Post by Thomas Gläßle
- not sure what desktop environments are doing in their code base, maybe
hardcoding their own terminals
Many use gsettings or config files.
Apparently GNOME removed the UI for choosing terminal so you have to use
the gsettings command to change it.
No, it doesn't have anything to change it because nobody who might care
has made the changes:
https://bugzilla.gnome.org/show_bug.cgi?id=627943

<snip>
Post by Per Olofsson
Post by Thomas Gläßle
3). invent a mimetype for terminal applications so available
terminals
can be iterated via .desktop files and a default can be requested in the
     [Desktop Entry]
     name=terminator
     GenericName=X Terminal Emulator
     Exec=terminator -x %F
     MimeType=x-terminal-emulator
I was sceptical at first but now I think it might be a good idea,
although strictly speaking it is an abuse of MIME types. It is
similar
to how URIs are handled, with x-scheme-handler/<scheme>.
Not really. See the bug above.
Per Olofsson
2015-10-21 17:30:29 UTC
Permalink
Post by Bastien Nocera
Post by Per Olofsson
Apparently GNOME removed the UI for choosing terminal so you have to use
the gsettings command to change it.
No, it doesn't have anything to change it because nobody who might care
https://bugzilla.gnome.org/show_bug.cgi?id=627943
I believe GNOME 2 had a UI for choosing the terminal emulator. But I
guess the settings UI was completely rewritten in GNOME 3. Sorry.
Post by Bastien Nocera
Post by Per Olofsson
I was sceptical at first but now I think it might be a good idea,
although strictly speaking it is an abuse of MIME types. It is similar
to how URIs are handled, with x-scheme-handler/<scheme>.
Not really. See the bug above.
I can't find any argument in the bug report for why having a MIME type
for terminals would be more wrong than x-scheme-handler. Only you
stating so :-)

But you're right, it is more of a stretch. At least x-scheme-handler is
about applications opening stuff.
--
Pelle
Vladimir Kudrya
2015-10-21 17:51:33 UTC
Permalink
Post by Per Olofsson
I can't find any argument in the bug report for why having a MIME type
for terminals would be more wrong than x-scheme-handler. Only you
stating so :-)
But you're right, it is more of a stretch. At least x-scheme-handler is
about applications opening stuff.
MIME types describe files which are to be opened by applications.
Schemes describe URLs to be opened by applications.
Although terminals are applications themselves, in the context of
opening file/URL with some chosen application they are merely a method
of launching that application. So, neither MIME type nor scheme fits here.

On my Debian testing available xsessions are described for display
managers by desktop entries in the '/usr/share/xsessions/' dir. Maybe
something similar could be used for terminals: put desktop entries
describing terminals into '/usr/share/x-terminal-emulators/' or something.
Bastien Nocera
2015-11-03 13:47:04 UTC
Permalink
Post by Per Olofsson
Post by Bastien Nocera
Post by Per Olofsson
Apparently GNOME removed the UI for choosing terminal so you have
to
use
the gsettings command to change it.
No, it doesn't have anything to change it because nobody who might care
https://bugzilla.gnome.org/show_bug.cgi?id=627943
I believe GNOME 2 had a UI for choosing the terminal emulator. But I
guess the settings UI was completely rewritten in GNOME 3. Sorry.
Post by Bastien Nocera
Post by Per Olofsson
I was sceptical at first but now I think it might be a good idea,
although strictly speaking it is an abuse of MIME types. It is similar
to how URIs are handled, with x-scheme-handler/<scheme>.
Not really. See the bug above.
I can't find any argument in the bug report for why having a MIME type
for terminals would be more wrong than x-scheme-handler. Only you
stating so :-)
Both mime-type and scheme are metadata to the URL. I'd be fine having a
"x-scheme-handler/terminal" mime-type added if they could all handle
those URLs. They can't though.
Post by Per Olofsson
But you're right, it is more of a stretch. At least x-scheme-handler is
about applications opening stuff.
Vladimir Kudrya
2017-05-25 15:21:33 UTC
Permalink
_______________________________________________
xdg mailing list
***@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/xdg
Vladimir Kudrya
2017-07-25 18:00:50 UTC
Permalink
_______________________________________________
xdg mailing list
***@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/xdg

Loading...