0

This question already has an answer here:

The following command from terminal works perfectly:

sh /home/flux/Downloads/TeamSpeak3-Client-linux_amd64/ts3client_runscript.sh

How would I go about adding this as a shortcut, so I can open teamspeak from my Unity Launcher panel on the left without using the terminal?

marked as duplicate by muru, Sylvain Pineau, g_p, Eric Carvalho, Seth Sep 25 '14 at 23:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    @muru definitely a look-alike, only nothing about bash or shell there... – Jacob Vlijm Sep 24 '14 at 7:56
  • @JacobVlijm then we'd have to have question for every interpreter out there: the shells, the pythons, the perls, the phps, the bfs, the gnuplots, .... – muru Sep 24 '14 at 8:01
  • @muru I partially agree, but believe mainly the last section (bash -c) is somewhat outside the scope of the other question. – Jacob Vlijm Sep 24 '14 at 8:10
  • 1
    @muru strictly yes, but running bash commands from the launcher is a subsection of the subject that could use some attention on its own; it is a bit more than <application><option> like in firefox. In many cases, subjects on AU are subsections of each other. There is always the decision of where to allow that or not. In this case, I can live with both. – Jacob Vlijm Sep 24 '14 at 8:21
  • 1
    My apologies for the duplicate question. I did attempt to find a similar thread. Though the suggestion from your link regarding "Alacarte" was perfect - this tool helped me create the shortcut a lot easier than the manual method. Thanks! – PiedPiper Sep 25 '14 at 9:48
2

In its most basic form:

create a .desktop file (paste the text below in an empty file):

[Desktop Entry]
Name=Start Teamspeak
Exec=/bin/bash /home/flux/Downloads/TeamSpeak3-Client-linux_amd64/ts3client_runscript.sh
Icon=/path/to/your/icon
Type=Application

save the file as team.desktop in ~/.local/share/applications and drag it from there on to the launcher.

Explanation

Running scripts from a .desktop file

If you run a script in the Exec= line from a launcher like this, it works like in the terminal:

  • If the script is not executable:

    language /path/to/script.language_extension
    
  • If the script is executable, just:

    /path/to/script.sh
    

    If the script is executable, the language extension is not strictly needed. However, if you use it on the file, also use it in the command.

Running more complicated shell commands from a .desktop file

Exec=/bin/bash -c "your_complicated_command_here"
(command inside quotes)
  • Is need to use sh here Exec=sh /home/flux/Downloads/TeamSpeak3-Client-linux_amd64/ts3client_runscript.sh. sh after Exec=sh<--this – αғsнιη Sep 24 '14 at 7:19
  • @KasiyA I am afraid I don't understand what you mean? – Jacob Vlijm Sep 24 '14 at 7:19
  • 1
    @KasiyA yes, if the script is not executable the sh is needed, otherwise it won't hurt. – Jacob Vlijm Sep 24 '14 at 7:22
  • thank you I didn't know that. We can execute script by itself with adding chmod +x scriptName.sh and remove the sh behind Exec= – αғsнιη Sep 24 '14 at 7:24
  • IMHO Never use sh as the interpreter on scripts unless the script is known to be sh-compatible. Prefer bash, if the user mentions bash. – muru Sep 24 '14 at 7:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.