sok.core.desktop_entry
Desktop integration of the Linux AppImage.
GNOME and KDE show an app's icon and name only through an installed .desktop file matching its id (on Wayland they ignore the window icon). An AppImage installs nothing, so S.O.K adds its own entry to the user's applications menu each time it starts from one.
Functions
desktop_entry
def desktop_entry(template: str, appimage: Path) -> str:Point the packaged desktop entry at the AppImage file.
Parameters
| Name | Type | Description |
|---|---|---|
template | str | packaging/linux/com.sokteam.sok.desktop, as bundled. |
appimage | Path | Path of the AppImage the app runs from. |
Returns
strThe entry with Exec running the AppImage, and TryExec hiding it fromstrthe menu once the file is gone.
exec_argument
def exec_argument(path: Path) -> str:Quote a path for the Exec key of a desktop entry.
The Desktop Entry Specification quotes with double quotes (not the shell's single quotes), escapes ", `, $ and \ inside them and doubles % (field codes); string escaping then applies to the whole value.
Parameters
| Name | Type | Description |
|---|---|---|
path | Path |
install_desktop_entry
def install_desktop_entry(appdir: Optional[Path] = None) -> None:Add S.O.K to the applications menu when it runs from an AppImage.
Writes the entry and its icon to the XDG data folder (~/.local/share), refreshed on each start so the entry follows the AppImage if it moves. Failures are logged, never raised: the app starts anyway.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
appdir | Optional[Path] | None | Mounted AppImage contents; defaults to $APPDIR, set by the AppImage runtime. |
Attributes
| Name | Value |
|---|---|
APP_ID | 'com.sokteam.sok' |
logger | logging.getLogger(__name__) |