pub fn write_custom_entry(
applications: &Path,
command: &str,
) -> Result<(String, String)>Expand description
Writes a desktop entry for a command a person typed, and hands back the entry’s file name.
This is the “Other…” answer in a chooser: none of the applications
offered, run this instead. The entry goes in the user’s own
applications directory, marked NoDisplay=true so it stays out of
menus — it is a record of one person’s one-off choice, not an
application anybody installed.
The name follows the convention every other implementation uses
(word-usercreated-1.desktop), counting up rather than overwriting,
so two different commands beginning with the same word do not
quietly become one.
Returns the entry’s file name and the name written inside it. Both,
because a caller needs to show one and record the other, and working
the name out a second time is how they came to disagree: the entry
on disk said zeditor while the caller’s copy said
/usr/bin/zeditor.
command is written into Exec= as given. Nothing here parses it —
see this module’s doc — which does mean a command that is nonsense
produces an entry that fails to launch. That is visible immediately
and recoverable by choosing again; guessing at what somebody meant
would not be.