I am trying to add a launcher icon for a custom Python script showing a Tkinter window (script location: /home/hakon/my-tkapp.py):
#! /usr/bin/env python3
import tkinter as tk
root = tk.Tk(className='MyTkApp')
label = tk.Label(root, text="Hello World")
label.pack()
root.mainloop()
The script is executable. I am using pyenv, so if I run the following from gnome-terminal:
$ which python3
/home/hakon/.pyenv/shims/python3
I created a desktop file (file location: ~/.local/share/applications/my-tk-app.desktop):
[Desktop Entry]
Type=Application
Terminal=false
Name=My Tk Application
Exec=/home/hakon/my-tkapp.py
Icon=/home/hakon/icons/my-tk-app-icon.png
StartupWMClass=MyTkApp
For the icon, I just (for the purpose of testing) copied one of the standard icons:
cp /usr/share/icons/hicolor/48/apps/apport.png /home/hakon/icons/my-tk-app-icon.png
Running the desktop-file-validate command on the desktop file gives no output, so the desktop file should be OK.
However, when I run the python script from the terminal:
~/my-tkapp.py
I still get the generic question mark icon in the launcher.
What am I overlooking here?
