Re: Proposal: add "spoken name" to desktop entries
Matthias Klumpp <[email protected]>
| Newsgroups | gmane.linux.xdg.devel |
|---|---|
| Message-ID | <CAKNHny8MGtyD+aq94qok47qEA+cWyhLynPnQet7P7+bahN3Amw@mail.gmail.com> |
Hi! Am Di., 3. Sept. 2019 um 22:35 Uhr schrieb Chanslor Rosenthal <[email protected]>: > > I hope I'm on the right list, and not being too forward! I got this address from #freedesktop at Freenode. > > --- > > Proposal: add a [Spoken Name] field to .desktop files, for use by "virtual assistants." > > I'm writing a crude utility to enable the Mycroft personal assistant to launch desktop applications. The most effective route *by far* has been to parse desktop entries, just like your typical application launcher, and cache the results. > > The problem arises when trying to name the program out loud. The "name" field in a desktop entry doesn't necessarily correspond to what a user would call the program when discussing it. Hence, "Mycroft, launch Firefox," doesn't do the trick on stock Debian. You have to do, "Mycroft, launch Firefox ESR." Quantum on stock Ubuntu wants to be called, "Firefox Web Browser," or something like that. > [...] While adding spoken names to desktop-entry files may take a while, there actually may be a useful workaround for your problem: Use AppStream[1] metainfo files! AppStream is a Freedesktop specification for describing software components, and that includes desktop-applications. Its primary purpose is to make software centers work and provide metadata for e.g. Flatpak, but that doesn't mean it can't be used for other things. An AppStream metainfo file that contains a desktop-application references one or more launchable entries, which are desktop-entry files. Most apps ship metainfo XML files and store them in `/usr/share/metainfo`. This is available on all modern distributions, at the very least for local applications and at best for apps in the distribution's repositories and Flatpaks as well. What you could to is search the spoken name in the system's metadata pool and then launch the app that the AppStream description is associated with (which for some apps may be more than one launchable entry). Since those are the names that show up in software centers, it is likely that the name reflects the "spoken name" you want. You can also resolve back a desktop-entry filename to an AppStream component[2]. With these metadata sources and some experimenting, it may be possible to create a system that will launch the right app in most cases, and will be able to ask the user to clarify the query in cases where ambiguity exists. Exciting stuff! Cheers, Matthias [1]: https://www.freedesktop.org/wiki/Distributions/AppStream/ [2]: https://www.freedesktop.org/software/appstream/docs/api/appstream-AsPool.html#as-pool-get-components-by-launchable -- I welcome VSRE emails. See http://vsre.info/ _______________________________________________ xdg mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/xdg