.desktop: Difference between revisions

From miki
Jump to navigation Jump to search
(Created page with "Desktop file with extension {{file|.desktop}}.")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Desktop file with extension {{file|.desktop}}.
Desktop file with extension {{file|.desktop}}.

== References ==
* https://www.cyberciti.biz/howto/how-to-install-and-edit-desktop-files-on-linux-desktop-entries/
: Overview, how to create / validate / update files.

== Overview ==
{{file|.desktop}} file locations
* {{file|/usr/share/applications/}} - The default Linux distro spe-ific applications
* {{file|/usr/local/share/applications/}} - Third party specific applications
* {{file|~/.local/share/applications/}} - User specific applications
== Create desktop files ==
<source lang="bash">
# Create desktop file
touch gimp-2.8.desktop
desktop-file-edit \
--set-name="GIMP on LXD" \
--set-comment="GIMP 2.8 with custom plugins" \
--set-icon="/home/vivek/backups/desktop-entries/gimp.png" \
--add-category="Graphics;2DGraphics;RasterGraphics;GTK;" \
--set-key="Exec" --set-value="/snap/bin/lxc exec gui-1804-gimp -- sudo --login --user vivek /usr/bin/gimp-2.8 %U" \
--set-key="Type" --set-value="Application" \
gimp-2.8.desktop
# Validate desktop file
desktop-file-validate ~/desktop-entries/gpass.desktop
# Install desktop file
desktop-file-install --dir=~/.local/share/applications ~/desktop-entries/gpass.desktop
# Update database
update-desktop-database ~/.local/share/applications
</source>

== Tips ==
=== Example desktop file ===
<source lang=text>
[Desktop Entry]
Type=Application
Encoding=UTF-8
Version=1.0
Name=No Name
Name[en_US]=Firefox
Comment[en_US]=Web Browser Firefox
Comment=Web Browser Firefox
Exec=firefox-2
X-GNOME-Autostart-enabled=true
</source>

=== Change environment variable for application ===
Edit the line <code>Exec</code>, and replace with <code>env</code> program.

'''Note''': If Exec program is not found, the .desktop file will not be listed by Gnome / desktop environment!!!

<source lang=diff>
-Exec=playonlinux %F
+Exec=env LC_ALL=en_US.UTF-8 playonlinux %F
</source>

Latest revision as of 10:42, 14 October 2023

Desktop file with extension .desktop.

References

Overview, how to create / validate / update files.

Overview

.desktop file locations

  • /usr/share/applications/ - The default Linux distro spe-ific applications
  • /usr/local/share/applications/ - Third party specific applications
  • ~/.local/share/applications/ - User specific applications

Create desktop files

# Create desktop file
touch gimp-2.8.desktop
desktop-file-edit \
--set-name="GIMP on LXD" \
--set-comment="GIMP 2.8 with custom plugins" \
--set-icon="/home/vivek/backups/desktop-entries/gimp.png" \
--add-category="Graphics;2DGraphics;RasterGraphics;GTK;" \
--set-key="Exec" --set-value="/snap/bin/lxc exec gui-1804-gimp -- sudo --login --user vivek /usr/bin/gimp-2.8 %U" \
--set-key="Type" --set-value="Application" \
gimp-2.8.desktop
# Validate desktop file
desktop-file-validate ~/desktop-entries/gpass.desktop
# Install desktop file
desktop-file-install --dir=~/.local/share/applications ~/desktop-entries/gpass.desktop
# Update database
update-desktop-database ~/.local/share/applications

Tips

Example desktop file

[Desktop Entry]
Type=Application
Encoding=UTF-8
Version=1.0
Name=No Name
Name[en_US]=Firefox
Comment[en_US]=Web Browser Firefox
Comment=Web Browser Firefox
Exec=firefox-2
X-GNOME-Autostart-enabled=true

Change environment variable for application

Edit the line Exec, and replace with env program.

Note: If Exec program is not found, the .desktop file will not be listed by Gnome / desktop environment!!!

-Exec=playonlinux %F
+Exec=env LC_ALL=en_US.UTF-8 playonlinux %F