weixin_39929961
2020-12-06 10:03 阅读 2

Update XDG files

Update desktop file

  • Update Version entry (Keyword key was introduced in 1.1)
  • Fix GenericName [1]
  • Add TryExec entry
  • Update Keywords (to be the same as in the AppData file)
  • Change order of categories (Main Category before Additional Categories)

[1] - You should capitalize first letter of each word:


# grep -HER GenericName= /usr/share/applications/
/usr/share/applications/mate-terminal-root.desktop:GenericName=Root Terminal
/usr/share/applications/mate-system-monitor.desktop:GenericName=System Monitor
/usr/share/applications/atril.desktop:GenericName=Document Viewer
/usr/share/applications/glade.desktop:GenericName=Interface Designer
/usr/share/applications/org.kde.kdiff3.desktop:GenericName=Diff/Patch Frontend
/usr/share/applications/inkscape.desktop:GenericName=Vector Graphics Editor
/usr/share/applications/anjuta.desktop:GenericName=Integrated Development Environment
/usr/share/applications/caja-browser.desktop:GenericName=File Browser
/usr/share/applications/empathy.desktop:GenericName=IM Client
/usr/share/applications/codelite.desktop:GenericName=C/C++ IDE
/usr/share/applications/mate-terminal.desktop:GenericName=Terminal
/usr/share/applications/xterm.desktop:GenericName=Terminal
/usr/share/applications/gnome-paint.desktop:GenericName=Paint Program
/usr/share/applications/libreoffice-math.desktop:GenericName=Formula Editor
/usr/share/applications/firefox.desktop:GenericName=Web Browser
/usr/share/applications/qt4-designer.desktop:GenericName=Interface Designer
/usr/share/applications/pluma.desktop:GenericName=Text Editor
/usr/share/applications/setroubleshoot.desktop:GenericName=SELinux Troubleshooter
/usr/share/applications/mate-calc.desktop:GenericName=Calculator
/usr/share/applications/google-chrome.desktop:GenericName=Web Browser
/usr/share/applications/itweb-settings.desktop:GenericName=Control Panel
/usr/share/applications/gparted.desktop:GenericName=Partition Editor
/usr/share/applications/birdfont.desktop:GenericName=Font Editor
/usr/share/applications/javaws.desktop:GenericName=Java Web Start
/usr/share/applications/uget-gtk.desktop:GenericName=Download Manager
/usr/share/applications/org.gnome.clocks.desktop:GenericName=Clocks
/usr/share/applications/chromium-browser.desktop:GenericName=Web Browser
/usr/share/applications/gv.desktop:GenericName=PostScript/PDF Viewer
/usr/share/applications/mypaint.desktop:GenericName=Raster Graphics Editor
/usr/share/applications/code.desktop:GenericName=Text Editor
/usr/share/applications/htop.desktop:GenericName=Process Viewer
/usr/share/applications/libreoffice-draw.desktop:GenericName=Drawing Program
/usr/share/applications/engrampa.desktop:GenericName=Archive Manager
/usr/share/applications/uniconvw.desktop:GenericName=Vector Graphics Translator
/usr/share/applications/mtpaint.desktop:GenericName=Image Editor
/usr/share/applications/org.gnome.Cheese.desktop:GenericName=Webcam Booth
/usr/share/applications/policyeditor.desktop:GenericName=Policy Tool 
/usr/share/applications/PlayOnLinux.desktop:GenericName=Game
/usr/share/applications/caja.desktop:GenericName=File Manager
/usr/share/applications/gpaint.desktop:GenericName=Paint Program
/usr/share/applications/code-url-handler.desktop:GenericName=Text Editor
/usr/share/applications/gimp.desktop:GenericName=Image Editor
/usr/share/applications/qt5-designer.desktop:GenericName=Interface Designer
/usr/share/applications/libreoffice-writer.desktop:GenericName=Word Processor
/usr/share/applications/rednotebook.desktop:GenericName=Journal
/usr/share/applications/kde4/knetattach.desktop:GenericName=Network Folder Wizard
/usr/share/applications/kde4/okteta.desktop:GenericName=Hex Editor
/usr/share/applications/kde4/kwrite.desktop:GenericName=Text Editor
/usr/share/applications/kde4/kdevelop.desktop:GenericName=Integrated Development Environment
/usr/share/applications/kde4/kolourpaint.desktop:GenericName=Paint Program
/usr/share/applications/kde4/kate.desktop:GenericName=Advanced Text Editor
/usr/share/applications/orca.desktop:GenericName=Screen Reader
/usr/share/applications/opera.desktop:GenericName=Web browser
/usr/share/applications/xsane.desktop:GenericName=Scanner Tool
/usr/share/applications/libreoffice-base.desktop:GenericName=Database Development
/usr/share/applications/pinta.desktop:GenericName=Image Editor
/usr/share/applications/virtualbox.desktop:GenericName=Virtual Machine
/usr/share/applications/lash-panel.desktop:GenericName=LASH Control Panel
/usr/share/applications/meld.desktop:GenericName=Diff Viewer

Update AppData file

  • Fix description (<p> tag)
  • Remove keywords (should be obtained from desktop file)
  • Fix URLs
  • Fix screenshot caption (too long) [2]

[2] - Does not pass validation: - The caption should be short. - Try not to repeat the application's name in the caption. - Do not end your caption with a fullstop.


• style-invalid         : <caption> is too long [Color-correcting a drosera rotundifolia in RawTherapee 5.7.];longest allowed is 50 chars
</caption>

https://www.freedesktop.org/software/appstream/docs/chap-Quickstart.html#qsr-app-screenshots-info

Fix AppData file

  • Remove unreachable screenshot URL [3]

[3] - The URL you entered last time is unreachable. I removed it in my last commit. Unfortunately, the AppData file with unreachable links does not pass validation. If you restore file on the server, you can skip the last commit.


• url-not-found         : <screenshot> failed to download (HTTP 404: Not Found) [https://rawtherapee.com/images/screenshots/rt570_1.jpg]
</screenshot>

该提问来源于开源项目:Beep6581/RawTherapee

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • weixin_39710951 weixin_39710951 2020-12-06 10:03

    Hey

    I've lived through several iterations of these specifications and their respective tools, and some of these changes seem arbitrary...

    Update Version entry (Keyword key was introduced in 1.1)

    Ok, we're using Desktop Entry Specification v1.1 now.

    https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html

    The page shows "Version 1.2alpha"... that casts doubt on the stability of these specifications.

    Fix GenericName

    I renamed rtdata/rawtherapee.desktop.in to rawtherapee.desktop and changed Version=1.0 to Version=1.1, then validated it:

    text
    $ desktop-file-validate --help
    (...)
    Validate desktop entry files according to the Desktop Entry specification 1.1.
    $ desktop-file-validate rawtherapee.desktop
    $ echo $?
    0
    

    It validates. A look inside .desktop files on my computer shows the case of the GenericName field is mixed - more often capitalized than not, but no rule for that in the specification, and no explanation of what a "generic name" even is. So the GenericName value is changed, but not fixed, since it's not broken.

    bash
    /usr/share/applications/org.kde.mobile.okular_pdf.desktop:GenericName=Document viewer
    /usr/share/applications/displaycal-apply-profiles.desktop:GenericName=Calibration and ICC Profile Loader (force)
    /usr/share/applications/org.kde.mobile.okular_xps.desktop:GenericName=Document viewer
    /usr/share/applications/displaycal-curve-viewer.desktop:GenericName=Calibration and ICC profile tone response curve viewer
    /usr/share/applications/org.kde.mobile.okular_fb.desktop:GenericName=Document viewer
    etc.
    

    Agreed with the rest of the changes to the .desktop file.

    Fix description (<p> tag)

    I don't mind the change, but it's not broken, and the way we have it is the way the specification uses it.

    Remove keywords (should be obtained from desktop file)

    Good.

    Fix URLs

    I don't mind the change, but as before, they're not broken.

    Fix screenshot caption (too long)

    The specification says the caption's max length is 180 chars, not 50:

    Optionally, a tag may have a

    child, defining a short (not more than 180 characters!) description of what the user can see on the referenced screenshot.

    Try not to repeat the application's name in the caption.

    Most of the captions contain the word "RawTherapee", so they need to be "fixed".

    One of the screenshot's URL no long works due to switching websites.

    Here is a new screenshots section to replace the current one:

    
        <screenshots>
            <screenshot type="default">
                <caption>Color correction</caption>
                <image width="1920" height="1080">https://rawtherapee.com/images/screenshots/rt57_drosera_rotundifolia.png</image>
            </screenshot>
            <screenshot>
                <caption>File browser</caption>
                <image width="1920" height="1080">https://rawtherapee.com/images/screenshots/rt57_file_browser.png</image>
            </screenshot>
            <screenshot type="default">
                <caption>High dynamic range compression</caption>
                <image width="1920" height="1080">https://rawtherapee.com/images/screenshots/rt57_field_sunset.png</image>
            </screenshot>
            <screenshot type="default">
                <caption>Developing a film negative</caption>
                <image width="1920" height="1080">https://rawtherapee.com/images/screenshots/rt57_film_negative.png</image>
            </screenshot>
        </screenshots>
    
    点赞 评论 复制链接分享
  • weixin_39710951 weixin_39710951 2020-12-06 10:03

    In fact, I'll merge now and make the necessary changes right away.

    点赞 评论 复制链接分享
  • weixin_39929961 weixin_39929961 2020-12-06 10:03

    I've lived through several iterations of these specifications and their respective tools, and some of these changes seem arbitrary...

    Sorry about that. I will try to explain everything.

    https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html

    The page shows "Version 1.2alpha"... that casts doubt on the stability of these specifications.

    Yeah, not everything is stable as a rock here. This is especially true for all "extensions" (X-* keys). For example, X-Flatpak-RenamedFrom was supposed to be a string value, but then they changed their mind, so it is a list now. The problem is that list must ends with ;, so they literally broke the specification.

    According to the specification, we have 3 keys for a name and description: Name, GenericName, and Comment. However, GNOME prefers to use X-GNOME-FullName instead, MATE may make use of X-MATE-FullName, etc.

    Trinity (KDE3 fork) sill uses obsoleted variant of the Keyword key, in which values are separated by commas instead of semi-colons.

    It validates. A look inside .desktop files on my computer shows the case of the GenericName field is mixed - more often capitalized than not, but no rule for that in the specification, and no explanation of what a "generic name" even is. So the GenericName value is changed, but not fixed, since it's not broken.

    If I good remember, it was a GNOME initiative to capitalize first letter of each word. However, it was also mostly adopted by KDE. Desktop files from other vendors may vary, but most stick to the GNOME and KDE rules. https://developer.gnome.org/hig-book/unstable/design-text-labels.html.en#layout-capitalization

    shell
    /usr/share/applications/org.kde.mobile.okular_pdf.desktop:GenericName=Document viewer
    /usr/share/applications/displaycal-apply-profiles.desktop:GenericName=Calibration and ICC Profile Loader (force)
    /usr/share/applications/org.kde.mobile.okular_xps.desktop:GenericName=Document viewer
    /usr/share/applications/displaycal-curve-viewer.desktop:GenericName=Calibration and ICC profile tone response curve viewer
    /usr/share/applications/org.kde.mobile.okular_fb.desktop:GenericName=Document viewer
    etc.
    

    Well, the main desktop file for Okular uses Document Viewer: https://github.com/KDE/okular/blob/v19.08.1/shell/org.kde.okular.desktop#L62

    
    GenericName=Document Viewer
    

    Even org.kde.mobile.okular_pdf uses Document Viewer for GenericName[en_GB]. https://github.com/KDE/okular/blob/v19.08.1/generators/poppler/org.kde.mobile.okular_pdf.desktop#L62

    Maybe they missed some values when they fixed it last time.

    Fix description (<p> tag)

    I don't mind the change, but it's not broken, and the way we have it is the way the specification uses it.

    It matters when you want to integrate with the translation system. Some solutions will import raw values (with indents), while others will try to use formatted values (just like it is in HTML). What's worse, in the old variant, changing indent (e.g. spaces → tabs) may break keys used in PO files. This can also occur after changing the translation system. That's why I suggested these changes.

    Fix URLs

    I don't mind the change, but as before, they're not broken.

    The fix was about bugtracker. This link should lead to the issues list (or the main page of bugtracker), not to the new issue submission form. And I stripped a trailing slash from the homepage URL, because it doesn't really use it.

    Fix screenshot caption (too long)

    The specification says the caption's max length is 180 chars, not 50:

    Unfortunately, we have 3 "standards": * appstream by ximion - Reference implementation, barely adopted. To validate, use this: appstreamcli validate --pedantic com.rawtherapee.RawTherapee.appdata.xml or appstreamcli validate com.rawtherapee.RawTherapee.appdata.xml * appstream-glib by hughsie - Glib (*coughs* GNOME *coughs*) variant, used by GNOME and Red Hat, and adopted by others as well. To validate, use this: appstream-util validate-strict com.rawtherapee.RawTherapee.appdata.xml or appstream-util validate com.rawtherapee.RawTherapee.appdata.xml or appstream-util validate-relax com.rawtherapee.RawTherapee.appdata.xml (widely used by EL and Fedora) * org.freedesktop.appstream-glib by Flathub members - fork of appstream-glib, with relaxed style rules, but with additional requirements, like OARS. To validate, use this: flatpak run org.freedesktop.appstream-glib validate-strict com.rawtherapee.RawTherapee.appdata.xml or flatpak run org.freedesktop.appstream-glib validate com.rawtherapee.RawTherapee.appdata.xml (this is currently required on Flathub) or flatpak run org.freedesktop.appstream-glib validate-relax com.rawtherapee.RawTherapee.appdata.xml

    Anyway, only the first one is really standardized and well-documented. The others are based on the reference implementation, but they introduce their own rules that change several times a year. What's worse, they break the standard in several aspects (like version comparison). Remember that each distribution may have different versions of these tools and use them when building packages. And there are also Freedesktop Guidelines, Glib Guidelines, GNOME Guidelines, Flathub Guidelines, etc. You may want to install the AppData file in ${CMAKE_INSTALL_PREFIX}/share/appdata (e.g. /usr/share/appdata) for backward compatibly with EPEL7 where the _metainfodir macro is defined as %{_datadir}/appdata, but then you realize that some new runtimes allows only the new metainfo directory - ${CMAKE_INSTALL_PREFIX}/share/metainfo (e.g. /usr/share/metainfo)... Have I mentioned that I hate it?

    Optionally, a tag may have a child, defining a short (not more than 180 characters!) description of what the user can see on the referenced screenshot.

    Try not to repeat the application's name in the caption.

    Most of the captions contain the word "RawTherapee", so they need to be "fixed".

    You are probably right, but only the first entry caused validation to fail.

    Anyway, thanks for your cooperation!

    点赞 评论 复制链接分享
  • weixin_39710951 weixin_39710951 2020-12-06 10:03

    Ok, glad I'm not alone in this frustration :)

    点赞 评论 复制链接分享

相关推荐