Taiko2k / GTK4PythonTutorial

GTK4 + Python tutorial with code examples
446 stars 33 forks source link

how to set app icon #18

Closed kasinadhsarma closed 1 year ago

kasinadhsarma commented 1 year ago

image i need app icon indicate in gtk4.0 in python all the whole version is completed can you help me

Taiko2k commented 1 year ago

First you decide on and set your application ID as mentioned in my tutorial, e.g. com.github.me.myapp.

Then your icon file(s) will go in the hicolor theme (hicolor is the base default theme that all other themes inherit) once you package your app, e.g:

/usr/share/icons/hicolor/128x128/apps/com.github.me.myapp.png for a raster image for example, and/or /usr/share/icons/hicolor/scalable/apps/com.github.me.myapp.svg for vector (preferred).

(Or locally in ~/.local/share/icons/hicolor/...)

Typically you would store that hicolor directory structure in your project directory as data/icons/hicolor/.... When packaging you copy it to the appropriate location on the system.

Once you make a .desktop file, in it set the icon field to your app id: Icon=com.github.me.myapp. The icon will work once you launch your app using the .desktop file.


FAQ: OK but how do I programmatically set the icon of my window?

A: My understanding is that in modern desktop Linux the idea is you don't. Wayland provides no mechanism for a client program to set an icon. Window icons are purely handled by your WM/DE using the icon specified in the .desktop file where the name of the desktop file matches your app ID.

kasinadhsarma commented 1 year ago

https://github.com/Exploit0xfffff/PenetrationApp can you fix these both errors or any suggestions you give to me in install.sh this command is only running background terminal Exec=gnome-terminal --working-directory=$CURRENT_DIR -e 'python3 $MAIN_PY_PATH'