Skip to content

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

NameTypeDescription
templatestrpackaging/linux/com.sokteam.sok.desktop, as bundled.
appimagePathPath of the AppImage the app runs from.

Returns

  • strThe entry with Exec running the AppImage, and TryExec hiding it from
  • strthe menu once the file is gone.
Source

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

NameTypeDescription
pathPath
Source

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

NameTypeDefaultDescription
appdirOptional[Path]NoneMounted AppImage contents; defaults to $APPDIR, set by the AppImage runtime.
Source

Attributes

NameValue
APP_ID'com.sokteam.sok'
loggerlogging.getLogger(__name__)
Built with Kiln