Score:0

Two terminal windows open up when I start my Ubuntu app with GNOME

vg flag

I have created a simple terminal application and want to use a simple desktop icon in Ubuntu with GNOME. Currently I have created a .desktop file with the following content:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=My App
Icon=/opt/my-app/icon.png
Path=/opt/my-app
Exec=x-terminal-emulator --title "My App" -e "bash -c '/opt/my-app/MyApp;$SHELL'"
StartupNotify=false
X-UnityGenerated=true
Terminal=true
Categories=Utility

So far, this has worked well for me. I've created this simple shell script to put it in place:

APP_NAME=my-app
APP_BINARY=MyApp
APP_INSTALLATION_PATH=/opt/$APP_NAME

# create app dir
echo "Creating application directory..."
sudo mkdir -p $APP_INSTALLATION_PATH

# place icon and binary
echo "Placing icon in application directory..."
sudo cp resources/icon.png $APP_INSTALLATION_PATH/icon.png

echo "Setting permission for ${APP_INSTALLATION_PATH}/icon.png..."
sudo chmod 644 $APP_INSTALLATION_PATH/icon.png

echo "Placing binary in application directory..."
sudo cp build/MyApp $APP_INSTALLATION_PATH/$APP_BINARY

echo "Setting executable permission for ${APP_BINARY}..."
sudo chmod +x $APP_INSTALLATION_PATH/$APP_BINARY

echo "Placing desktop icon..."
cp resources/$APP_NAME.desktop $HOME/.local/share/applications/$APP_NAME.desktop

echo "Setting executable permission for ${APP_NAME}.desktop..."
chmod +x $HOME/.local/share/applications/$APP_NAME.desktop

echo "${APP_BINARY} is now installed..."

So what's the problem then? The problem is when I start the application it opens two terminal windows. And both terminals are open in the "regular" terminal icon with two more "dots".

What I simply want is to make my icon have one "dot" appearing there, also that the terminal window shows the title of the app as well. This does not work currently.

Any ideas how I can solve this?

vanadium avatar
cn flag
What is the purpose of the `X-UnityGenerated=true` statement in the `.desktop` file you created?
zwets avatar
us flag
Have you tried without `Terminal=true`? I have no clue about .desktop files but I would guess this tells gnome to start a terminal, and then you start another one with `exec=x-terminal-emulator`.
Marcus Cvjeticanin avatar
vg flag
@zwets Terminal=false gives just one terminal which is what I want. That helped. But it still a "dot" under the regular terminal icon. I want to display the "dot" under the actual icon that is used to start the application.
zwets avatar
us flag
Your .desktop file is starting the application `x-terminal-emulator` so where else could Gnome put the dot?
Marcus Cvjeticanin avatar
vg flag
@zwets Yes, that's currently my implementation. So how can I change this, if it's possible at all? How are other apps doing it?
zwets avatar
us flag
What other apps? There may be ones, but I don't know of any that run in gnome-terminal, and are started by a button. Have you tried setting `Terminal=true` and _not_ starting another `x-terminal-emulator`, i.e. execute the application (or in your case: bash script) directly? The `Terminal=true` directive may well be Gnome's way to assign a terminal to the application. You may want to look up documentation for how .desktop files work in Gnome.
I sit in a Tesla and translated this thread with Ai:

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.