Unity Png File Could Not Be Read
Introduction
Contents
- Introduction
- Creating a working .desktop file
- Using a text editor
- Using gnome-panel/alacarte
- Adding a .desktop file to the Unity Launcher
- Editing an entry of the Unity Launcher
- Editing its primary characteristics
- Calculation shortcuts to a launcher
Unity Launchers are actually files stored in your computer, with a '.desktop' extension. In earlier Ubuntu versions, these files were simply used so equally to launch a specific application, but in Unity they are also used so equally to create right-click menus for each application, which y'all can access from the Unity Launcher.
This commodity describes how to create a working .desktop file for full general use, but as well how to add it to the Unity Launcher and/or how to edit a Unity Launcher itself, by editing its fields or by adding a right-click bill of fare to it.
Creating a working .desktop file
There are currently 2 ways of creating a desktop file. The 1st 1 is using a text editor, like Gedit, and the 2nd i is installing a program (gnome-console) or using 'alacarte' that both do the task for you lot. The former lets you lot "control" your launcher more than the latter, but the latter way is easier. Please note that this department will cover only the basics, non how to add shortcuts to your launcher. For this, delight head to Adding shortcuts to a launcher.
Using a text editor
Open your favourite text editor, like Gedit or nano, and blazon in (copy and paste):
[Desktop Entry] Version=x.y Proper noun=ProgramName Annotate=This is my annotate Exec=/habitation/alex/Documents/exec.sh Icon=/home/alex/Pictures/icon.png Terminal=false Type=Application Categories=Utility;Application;
These lines are plenty for describing a simple launcher. Each launcher (.desktop file) consists of some basic fields.
-
Version is the version of this .desktop file.
-
Name is the name of the application, like 'VLC media actor'.
-
Comment is a phrase or 2 describing what this program does, similar 'Plays your music and videos files'.
-
Exec is the path to the executable file. The full path to the executable file must be used but in case information technology isn't in any of the paths specified in the $PATH variable. For example, any files that are within the path /usr/bin don't demand to take their full path specified in the Exec field, simply only their filename. To come across all the paths in the $PATH variable you lot tin open a concluding using Ctrl+Alt+T and type in
repeat $PATH
-
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 demand 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 exist just 'wallch'. All other icons should take their total path specified.
-
Terminal field specifies whether the application should run in a last window or not.
-
Blazon 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 awarding. It is used past the Dash then every bit to categorize the applications. A launcher being a 'Utility;Application;' should exist under the 'Accessories' section etc.
A realistic example of how a .desktop file looks similar is the following:
[Desktop Entry] Version=1.0 Name=BackMeUp Annotate=Support your information with 1 click Exec=/home/alex/Documents/backup.sh Icon=/home/alex/Pictures/backup.png Final=false Blazon=Application Categories=Utility;Application;
One concluding affair to add is that by setting executable rights to your .desktop file, it automatically takes the specified Icon and Proper noun (specified in the respective fields), equally it should be. Be careful though, the filename doesn't really change, it yet remains 'launcher_name_here.desktop' and not 'Name_field_here', the system chooses to display information technology similar 'Name_field_here' considering it's nicer without the .desktop extension.
Example .desktop file without executable permissions:
Same file with executable permissions:
Using gnome-panel/alacarte
Information technology is of import to install gnome-console using the post-obit command, so every bit not to install the recommended not-needed packets along with it. So open a terminal using Ctrl+Alt+T and give the following control:
sudo apt-get install --no-install-recommends gnome-panel
Information technology will ask you for your login password, which y'all have to fill (zero volition exist shown, not fifty-fifty asterisks (*)) and press enter.
Without closing the terminal window, after the installation procedure is over, you take to type the post-obit command:
gnome-desktop-item-edit ~/Desktop/ --create-new
where '~/Desktop/' is any directory you lot want your launcher to announced, after its creation process is over. After running this control, a familiar window will pop-up, which lets y'all fill the Name, the Command and the Comment for your launcher. Also, you tin can specify an icon for your launcher by clicking on the large icon of the window on the top left of it.
You tin can also use 'alacarte', which you can execute by searching in the Dash for 'Main Bill of fare' and in one case the application launches, then you click on "New Particular" on the section you desire your application to be. And then a window similar to the 1 beingness shown using the gnome-panel method volition be shown.
Calculation a .desktop file to the Unity Launcher
In order to add your launcher to the Unity Launcher on the left, you select and elevate it onto the Launcher panel. Alternatively, you tin place your .desktop file at /usr/share/applications/ or at ~/.local/share/applications/. After moving your file there, search for information technology in the Nuance (Windows fundamental -> type the name of the application) and drag and drib information technology to the Unity Launcher. Now your launcher (.desktop file) is locked on the Unity Launcher! If your desktop file cannot be institute by doing a search from the Dash, you lot may need to read on...
To be more certain that your .desktop file will piece of work properly, use the desktop file validator, which will notify y'all of any errors or omissions. If there are no errors, desktop-file-validate will get out silently.
Once the file validates correctly, install it to the default location (probably /usr/share/applications) using the desktop-file-install program. This step may require superuser privileges. The desktop-file-install plan may add some lines of its own to your .desktop file. There is no need to have the .desktop file be executable by anyone.
Delight note that desktop-file-validate tends to be oversensitive at times, which means that it tin output fault letters on perfectly working .desktop files. Those error letters should be better seen as warnings rather than anything else. For more than information on desktop entry specification please refer to http://standards.freedesktop.org/desktop-entry-spec/latest/
Editing an entry of the Unity Launcher
Editing its principal 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 information technology doesn't execute, and then you may need to edit the launcher and so every bit to modify what you don't like or to set whatever errors.
First of all, you lot have to know the exact name of the .desktop file you will demand to edit, and it isn't the same with the application's name (they are commonly similar, just nonetheless not the same).
Then as to detect the exact filename of the .desktop file you are interested in, open a terminal using Ctrl+Alt+T and give the post-obit control:
gsettings become com.canonical.Unity.Launcher favorites
This will output a list of all the .desktop files you already have in your launcher, from top to lesser, like this:
['nautilus-home.desktop', 'firefox.desktop', 'filezilla.desktop', 'ubuntu-software-eye.desktop', 'qtcreator.desktop', 'ubuntuone-installer.desktop', 'wallch.desktop', 'gnome-last.desktop', 'gedit.desktop', 'audacious.desktop', 'gnome-control-center.desktop']
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 instance, 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 past selecting information technology and giving Ctrl+Shift+C for afterward utilise. At present you have in your clipboard the filename of your file, only not its path. Your file can exist either under ~/.local/share/applications/ or under /usr/share/applications/. Commonly, if you have made a desktop launcher, information technology is under ~/.local/share/applications, but any other application launcher that belongs to an application yous take installed to your computer should be under /usr/share/applications. And so, in order to edit this launcher, open up a final using Ctrl+Alt+T and give the post-obit:
cd /usr/share/applications/ gksudo gedit [paste here what you accept in your clipboard with right click->paste or Ctrl+Shift+V]
where 'gedit' y'all can employ your favourite text editor. The following command will ask you for password. Blazon in your login password and gedit (or any other text editor) will open up 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.
Adding shortcuts to a launcher
Some applications become much more usable with a correct-click card. This is an example of shortcuts, being used by the awarding 'Wallch':
In this example, the plan 'audacious', which is a music player available in the Ubuntu Software Centre, will be used as an instance of adding shortcuts.
After adding the chief characteristics of a launcher, such as filling its 'Name' and 'Exec' fields, and then you tin can add together to it one or more shortcuts.
After the 'main body' of the .desktop file, y'all have to specify the 'actions' you want to add together in the 'Actions' field and specify each one of them below. Here's a completely working instance of the application 'audacious', providing iii shortcuts, the Play/Pause, Adjacent and Previous. This is a simplified version of the file:
[Desktop Entry] Version=1.0 Type=Application Name=Adventurous GenericName=Music Player Comment=Listen to music Icon=audacious Categories=AudioVideo;Audio;Player;GTK; Exec=audacious %U TryExec=adventurous Terminal=imitation MimeType=application/ogg;awarding/ten-cue;application/x-ogg;application/xspf+xml;sound/midi;sound/mp3;sound/mpeg;audio/mpegurl;audio/ogg;sound/prs.sid;audio/x-flac;audio/x-it;audio/ten-mod;audio/ten-mp3;audio/ten-mpeg;audio/ten-mpegurl;sound/10-ms-wma;audio/x-musepack;audio/10-s3m;audio/10-scpls;sound/ten-stm;sound/10-vorbis+ogg;audio/x-wav;audio/10-xm;x-content/audio-cdda; Actions=PlayPause;Adjacent;Previous [Desktop Action PlayPause] Name=Play-Pause Exec=audacious -t OnlyShowIn=Unity; [Desktop Activeness Next] Name=Next Exec=audacious -f OnlyShowIn=Unity; [Desktop Action Previous] Name=Previous Exec=adventurous -r OnlyShowIn=Unity;
The part that has to exercise with the shortcuts is everything after 'Deportment=' including this. Everything specified on the 'Actions' field has its ain name, specified on the 'Name' field of each one. For example, action PlayPause has proper name Play-Interruption, and thus Play-Pause will be displayed on the shortcut in the Unity Launcher once y'all correct click the icon of 'adventurous'. Clicking on a shortcut will result on the corresponding activeness, which means it will execute annihilation specified in the corresponding 'Exec' field. Each action has its own 'Exec' field, aside from the 'Exec' field specified at the commencement of the file which refers to the action that volition take identify when you click on the launcher.
Making such shortcuts for applications is generally very easy, unless the application itself doesn't provide plenty command line arguments so as to do a corresponding activity 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 'adventurous', used on the above example were found though its manual page, using the command
man audacious
, the arrows and so every bit to browse the manual page and the key 'Q' then equally to exit.Please, too notice the %U used in the .desktop file above. It is used and then as the application to be able to accept an statement when dragging and dropping a file within the Unity bar on the left. Without it, the programme will launch itself, but the argument will not be passed to information technology and it will exist just the same as clicking the application and so every bit to launch.
A thread for word of this wiki tin be found on the forum at http://ubuntuforums.org/showthread.php?t=2012385
Source: https://help.ubuntu.com/community/UnityLaunchersAndDesktopFiles
0 Response to "Unity Png File Could Not Be Read"
Post a Comment