Bug 415321

Summary: Autspawning terminal
Product: [Frameworks and Libraries] frameworks-kcoreaddons Reporter: Lach Sławomir <slawek>
Component: generalAssignee: Michael Pyne <mpyne>
Status: RESOLVED NOT A BUG    
Severity: wishlist CC: kdelibs-bugs-null
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: https://forum.kde.org/viewtopic.php?f=83&t=163751&sid=023b1d9adc315086d1d1219a25605ee8
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Lach Sławomir 2019-12-18 16:07:20 UTC
SUMMARY
There's a way to make people happier, especially Free Software beginners/newbies.
Currently there's no well-known solution to spawning terminal, when needed, nor standard way to do such. Of course, program could implement my simple solution by itself, but my solution delivers some features, like selecting one of three mode (disabled/run in background, autoselecting term, user selection terminal emulator) and could been extent in future. By delivers standard way to doing simple task, we achieve one thing: possibility to extend as many application as we can, of course in case, when this extension doesn't breaks anything.

Problem is: user may download installer from software store placed on interned. He/She could also download drivers from manufacturer. Maybe you laugh, but it's hard to run shell script or console program in terminal emulator for beginners.

Implementing this is nice feature, because (it's only one reason) Qt doesn't deliver way to check initialize of libraries went good. Gtk+ allows to call gtk_init_check and fallback to console if we aren't working in GUI, but Qt will exit from program.

STEPS TO REPRODUCE
1. Download executable/shell script from net (for example printer drivers)
2. Set executable rights by properties dialog
3. Tries to run this program by click on it's icon

OBSERVED RESULT
Nothing happens.

EXPECTED RESULT
Terminal emulator will spawn.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: 
Entire Linux market!

ADDITIONAL INFORMATION
It's my solution. It checks, if there's terminal working and if user set special env variables. Depending on these conditions, we decide to spawn or not terminal emulator. User may choose action and terminal to spawn.
Comment 1 Lach Sławomir 2019-12-25 14:34:54 UTC
I forgot to add links:
https://forum.kde.org/viewtopic.php?f=83&t=163751
https://sourceforge.net/projects/cli2gui/
Comment 2 Christoph Feck 2020-01-09 10:40:15 UTC
There is a 'Run in Terminal' option for .desktop files. If users are expected to launch scripts outside of a terminal, they should provide such a desktop file.
Comment 3 Lach Sławomir 2020-01-09 14:31:45 UTC
What about shell scripts/text-based installers. Problems is user can download text installers (why software vendors should select between GUI and CLI or order user to known, which installer to download? Qt doesn't provide GTK+ check_init functionality), which isn't prepared to run in GUI. Software vendors could prefer console mode, because it's always available - GUI could been disabled (in servers, for example).
Of course, software vendors could provide solution by they own, but not better to deliver standard way.
cli2gui-exec is program, which exec using parameters given in command line. This tool will spawn console, if needed.
If cli2gui-exec tool will be accessible for software vendors, then script could have interpreter set like that:
#!/usr/bin/env cli2gui-exec /bin/bash
And that's all.