Score:0

How do I open a CLI session to run an interactive program from Gnome Files browser?

vn flag

I have a simple Java program that interacts with the user in the CLI. The program runs fine from a shell script (play.sh), when the shell script is executed from the CLI.

Is there a way to rewrite the play.sh file to be able to run it from the Ubuntu Files via a double-click? I want the file to open a CLI session and then run the Java program from within that session. It would save me a small step if I could just double-click the play.sh file directly instead of first executing "Open In Terminal" and then typing ./play.sh from within a CLI session.

Text of the play.sh follows:

#!/bin/bash 

java -p ~/Projects_Java/src/FlashIntervals/compiled/ -m moduleFlashIntervals/seconditeration.CLIPrompter

Yes, the play.sh file properties include "Allow executing file as program". But the double-click appears to do nothing, probably because a CLI session is not opened by the Java program itself. The Java program simply writes to System.out.console, i.e., the CLI from where it was run. And there is nothing in the play.sh file to expose this session to the user.

This is almost certainly a duplicate question but I don't seem to be searching for an answer with the correct keywords, and can't find info on how to do this.

Score:1
in flag

Just create a *.desktop file e.g. in ~/.local/share/application/myJava.desktop with the following exemplified content:

[Desktop Entry]
Name=My Java App
Type=Application
Exec=/home/username/play.sh
Terminal=true
Icon=/home/username/pictures/play.png
Comment=Executes my Java application
NoDisplay=false
Categories=Utility
Name[de_DE]=JavaApp

So when you search for this application in GNOME's search bar you should find it and execute it. Because you have configured the desktop file with Terminal=true a terminal should be opened.

vn flag
I'm a bit confused, but part might be because I referred to Nautilus, which I now realize I'm not using. When you refer to GNOME's search bar, what are you referring to? It turns out that the utility being invoked for file folder navigation is the Files program. There is a field that opens when clicking an icon with a magnifying class. Is this the "search bar"? Can you direct me to documentation about this [Desktop Entry] functionality?
kladderradatsch avatar
in flag
The Gnome's search bar appears when you press the Super key (the windows key). The specification about the *.desktop files you'll find [here](https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.