Open Hat-Kid opened 1 year ago
Did some more investigating on this yesterday, as I figured / originally mentioned in the overhaul PR -- this is a challenge considering there is no default terminal on linux, nor is there a default way to figure out what the user does.
on macOS there is a somewhat commonly used TERM_PROGRAM
environment variable. But this has been outright rejected by many linux/cross-platform terminal emulators, such as alacritty:
It's also irrelevant, because macOS has a default terminal emulator.
In typical linux fashion, there is no standard across distros and calling the notable solutions to this problem heuristics would be being quite generous. So it seems like the only way to properly support this will be to make the user supply the binary / arg-info into the launcher so we know what the heck to execute. Additional info on the linux side here - https://superuser.com/a/1461079
I have no graphical Linux installs to test on, but reading a few of those discussions it looks like the environment variables XDG_CURRENT_DESKTOP
or XDG_MENU_PREFIX
could be used to see if someone is probably using a desktop environment with a known default terminal emulator.
Otherwise this can be ported: https://github.com/i3/i3/blob/next/i3-sensible-terminal, which launches the first one it finds of some known terminal emulators.
Or they can be combined to just use the same list but ordered differently per guessed desktop environment.
For Linux users that don't care, this should be a good enough solution. For Linux users who do care, they can edit settings and type their preferred terminal emulator command. (Or to save on complexity of the launcher code for this very specific case, actually use $TERM_PROGRAM
or $TERM
or $TERMINAL
and tell the user to set it for their launcher use, they are obviously power users if they care that the "wrong" terminal emulator was launched.)
I think it's better to guess than to force all users to select one, even if they are linux users they might actually not know too much about the different alternatives. Of course provide some way to override the guess.
I feel like it's up to whoever takes up the challenge to implement it. Personally I wouldn't want to go the i3-sensible-terminal
route because it's a maintenance burden and you need to do more than just launch the terminal -- you have to launch it in a separate window / with the correct args, which may be different for each terminal emulator.
If I were to do the work, I would just make the user enter it in via settings because:
But yeah if someone is willing to do all the work to attempt to make it a more elegant solution and maintain it, there's no denying it would be better
There is also https://github.com/Vladimir-csp/xdg-terminal-exec
recommended by the xdg people themselves: https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/241#note_2198276
and potentially will be included as a core utility eventually if I read that comment right
Pressing the "Open REPL" button in the launcher starts the compiler in the background, unable to be used, and maxes out CPU usage.