|
Dimensione: 10542
Commento:
|
Dimensione: 7927
Commento: sistemato paragrafo Creare un file .desktop
|
| Le cancellazioni sono segnalate in questo modo. | Le aggiunte sono segnalate in questo modo. |
| Linea 1: | Linea 1: |
| ## page was renamed from AmbienteGrafico/UnityLauncher | |
| Linea 7: | Linea 8: |
| ||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;"><<BR>><<TableOfContents(2)>>|| | |
| Linea 9: | Linea 9: |
| I launcher della dash di Unity sono file presenti nel computer, con l'estensione `.desktop`. Nelle versioni di '''Ubuntu''' precedenti a '''Unity''', questi file venivano utilizzati solo per creare un collegamento al programma, ma ora possono fornire anche un menu, accessibile cliccando col tasto destro del mouse sul launcher. |
I Launcher della '''Dash''' di '''Unity''' sono file presenti nel computer con estensione `.desktop`. Nelle versioni di '''Ubuntu''' precedenti a '''Unity''', questi file venivano utilizzati solo per creare un collegamento al programma, ma ora possono fornire anche un menu, accessibile facendo clic destro con il mouse sul '''Launcher'''. ##= Creare un file .desktop = ##Attualmente, ci sono due modi per creare un file `.desktop`: ## * utilizzando un [[Ufficio/EditorDiTesto|edior di testo]], ## * installando [[apt://allacarte|alacarte]]. ##La creazione del file `.desktop` con l'[[Ufficio/EditorDiTesto|edior di testo]] potrebbe risultare più ##complessa, ma permette una maggiore personalizzazione. ##= Utilizzare l'editor di testo = |
| Linea 14: | Linea 23: |
| Attualmente, ci sono due modi per creare un file `.desktop`: * utilizzando un [[Ufficio/EditorDiTesto|edior di testo]] * installando [[apt://gnome-panel|alacarte]] Creare il file `.desktop` con l'[[Ufficio/EditorDiTesto|edior di testo]] potrebbe risultare più complesso, ma permette una maggiore personalizzazione. == Utilizzare l'editor di testo == Per creare un semplice launcher, è sufficiente aprire un [[Ufficio/EditorDiTesto|edior di testo]] e incollare: {{{ |
Per creare un semplice launcher, aprire un [[Ufficio/EditorDiTesto|edior di testo]] e incollare quanto segue: {{{ |
| Linea 26: | Linea 26: |
| Name=ProgramName Comment=This is my comment Exec=/home/alex/Documents/exec.sh Icon=/home/alex/Pictures/icon.png |
Name=NomeProgramma Comment=Questo è un commento Exec=/home/utente/Documenti/exec.sh Icon=/home/utente/Immagine/icona.png |
| Linea 35: | Linea 35: |
| Il parametro: * '''Version''' è la versione del programma cui il launcher punta; |
I parametri indicati utilizzati hanno il seguente significato: |
| Linea 38: | Linea 37: |
| * '''Name''' è il nome dell'applicazione che verrà visualizzato; | ||<tablestyle="width:100%" : 15% style="background-color:#FB8B00;">'''Parametro''' ||<style="background-color:#FB8B00;":>'''Significato''' || || Version || La versione del file `.desktop`. || || Name ||Il nome dell'applicazione. Per esempio, ''VLC media player''. || || Comment || Un commento che descrive le funzionalità dell'applicazione. Per esempio, ''Lettore multimediale VLC''. || || Exec || E' il percorso all'eseguibile. Il percorso completo deve essere usato solo nel caso in cui non è specificato nella variabile `$PATH`. Tutti i file eseguibili presenti nella cartella `/usr/bin` sono già inclusi in questa variabile, e pertanto non è necessario specificare il loro percorso completo. Per vedere tutti i percorsi inclusi nella variabile `$PATH` aprire il [[AmministrazioneSistema/RigaDiComando|terminale]] e digitare `echo $PATH`. || || Icon || Specifica il percorso dell'icona utilizzata dal programma. Per le icone presenti nella cartella `/usr/share/pixmaps` non è necessario specificare il percorso completo, ma solo il loro nome senza l'estensione. Per esempio, se il file è `/usr/share/pixmaps/icon.png`, specificare `icon`. || || Terminal || Specifica se il programma debba essere eseguito in una finestra di [[AmministrazioneSistema/RigaDiComando|terminale]]. || || Type || Specifica la tipologia del file launcher, che può essere `Application`, `Link` o `Directory`. In questa pagina verranno trattati solo i launcher di tipo `Application`. || || Categories || Specifica la categoria in cui l'applicazione verrà inserita. Il parametro è utilizzato dalla '''Dash''' per categorizzare l'applicazione. || |
| Linea 40: | Linea 47: |
| * '''Comment''' is a phrase or two describing what this program does, like 'Plays your music and videos files'. * '''Exec''' è il percorso al file da eseguire. Il percorso completo deve essere usato solo nel caso in cui non è specificato nella cariabile `$PATH`. Si ricorda che tutti i file eseguibili presenti nella cartella `/usr/bin` sono già inclusi in questa variabile, e pertanto non è necessario specificare il loro percorso completo. Per vedere tutti i percorsi inclusi nella variabile `$PATH` aprire il [[AmministrazioneSistema/RigaDiComando|terminale]] e digitare: {{{ echo $PATH |
Infine, assicurarsi di impostare i permessi di esecuzione. al file `.desktop`: {{{ sudo chmod +x nome_file.desktop |
| Linea 48: | Linea 51: |
| * '''Icon''' field is the icon that should be used by the launcher and represents the application. All icons that are under the directory /usr/share/pixmaps don't need to have their full path specified, but '''their filename without the extension'''. For example, if the icon file is /usr/share/pixmaps/wallch.png, then the Icon field should be just 'wallch'. All other icons should have their full path specified. * '''Terminal''' field specifies whether the application should run in a terminal window or not. * '''Type''' field specifies the type of the launcher file. The type can be Application, Link or Directory, but this article covers the 'Application' type. * '''Categories''' field specifies the category of the application. It is used by the Dash so as to categorize the applications. A launcher being a 'Utility;Application;' should be under the 'Accessories' section etc. A realistic example of how a .desktop file looks like is the following: {{{ [Desktop Entry] Version=2.3 Name=BackMeUp Comment=Back up your data with one click Exec=/home/alex/Documents/backup.sh Icon=/home/alex/Pictures/backup.png Terminal=false Type=Application Categories=Utility;Application; }}} One last thing to add is that by setting executable rights to your .desktop file, it automatically takes the specified Icon and Name (specified in the corresponding fields), as it should be. Be careful though, the filename doesn't really change, it still remains 'launcher_name_here.desktop' and not 'Name_field_here', the system chooses to display it like 'Name_field_here' because it's nicer without the .desktop extension. Example .desktop file without executable permissions: |
Un file `.desktop` senza permessi di esecuzione sarà visibile nel seguente modo: |
| Linea 75: | Linea 55: |
| Same file with executable permissions: | Lo stesso file con i permessi di esecuzione: |
| Linea 77: | Linea 57: |
| {{attachment:executable.png}} | {{attachment:not_execitable.png}} |
| Linea 79: | Linea 59: |
| == Using gnome-panel/alacarte == | ##== Utilizzare Alacarte == |
| Linea 81: | Linea 61: |
| It is important to install gnome-panel using the following command, so as not to install the recommended not-needed packets along with it. So open a terminal using Ctrl+Alt+T and give the following command: {{{ sudo apt-get install --no-install-recommends gnome-panel }}} It will ask you for your login password, which you have to fill (nothing will be shown, not even asterisks (*)) and press enter. |
##Installare `gnome-panel`, digitando in una finestra di [[AmministrazioneSistema/RigaDiComando|terminale]] {{{ ##sudo apt-get install --no-install-recommends gnome-panel ##}}} |
| Linea 87: | Linea 65: |
| Without closing the terminal window, after the installation process is over, you have to type the following command: {{{ gnome-desktop-item-edit ~/Desktop/ --create-new }}} where '~/Desktop/' is any directory you want your launcher to appear, after its creation process is over. After running this command, a familiar window will pop-up, which lets you fill the Name, the Command and the Comment for your launcher. Also, you can specify an icon for your launcher by clicking on the big icon of the window on the top left of it. |
##Per creare un nuovo launcher, è sufficiente digitare in un [[AmministrazioneSistema/RigaDiComando|terminale]] ##{{{ ##gnome-desktop-item-edit ~/Scrivania/ --create-new ##}}} ##dove `~/Scrivania` può essere una qualsiasi directory del pc dove si desidera che il launcher venga creato. ##Dopo l'esecuzione del comando, comparirà una finestra nella quale viene chiesto di specificare il nome, il ##commento e il comando eseguito dal launcher. |
| Linea 94: | Linea 72: |
| You can also use 'alacarte', which you can execute by searching in the Dash for 'Main Menu' and once the application launches, then you click on "New Item" on the section you want your application to be. Then a window similar to the one being shown using the gnome-panel method will be shown. | ##In alternativa, è possibile avviare '''alacarte''' |
| Linea 96: | Linea 74: |
| = Aggiungere un file .desktop alla Dash Unity = | |
| Linea 97: | Linea 76: |
| = Adding a .desktop file to the Unity Launcher = | Per aggiungere un file `.desktop` alla dash, è sufficiente copiarlo nella cartella `/usr/share/applications/` o `~/.local/share/applications/`. Nel secondo caso, il collegamento sarà visibile solo all'utente che lo ha creato. |
| Linea 99: | Linea 78: |
| In order to add your launcher to the Unity Launcher on the left, you have to place your .desktop file at /usr/share/applications/ or at ~/.local/share/applications/. After moving your file there, search for it in the Dash (Windows key -> type the name of the application) and drag en drop it to the Unity Launcher. Now your launcher (.desktop file) is locked on the Unity Launcher! |
= Modificare un launcher Unity = |
| Linea 102: | Linea 80: |
| == Modificare le sue caratteristiche principali == | |
| Linea 103: | Linea 82: |
= Editing an entry of the Unity Launcher = == Editing its main characteristics == If you've added a .desktop file to the Unity Launcher, but you don't like something on it, like its icon, or probably it doesn't execute, then you may need to edit the launcher so as to change what you don't like or to fix any errors. First of all, you have to know the exact name of the .desktop file you will need to edit, and it isn't the same with the application's name (they are usually similar, but still not the same). So as to find the exact filename of the .desktop file you are interested in, open a terminal using Ctrl+Alt+T and give the following command: {{{ |
Innanzitutto, per poter modificare una qualsiasi proprietà di un launcher (icona, collegamento, ecc.) è necessario conoscere il nome esatto del file `.desktop` (si ricorda che il nome del file non è visibile da Nautilus, in quanto per un fattore "estetico" viene visualizzato direttamente il nome del programma). Per trovare i nomi completi dei launcher presenti nel panel, difitare in una finestra di [[AmministrazioneSistema/RigaDiComando|terminale]] {{{ |
| Linea 116: | Linea 86: |
| This will output a list of all the .desktop files you already have in your launcher, from top to bottom, like this: | L'output sarà simile a: |
| Linea 120: | Linea 91: |
| So, by comparing this output to the row of the launchers in your Unity Launcher, you can easily find the name of the .desktop file. For example, if you want to edit the launcher before the last one, in this case it would be 'audacious.desktop'. Copy the name of this launcher by selecting it and giving Ctrl+Shift+C for later use. In order to edit this launcher, open a terminal using Ctrl+Alt+T and give the following: {{{ cd /usr/share/applications/ gksudo gedit [paste here what you have in your clipboard with right click->paste or Ctrl+Shift+V] }}} where 'gedit' you can use your favourite text editor. The following command will ask you for password. Type in your login password and gedit (or any other text editor) will open with the launcher file you wish to edit. To edit the launcher go to 'Using a text editor' where it says it clearly on how to create a launcher and the same applies on editing it. |
|
| Linea 131: | Linea 92: |
| == Adding shortcuts to a launcher == | == Aggiungere scorciatoie al launcher == |
| Linea 133: | Linea 94: |
| Some applications become much more usable with a right-click menu. This is an example of shortcuts, being used by the application 'Wallch': |
I launcher di molte applicazioni dispongono di un menu, visibile premendo con il tasto destro del mouse su di esso. Ciò permette di accedere direttamente ad alcune caratteristiche del progamma. |
| Linea 136: | Linea 96: |
| {{attachment:shortcuts.png}} In this example, the program 'audacious', which is a music player available in the Ubuntu Software Center, will be used as an example of adding shortcuts. After adding the main characteristics of a launcher, such as filling its 'Name' and 'Exec' fields, then you can add to it one or more shortcuts. After the 'main body' of the .desktop file, you have to specify the 'actions' you want to add in the 'Actions' field and specify each one of them below. Here's a completely working example of the application 'audacious', providing 3 shortcuts, the Play/Pause, Next and Previous. This is a simplified version of the file: |
Per aggiungere una o più scorciatoie al menu di un launcher, è sufficiente modificare con un editor di testo il file `.desktop` corrispondente all'applicazione che si desidera modificare. Quì verrà fornito un esempio di un launcher per '''audacious''', un noto riproduttore musicale. |
| Linea 162: | Linea 115: |
| Actions=PlayPause;Next;Previous | Actions=PlayPause;Next;Previous; |
| Linea 180: | Linea 133: |
| The part that has to do with the shortcuts is everything after 'Actions=' including this. Everything specified on the 'Actions' field has its own name, specified on the 'Name' field of each one. For example, action PlayPause has name Play-Pause, and thus Play-Pause will be displayed on the shortcut in the Unity Launcher once you right click the icon of 'audacious'. Clicking on a shortcut will result on the corresponding action, which means it will execute anything specified in the 'Exec' field. |
Il menù viene specificato nell'estratto riportato quì sotto: {{{ Actions=PlayPause;Next;Previous; |
| Linea 183: | Linea 137: |
| Making such shortcuts for applications is generally very easy, unless the application itself doesn't provide enough command line arguments so as to do a corresponding action you would like to. The arguments and what each one does for every application are available through their man page. For example, the arguments '-t', '-f' and '-r' of 'audacious', used on the above example were found though its manual page, using the command {{{ man audacious }}}, the arrows so as to browse the manual page and the key 'Q' so as to exit. |
[Desktop Action PlayPause] Name=Play-Pause Exec=audacious -t TargetEnvironment=Unity [Desktop Action Next] Name=Next Exec=audacious -f TargetEnvironment=Unity [Desktop Action Previous] Name=Previous Exec=audacious -r TargetEnvironment=Unity }}} Dove la voce: * '''Actions=''', dichiara il nome di una o più scorciatoie, separate da un punto e virgola; * '''Name=''', dichiara il nome che verrà poi visualizzato nel menu; * '''Exec=''', dichiara il comando che la voce del menù eseguirà; * '''TargetEnvironment''', in questo caso `Unity`. ||<tablestyle="text-align: justify; width:100%;" style="border:none;" 5%><<Immagine(Icone/Grandi/info.png,,center)>> ||<style="padding:0.5em; border:none;">Per ottenere una lista completa dei comandi disponibili per l'applicazione desiderata, è possibile utilizzare il comando '''man''' seguito dal nome dell'applicazione. || = Ulteriori risorse = [[https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles|Documento originale]] ---- CaterogyGrafica |
Problemi in questa pagina? Segnalali in questa discussione
Introduzione
I Launcher della Dash di Unity sono file presenti nel computer con estensione .desktop. Nelle versioni di Ubuntu precedenti a Unity, questi file venivano utilizzati solo per creare un collegamento al programma, ma ora possono fornire anche un menu, accessibile facendo clic destro con il mouse sul Launcher.
Creare un file .desktop
Per creare un semplice launcher, aprire un edior di testo e incollare quanto segue:
[Desktop Entry] Version=1.6 Name=NomeProgramma Comment=Questo è un commento Exec=/home/utente/Documenti/exec.sh Icon=/home/utente/Immagine/icona.png Terminal=false Type=Application Categories=Utility;Application;
I parametri indicati utilizzati hanno il seguente significato:
Parametro |
Significato |
Version |
La versione del file .desktop. |
Name |
Il nome dell'applicazione. Per esempio, VLC media player. |
Comment |
Un commento che descrive le funzionalità dell'applicazione. Per esempio, Lettore multimediale VLC. |
Exec |
E' il percorso all'eseguibile. Il percorso completo deve essere usato solo nel caso in cui non è specificato nella variabile $PATH. Tutti i file eseguibili presenti nella cartella /usr/bin sono già inclusi in questa variabile, e pertanto non è necessario specificare il loro percorso completo. Per vedere tutti i percorsi inclusi nella variabile $PATH aprire il terminale e digitare echo $PATH. |
Icon |
Specifica il percorso dell'icona utilizzata dal programma. Per le icone presenti nella cartella /usr/share/pixmaps non è necessario specificare il percorso completo, ma solo il loro nome senza l'estensione. Per esempio, se il file è /usr/share/pixmaps/icon.png, specificare icon. |
Terminal |
Specifica se il programma debba essere eseguito in una finestra di terminale. |
Type |
Specifica la tipologia del file launcher, che può essere Application, Link o Directory. In questa pagina verranno trattati solo i launcher di tipo Application. |
Categories |
Specifica la categoria in cui l'applicazione verrà inserita. Il parametro è utilizzato dalla Dash per categorizzare l'applicazione. |
Infine, assicurarsi di impostare i permessi di esecuzione. al file .desktop:
sudo chmod +x nome_file.desktop
Un file .desktop senza permessi di esecuzione sarà visibile nel seguente modo:
Lo stesso file con i permessi di esecuzione:
Aggiungere un file .desktop alla Dash Unity
Per aggiungere un file .desktop alla dash, è sufficiente copiarlo nella cartella /usr/share/applications/ o ~/.local/share/applications/. Nel secondo caso, il collegamento sarà visibile solo all'utente che lo ha creato.
Modificare un launcher Unity
Modificare le sue caratteristiche principali
Innanzitutto, per poter modificare una qualsiasi proprietà di un launcher (icona, collegamento, ecc.) è necessario conoscere il nome esatto del file .desktop (si ricorda che il nome del file non è visibile da Nautilus, in quanto per un fattore "estetico" viene visualizzato direttamente il nome del programma). Per trovare i nomi completi dei launcher presenti nel panel, difitare in una finestra di terminale
gsettings get com.canonical.Unity.Launcher favorites
L'output sarà simile a:
['nautilus-home.desktop', 'firefox.desktop', 'filezilla.desktop', 'ubuntu-software-center.desktop', 'qtcreator.desktop', 'ubuntuone-installer.desktop', 'wallch.desktop', 'gnome-terminal.desktop', 'gedit.desktop', 'audacious.desktop', 'gnome-control-center.desktop']
Aggiungere scorciatoie al launcher
I launcher di molte applicazioni dispongono di un menu, visibile premendo con il tasto destro del mouse su di esso. Ciò permette di accedere direttamente ad alcune caratteristiche del progamma.
Per aggiungere una o più scorciatoie al menu di un launcher, è sufficiente modificare con un editor di testo il file .desktop corrispondente all'applicazione che si desidera modificare. Quì verrà fornito un esempio di un launcher per audacious, un noto riproduttore musicale.
[Desktop Entry] Version=1.0 Type=Application Name=Audacious GenericName=Music Player Comment=Listen to music Icon=audacious Categories=AudioVideo;Audio;Player;GTK; Exec=audacious %U TryExec=audacious Terminal=false MimeType=application/ogg;application/x-cue;application/x-ogg;application/xspf+xml;audio/midi;audio/mp3;audio/mpeg;audio/mpegurl;audio/ogg;audio/prs.sid;audio/x-flac;audio/x-it;audio/x-mod;audio/x-mp3;audio/x-mpeg;audio/x-mpegurl;audio/x-ms-wma;audio/x-musepack;audio/x-s3m;audio/x-scpls;audio/x-stm;audio/x-vorbis+ogg;audio/x-wav;audio/x-xm;x-content/audio-cdda; Actions=PlayPause;Next;Previous; [Desktop Action PlayPause] Name=Play-Pause Exec=audacious -t TargetEnvironment=Unity [Desktop Action Next] Name=Next Exec=audacious -f TargetEnvironment=Unity [Desktop Action Previous] Name=Previous Exec=audacious -r TargetEnvironment=Unity
Il menù viene specificato nell'estratto riportato quì sotto:
Actions=PlayPause;Next;Previous; [Desktop Action PlayPause] Name=Play-Pause Exec=audacious -t TargetEnvironment=Unity [Desktop Action Next] Name=Next Exec=audacious -f TargetEnvironment=Unity [Desktop Action Previous] Name=Previous Exec=audacious -r TargetEnvironment=Unity
Dove la voce:
Actions=, dichiara il nome di una o più scorciatoie, separate da un punto e virgola;
Name=, dichiara il nome che verrà poi visualizzato nel menu;
Exec=, dichiara il comando che la voce del menù eseguirà;
TargetEnvironment, in questo caso Unity.
Per ottenere una lista completa dei comandi disponibili per l'applicazione desiderata, è possibile utilizzare il comando man seguito dal nome dell'applicazione. |
