Feature request: Add -e option to choose program run in foot window #625

Closed
opened 5 months ago by lunik1 · 4 comments
lunik1 commented 5 months ago

xterm has an -e option that allows the user to change the program run in the terminal window, from the manual:

-e program [ arguments ... ]

This option specifies the program (and its command line arguments) to be run in the xterm window. It also sets the window title and icon name to be the basename of the program being executed if neither -T nor -n are given on the command line.

NOTE: This must be the last option on the command line.

This option is implemented by most other terminal emulators too and it would be nice to see the same functionality in foot.

My specific use case is j4-dmenu-desktop which uses the -e option to launch programs in the terminal passed by the --term option.

`xterm` has an `-e` option that allows the user to change the program run in the terminal window, from [the manual](https://man.cx/xterm): > -e program [ arguments ... ] > > This option specifies the program (and its command line arguments) to be run in the xterm window. It also sets the window title and icon name to be the basename of the program being executed if neither -T nor -n are given on the command line. > > NOTE: This must be the last option on the command line. This option is implemented by [most](https://man.cx/urxvt) [other](https://man.cx/konsole(1)) [terminal](https://man.cx/mlterm) [emulators](https://man.archlinux.org/man/alacritty.1.en) [too](https://man.cx/cool-retro-term) and it would be nice to see the same functionality in `foot`. My specific use case is `j4-dmenu-desktop` which uses the `-e` option to launch programs in the terminal passed by the `--term` option.
Collaborator

See #184 and https://github.com/ranger/ranger/issues/1108#issuecomment-372113294.

The biggest problem with -e isn't that some terminals don't support it, it's that even the ones that do support it aren't compatible with each other.

Some programs have started using $TERMCMD (or $TERMINAL) as a way to specify how to start a command in the user's preferred terminal.

I think a better thing to do in this case would be to petition the j4-dmenu developers to support something like $TERMCMD and in the meantime use a wrapper script like e.g. this. Blindly using -e with an arbitrary terminal is pretty much broken and is never going to be completely portable.

There seems to be a semi-related PR already open on the j4-dmenu-desktop repo.

Other duplicate issues:

See #184 and https://github.com/ranger/ranger/issues/1108#issuecomment-372113294. The biggest problem with `-e` isn't that some terminals don't support it, it's that even the ones that do support it aren't compatible with each other. Some programs have started using `$TERMCMD` (or `$TERMINAL`) as a way to specify how to start a command in the user's preferred terminal. I think a better thing to do in this case would be to petition the j4-dmenu developers to support something like `$TERMCMD` and in the meantime use a wrapper script like e.g. [this](https://codeberg.org/dnkl/foot/issues/184#issuecomment-175695). Blindly using `-e` with an arbitrary terminal is pretty much broken and is never going to be completely portable. There seems to be a semi-related [PR](https://github.com/enkore/j4-dmenu-desktop/pull/119) already open on the j4-dmenu-desktop repo. Other duplicate issues: * #257 * #313 * #596
dnkl closed this issue 5 months ago
dnkl added the
duplicate
label 5 months ago
Poster

Do you know which programs support TERMCMD? I would be interested in adding support to j4-menu-desktop and it would be useful to have some prior art to justify its inclusion.

Do you know which programs support TERMCMD? I would be interested in adding support to j4-menu-desktop and it would be useful to have some prior art to justify its inclusion.
Collaborator

Do you know which programs support TERMCMD?

I only know of ranger and sxmo.

I'm having second thoughts about recommending the use of $TERMCMD though. I just looked at the ranger docs and it seems to suggest that $TERMCMD is just for specifying the user's preferred terminal and they still blindly pass -e to it. I guess I didn't notice this because I use a wrapper script that strips the -e flag.

I'm starting to think maybe it would be a good idea for foot to just parse -e as a no-op. I don't think there's any point in reserving it for other purposes, since far too many apps already make assumptions about its meaning. This still wouldn't solve the problem in general, but it'd make foot compatible with a few more launchers and any future questions about foot -e could then be directed to the man page.

The existing PR on the j4-dmenu-desktop repo also seems like a reasonable solution, although there hasn't been any activity there in a while.

> Do you know which programs support TERMCMD? I only know of ranger and [sxmo](https://lists.sr.ht/~mil/sxmo-devel/%3C20210604083952.26545-1-amaier42%40web.de%3E). I'm having second thoughts about recommending the use of `$TERMCMD` though. I just looked at the ranger [docs] and it seems to suggest that `$TERMCMD` is just for specifying the user's preferred terminal and they *still* blindly pass `-e` to it. I guess I didn't notice this because I use a wrapper script that strips the `-e` flag. I'm starting to think maybe it would be a good idea for foot to just parse `-e` as a no-op. I don't think there's any point in reserving it for other purposes, since far too many apps already make assumptions about its meaning. This still wouldn't solve the problem in general, but it'd make foot compatible with a few more launchers and any future questions about `foot -e` could then be directed to the man page. The existing [PR] on the j4-dmenu-desktop repo also seems like a reasonable solution, although there hasn't been any activity there in a while. [docs]: https://github.com/ranger/ranger/blob/277e1db745a817f522278487b97f1518b54d668e/doc/rifle.pod#environment [PR]: https://github.com/enkore/j4-dmenu-desktop/pull/119
Owner

I'm starting to think maybe it would be a good idea for foot to just parse -e as a no-op

Well, this has been discussed since the beginning. I guess it might be easier to just go ahead and add it, instead of having to close the same feature request again and again (no offense).

Let me put it this way; I'll probably merge a PR, should someone post it ;)

> I'm starting to think maybe it would be a good idea for foot to just parse -e as a no-op Well, this _has_ been discussed since the beginning. I guess it might be easier to just go ahead and add it, instead of having to close the same feature request again and again (no offense). Let me put it this way; I'll probably merge a PR, should someone post it ;)
dnkl referenced this issue from a commit 3 months ago
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.