Expand description
Friendly app names for people: “Google Chrome” for chrome, “Claude”
for a versioned binary named 2.1.284, “Firefox” for firefox.
The GUI, the CLI and the guard’s notifications share these rules. The installed desktop entries are read once per process, on first use, and kept.
Re-exports§
pub use crate::desktop::DesktopNames;
Functions§
- desktop_
names - Installed application names, read from the desktop entries on first use and cached for the life of the process. The first call waits for the read.
- display_
name - A friendly name for an app key (an exe basename, or
<basename>@<cgroup leaf>as the guard uses for runtimes). In order: theNameof an installed desktop entry that runs this program, else of the app installed inexe_dir(the directory of the process’s executable; not for an interpreter or runtime such asjava, which runs any app), else the process namecommwhen the basename has no letters (a versioned binary such as2.1.283), else the basename with its first letter upper-cased. The@leafsuffix is never shown. - exe_
dir_ of_ pid - The directory of the executable of
pid, from/proc/<pid>/exe. - exe_
of_ pid - The executable basename of
pid: the target of/proc/<pid>/exewithout the(deleted)suffix, else the basename of the first argument in/proc/<pid>/cmdline.Nonewhen neither can be read. - friendly_
name display_nameof the programexe(a basename, run fromexe_dir) whose process name iscomm, using the cacheddesktop_names. Never waits for them: until they are read, the name falls back to the basename rules.- loaded_
desktop_ names - The cached
desktop_namesif they have been read, without waiting:Noneuntil the firstdesktop_namescall has finished. - program_
name - The name a program goes by: its executable basename
exe, or the process namecommwhen the basename has no letters (a versioned binary such as2.1.284whose process calls itselfclaude).