个人工具

UbuntuHelp:HowToAddaLauncher

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月14日 (一) 11:36的版本

跳转至: 导航, 搜索

Adding a panel or desktop launcher to Ubuntu is fairly easy.

Windows users will think of these as "shortcuts"; in Gnome they're called launchers.

The Easy Way

      • First of all, see Desktop User Guide / Working With Panels / Launchers / To Add A Launcher to a Panel page in help for more complex and less straightforward info.
      • Right-click unused space in any panel.
      • Choose Add To Panel...
      • Choose Custom Application Launcher
      • Fill in Name, Generic Name and Comment at your will
      • Important field is Command - fill in a command you want to be called by a launcher
      • Choose from /usr/share/icons/crystalsvg/16x16/apps/ or elsewhere or make yourself using GIMP or any other graphic editor an icon.
      • Your launcher should just work now.

The Hard Way

      • What if this just does not work?
      • Some programs - for example some run under Wine - needs some additional commands before they can be started or some Java programs need to be started from within the directory they have their files in. Unfortunately launchers do not get bash environment so you cannot just put them in Command field
      • Insted, you need to make a bash script. Do not worry, it is simple
      • Just create a file somewhere in you $PATH, for example
sudo nano /usr/local/bin/sampleprogram
      • Fill it something like this:
<your command>
<your command>
<your command>
      • Press Control+X to save your file & exit Nano.
      • Make the file executable:
sudo chmod +x /usr/local/bin/sampleprogram
      • fill Command with /usr/local/bin/sampleprogram (or just sample program, but be sure to update tour database before that, i.e.
sudo updatedb

and it should just work now.

Examples of bash scripts

WINEDLLOVERRIDES=\"ole32,usp10,msvcrt=n\"
wine $HOME/.wine/drive_c/Program\ Files/Google/Google\ Earth/GoogleEarth.exe
cd $HOME/Movietheque/
$HOME/Movietheque/Movietheque.run