Skip to main content

Module appname

Module appname 

Source
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: the Name of an installed desktop entry that runs this program, else of the app installed in exe_dir (the directory of the process’s executable; not for an interpreter or runtime such as java, which runs any app), else the process name comm when the basename has no letters (a versioned binary such as 2.1.283), else the basename with its first letter upper-cased. The @leaf suffix 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>/exe without the (deleted) suffix, else the basename of the first argument in /proc/<pid>/cmdline. None when neither can be read.
friendly_name
display_name of the program exe (a basename, run from exe_dir) whose process name is comm, using the cached desktop_names. Never waits for them: until they are read, the name falls back to the basename rules.
loaded_desktop_names
The cached desktop_names if they have been read, without waiting: None until the first desktop_names call has finished.
program_name
The name a program goes by: its executable basename exe, or the process name comm when the basename has no letters (a versioned binary such as 2.1.284 whose process calls itself claude).