1

Is there a way to hide terminal when a bash script for zenity is executed

eg:

szAnswer=$(zenity --entry --text "where are you?" --entry-text "at home"); echo $szAnswer

I want to hide the terminal and only gui-zenity should be visible while executing by double click

1 Answers1

5

To launch a script without the terminal visible, use a .desktop file.

  1. Create a file zen.desktop
  2. Put in the contents of the file using gedit or you favorite text editor(terminal=false will make sure it doesn't show the terminal, although this option should default):

    [Desktop Entry]
    Type=Application
    Terminal=false
    Name=zenity-app
    Exec=/home/user/zen.sh
    

    Replace Exec with where your script is located.

  3. Make sure to set the permission to execute on the .desktop file (and your script) - How to make a file (e.g. a .sh script) executable, so it can be run from terminal
  4. Double click the desktop file and see if it works.
Mateo
  • 8,104
  • 1
    Great stuff. Here's the link to the file-format spec. for .desktop files: https://standards.freedesktop.org/desktop-entry-spec/latest/ – mklement0 Nov 01 '18 at 16:08