oedead26 / ChessPP

Chess++ project for CS 371.
1 stars 0 forks source link

Please provide a desktop file #2

Open rapgro opened 9 years ago

rapgro commented 9 years ago

This could be something like the following:

[Desktop Entry] Name=ChessPP GenericName=Chess Game Comment=Classic chess game written in C++ Exec=chesspp Icon=/usr/share/chesspp/images/program_icon.png Terminal=false Type=Application Categories=Game;

kkofler commented 9 years ago

@rapgro, you should explain what a .desktop file is. ;-)

A .desktop file (e.g. chesspp.desktop) is what makes an application show up in the menu (the equivalent of Windows' Start menu) of all desktop environments that follow the freedesktop.org specifications. Basically, all the desktop environments you can use on GNU/Linux (KDE Plasma, GNOME, Xfce, Cinnamon, LXQt, etc.) follow the .desktop file specification.

See: http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/

The file should be installed to $prefix/share/applications (e.g., /usr/share/applications) on GNU/Linux systems. It can usually be ignored on Windows, unless you want to run a tool that makes a Start menu entry out of that. (E.g., I think the KDE on Windows (kdewin) project has such a tool somewhere.)

I'll also point out that Icon= with a full path is not ideal for several reasons:

So, a better idea would be to follow the icon theme spec: http://www.freedesktop.org/wiki/Specifications/icon-theme-spec/ and install the icon to the "hicolor" theme (which has become the theme to install unthemed icons to, the "hicolor" name comes from a historical icon theme), in the "apps" category, with a name such as "chesspp". That allows the .desktop file to just write Icon=chesspp. The desktop environment will select the best fitting size from the ones available. Even if you have only one icon size available at this time, it is still a good idea to do that.

As for why this is necessary: On Windows, you would create a chesspp.ico that contains all sizes. On GNU/Linux, we use the above spec to install multiple .png files for the different sizes to the appropriate directories. (This is a general paradigm difference: On GNU/Linux, we often use multiple small files where Windows prefers to have one big file.)