Starting a script in a Desktop icon
Solution 1
you can try this way:
[Desktop Entry]
Version=1.0
Type=Application
Hidden=false
NoDisplay=false
Terminal=false
Encoding=UTF-8
Exec=xfce4-terminal -x /usr/local/robomongo-0.8.4-i386/bin/robomongo.sh
Icon=/usr/local/robomongo-0.8.4-i386/share/icons/robomongo.png
Name=Robomongo
Comment=Launch Robomongo
and give the read permission with sudo chmod +x /usr/local/robomongo-0.8.4-i386/share/icons/robomongo.png && /usr/local/robomongo-0.8.4-i386/bin/robomongo.sh
.
The diference is that I execute the terminal with option -x:
"−x, −−execute; −e, −−command=comanda; −−working−directory=directori;"
And I added
Hidden=false
NoDisplay=false
Terminal=false
I have a script in gnome desktop and lxde desktop running with those so I hope it work for you too, but in gnome I use:
Exec=gnome-terminal -x sudo /usr/local/bin/donacion.sh
And for lxde or lubuntu:
Exec=lxterminal -e sudo /usr/local/bin/donacion.sh
Tell me if it worked, thx.
Solution 2
I tried the same desktop file definition and it works as expected for me. So double check that the launcher script has the right permissions:
chmod u+x /usr/local/robomongo-0.8.4-i386/bin/robomongo.sh
Alternatively you may try the following Exec
command:
Exec=bash /usr/local/robomongo-0.8.4-i386/bin/robomongo.sh
Related videos on Youtube
user994165
Updated on September 18, 2022Comments
-
user994165 over 1 year
I have the following .desktop file on my Desktop:
[Desktop Entry] Encoding=UTF-8 Name=Robomongo Comment=Launch Robomongo Exec=/usr/local/robomongo-0.8.4-i386/bin/robomongo.sh Icon=/usr/local/robomongo-0.8.4-i386/share/icons/robomongo.png Type=Application Terminal=true
I want the application to start up with a terminal window. When I click it it opens a terminal window but doesn't acatually run the script. How can I set that up? If I make "Terminal=false", then it starts the program with no terminal window. I also tried creating a link, but don't get a terminal window.
I'm also having a problem with this icon. It keeps giving me a "Invalid desktop entry file: '/home/dev/Desktop/mongod-port-27007.desktop" error. mongod works from the shell.
[Desktop Entry] Encoding=UTF-8 Name=mongod-port-27007 Comment=Launch Robomongo Exec=mongod Icon=/usr/local/robomongo-0.8.4-i386/share/icons/robomongo.png Type=Application Terminal=false
-
user994165 over 9 yearsAdding +x made the script work. But it doesn't work for compiled commands like "mongod". Also, for the first one, when I switch to Terminal=true, I get a terminal come up, but the command doesn't execute.