elementary / elementary/terminal

xdg-terminal-exec support

Open
#765 3 comments 0 reactions 0 assignees View on GitHub
Status: Blocked
Dominant language
Vala
Stars
428
Forks
104
Avg merge
1d 54m
Merged PRs (30d)
2

Description

Running a command in a terminal from another app is a common usecase. Almost all terminals provide such a command execution interface (`-e`, `-x`, `--` or such). Clients can [guess](https://github.com/albertlauncher/albert/blob/6783257df7e15dcfbae49d03023414b7c3692dbd/src/app/terminalprovider.cpp#L120-L150), but they cant know it for sure. If it *can* break, it *will* break.

There is a [freedesktop spec proposal](https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/3) that tries to standardize the way we configure a default terminal for command execution. It implicitly solves the above problem. Its as simple as that: the app/package provides this info.

To support it you simply need to add `X-ExecArgs` or `ExecArgs` ([the reference implementation respects both](https://github.com/Vladimir-csp/xdg-terminal-exec/blob/af3570e1af8691416e77171e7e29a03572d541c4/xdg-terminal-exec#L387)) to the desktop file ([like this](https://github.com/GNOME/gnome-terminal/blob/f1814cb7ecfe6a5cb4f629dcea56db0dec10a242/data/org.gnome.Terminal.desktop.in#L14)) and make sure there is `TerminalEmulator` in `Categories`. It has not yet been approved (therefore the `X-`) but hey `ExecArgs` does not conflict any standard key and if it will be approved you dont have to change it again.

As an elaborative example see how GNOME terminal does it: https://github.com/GNOME/gnome-terminal/commit/f1814cb7ecfe6a5cb4f629dcea56db0dec10a242

This will help making Linux a better user experience and a less annoying developer experience.

Thank you

PS:
The draft states that the default will be `-e` and you might think "okay, done" if your ExecArg *is* `-e`. I recommend to add it anyway because then you are on the safe side if the final spec does not fall back to `-e`. I guess (hope) there will be no default.
You might also think "Why that early if it's a draft?". Correct, but if you do so, I will give you a grateful hug should we ever meet in real life because I am the maintainer of that frustrating list linked in the beginning. If you do so I can wipe your entry from the list :heart:. Also this proposal is a good thing and we should all push it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.