PixelGuys / Cubyz

Voxel sandbox game with a large render distance, procedurally generated content and some cool graphical effects.
GNU General Public License v3.0
420 stars 49 forks source link

Open a terminal on linux when executing the `run_linux.sh` bash file from the file explorer. #385

Closed IntegratedQuantum closed 3 months ago

IntegratedQuantum commented 3 months ago

Opening a bash file from the file explorer does not open a terminal by default. Like in #381 this can lead to some confusion when a compiler error happens.

archbirdplus commented 3 months ago

As @garrett96 mentioned, you can test for a terminal with test -t 0. If true, then we're good. But otherwise, we have several rather ugly options.

Unfortunately, the name of the terminal app is not standardized, and there may be more than one. Here's a list of common terminal applications compiled from this SO post.

For X11 -> xterm
For Kde -> konsole
For GNOME -> gnome-terminal
For xfce4 -> xfce4-terminal
For Cinnamon -> x-terminal-emulator
For MATE -> mate-terminal --window
For Unity -> gnome-terminal --profile=Default
For Pantheon -> pantheon-terminal -w ''

But we don't really know which one the user wants to open. It's possible to guess by using the most specific one, or the one they are running right now, or by trying to match $TERM or something like that. All this feature sniffing would take time and complexity and add even more confusion when it doesn't work. It also reminds me of browser sniffing on the web, so I'll leave that for someone else.

Alternatively we can just pipe everything to screen or a log file, and let the user know where to find the logs. But at that point we might as well ask that they open Cubyz in a terminal in the first place.

IntegratedQuantum commented 3 months ago

Alright, since there seems to be no simple, short-term solution I'm closing this in favor of #227, which would be the go to solution for all people who don't want to use the terminal. With #227 the logs should be displayed in the launcher.