caveexpress icon indicating copy to clipboard operation
caveexpress copied to clipboard

LINUX: Desktop file improvements

Open akien-mga opened this issue 7 years ago • 7 comments

Hi there,

There are currently several issues with the Linux .desktop files as they are generated by the buildsystem, for example:

[Desktop Entry]
Version=1.0
Name=CavePacker
GenericName=CavePacker
Comment=CavePacker is a Sokoban game.\n\nIt is a puzzle game where you have to move the packages onto their targets without getting stuck. The lesser steps you made for solving a level, the better.\n\nYou may only push but not pull packages.\n
Exec=cavepacker
Icon=cavepacker
Terminal=false
Type=Application
Categories=Game;
StartupNotify=false
Keywords=sokoban;puzzle;packages;
  • The GenericName field should in theory describe the kind of game that this is; see it as a short description of the game. Here it could be "Sokoban game". It's not the most important though, many projects do use the same value as for Name.
  • The comment is way too long, and the newline characters likely won't be understood by most DEs.
  • The Icon path is wrong, as icons are installed as ${name}-icon.png. I would suggest to keep the field like that but fix the icons installation name (you can use the RENAME option for that when installing files with CMake).
  • The Categories field is not descriptive enough. Most DEs rely on those values to put the desktop entry in the proper submenus. Here it should be Game;LogicGame; (the ending semicolon is important - not critical, but linters will complain if it's missing).

All in all, I feel that the current system you use to generate the .desktop files by filling the templates using values from docs/${name}/ is a bit overkill. To get the values right, you'd have to add at least COMMENT and CATEGORIES files to each docs folder so that they could be parsed and used in the respective desktop files...

It might be a bit less elegant, but I think it would be much easier to just provide a hardcoded .desktop file for each game. If you really want to keep the template + parsed content scheme, then you should probably put all .deskop relevant content in one file as some XML, JSON or YAML and have CMake parse it.

More info about desktop entries:

  • https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
  • https://specifications.freedesktop.org/menu-spec/latest/apas02.html

akien-mga avatar Jul 29 '16 21:07 akien-mga

As a side note, I've finally imported caveexpress in my distro, Mageia: http://svnweb.mageia.org/packages/cauldron/caveexpress/current/SPECS/caveexpress.spec?view=markup Thanks for your great work to ease the packaging work :)

akien-mga avatar Jul 29 '16 21:07 akien-mga

I did what was requested for the Categories in 89d196f2338b1498406e4ce9e14592a92a061c51

Will check out the others asap

mgerhardy avatar Jul 30 '16 10:07 mgerhardy

or better here: 0f47afd5f1831e1233d0b5aa4a96dba708925e0b

mgerhardy avatar Jul 30 '16 10:07 mgerhardy

I did what was requested for the Categories in 89d196f

Ah I had missed that. It works for CaveExpress but not for CavePacker, I guess you'd have to replace Category for CATEGORY.

akien-mga avatar Jul 30 '16 10:07 akien-mga

Thanks, that typo is fixed now in master

mgerhardy avatar Jul 30 '16 12:07 mgerhardy

The problem with renaming the icons in the install step is, that all the other installers and packages (windows, osx, ios, android, steamlink, ...) rely on the name. So I will most likely just fix the desktop file template.

mgerhardy avatar Jul 30 '16 13:07 mgerhardy

which reminds me... what about appdata.xml? Do you make use of this file, too?

https://people.freedesktop.org/~hughsient/appdata/

mgerhardy avatar Jul 30 '16 13:07 mgerhardy