Add App Icon to the Dock on Fedora
Date: 3/11/2025

1. Create a .desktop
Launcher File
If the application does not already have a launcher, create one manually:
vim ~/.local/share/applications/myapp.desktop
Then, add the following content (modify accordingly):
[Desktop Entry]
Name=MyApp
Exec=/path/to/application_or_AppImage
Icon=/path/to/icon.png
Type=Application
Categories=Utility;
Terminal=false
2. Update Desktop Database
Run the following command to update the system's application database:
update-desktop-database ~/.local/share/applications/
3. Add to Dock (Favorites Bar)
Now, search for your app in Activities (Super key / Windows key), right-click on it, and select "Add to Favorites" to pin it to the dock.
Fix: New Process Spawns Instead of Linking to Existing Icon
Add WMClass
entry:
StartupWMClass=YourAppWMClass
To find the correct WM_CLASS
for your app:
-
Run the app.
-
Open a terminal and enter:
xprop | grep WM_CLASS
-
Click on the app window.
-
You will see something like:
WM_CLASS(STRING) = "myapp", "MyApp"
-
Use the second value (
MyApp
) inStartupWMClass
:StartupWMClass=MyApp
Advanced Usage
A .desktop
file follows the XDG Desktop Entry Specification, and it supports many configuration entries. Here’s a list of the most common and useful ones:
Basic Entries
Key | Description |
---|---|
Name= | The displayed name of the application. |
GenericName= | A generic name (e.g., "Web Browser"). |
Comment= | A short description of the application. |
Exec= | Command to execute the application. Use %F for file arguments. |
Icon= | Path or name of the application icon. |
Type= | The type of entry (Application , Link , or Directory ). |
Categories= | Defines categories for sorting in application menus. |
Terminal= | true to run in a terminal, false otherwise. |
Execution Behavior
Key | Description |
---|---|
TryExec= | Checks if the binary exists before running Exec . |
Path= | Working directory for the application. |
StartupNotify= | true if the application provides startup feedback (like a splash screen). |
StartupWMClass= | Window manager class name (useful for fixing icon issues). |
NoDisplay= | true hides the app from menus but keeps it available for launchers. |
Hidden= | true hides the entry from menus and launchers. |
File Handling & Mime Types
Key | Description |
---|---|
MimeType= | Lists supported MIME types (e.g., text/plain; ). |
Actions= | Defines additional actions (see Actions below). |
Keywords= | Comma-separated keywords for searching the app in the menu. |
Multiple Actions (Optional)
You can define custom actions inside the same .desktop
file.
Example
Actions=NewWindow;PrivateMode;
[Desktop Action NewWindow]
Name=Open New Window
Exec=/path/to/app --new-window
Icon=/path/to/icon.png
[Desktop Action PrivateMode]
Name=Open in Private Mode
Exec=/path/to/app --private
Icon=/path/to/icon.png
Example Full .desktop
File
[Desktop Entry]
Name=MyApp
GenericName=Text Editor
Comment=An example application
Exec=/path/to/app %F
Icon=myapp
Type=Application
Terminal=false
Categories=Utility;TextEditor;
MimeType=text/plain;
StartupNotify=true
Keywords=editor;notepad