“UbuntuHelp:HowToAddaLauncher”的版本间的差异
来自Ubuntu中文
小 |
小 |
||
第25行: | 第25行: | ||
*** Fill it something like this: | *** Fill it something like this: | ||
<pre><nowiki> | <pre><nowiki> | ||
+ | #!/bin/bash | ||
<your command> | <your command> | ||
<your command> | <your command> | ||
第41行: | 第42行: | ||
=== Examples of bash scripts === | === Examples of bash scripts === | ||
<pre><nowiki> | <pre><nowiki> | ||
+ | #/bin/bash | ||
WINEDLLOVERRIDES=\"ole32,usp10,msvcrt=n\" | WINEDLLOVERRIDES=\"ole32,usp10,msvcrt=n\" | ||
wine $HOME/.wine/drive_c/Program\ Files/Google/Google\ Earth/GoogleEarth.exe | wine $HOME/.wine/drive_c/Program\ Files/Google/Google\ Earth/GoogleEarth.exe | ||
</nowiki></pre> | </nowiki></pre> | ||
<pre><nowiki> | <pre><nowiki> | ||
+ | #!/bin/bash | ||
cd $HOME/Movietheque/ | cd $HOME/Movietheque/ | ||
$HOME/Movietheque/Movietheque.run | $HOME/Movietheque/Movietheque.run |
2007年5月24日 (四) 10:16的版本
点击翻译: |
English |
请不要直接编辑翻译本页,本页将定期与来源同步。 |
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:
#!/bin/bash <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
#/bin/bash WINEDLLOVERRIDES=\"ole32,usp10,msvcrt=n\" wine $HOME/.wine/drive_c/Program\ Files/Google/Google\ Earth/GoogleEarth.exe
#!/bin/bash cd $HOME/Movietheque/ $HOME/Movietheque/Movietheque.run