API#

desktop_entry_lib.__init__.get_xdg_data_dirs() list[str]#

Get all XDG DATA DIRS

desktop_entry_lib.__init__.get_icon_path(icon_name: str) Optional[str]#
class desktop_entry_lib.__init__.TranslatableKey#
default_text: str#

The untranslated text

translations: dict[str, str]#

The translations

get_translated_text() str#

Returns the text for the current language

load_section(section: dict[str, str], search_key: str) None#
get_text(entry_key) str#
clear() None#

Clear

class desktop_entry_lib.__init__.TranslatableListKey#
load_section(section: dict[str, str], search_key: str) None#
get_text(entry_key) str#
clear() None#
class desktop_entry_lib.__init__.DesktopEntry#
Type: Literal['Application', 'Link', 'Directory']#

The Type Key

Version: Optional[Literal['1.0', '1.1', '1.2', '1.3', '1.4', '1.5']]#

The Version Key

Name: TranslatableKey#

The Name Key

GenericName: TranslatableKey#

The GenericName Key

NoDisplay: Optional[bool]#

The NoDisplay Key

Comment: TranslatableKey#

The Comment Key

Icon: Optional[str]#

The Icon Key

Hidden: Optional[bool]#

The Hidden Key

OnlyShowIn: list[str]#

The OnlyShowIn Key

NotShowIn: list[str]#

The NotShowIn Key

Terminal: Optional[bool]#

The Terminal Key

MimeType: list[str]#

The MimeType Key

Categories: list[str]#

The Categories Key

Implements: list[str]#

The Implements Key

Keywords: TranslatableListKey#

The Keywords Key

StartupNotify: Optional[bool]#

The StartupNotify Key

URL: Optional[str]#

The URL Key

PrefersNonDefaultGPU: Optional[bool]#

The PrefersNonDefaultGPU Key

SingleMainWindow: Optional[bool]#

The SingleMainWindow Key

CustomKeys: dict[str, str]#

The Keys starting with X-

should_show() bool#

Returns if a dektop entry should be displayed in the menu

get_text() str#

Returns the content of the desktop entry

write_file(path: Union[str, PathLike]) None#

Writes a .desktop file

classmethod from_string(text: str)#

Loads the content of a .desktop file from a string

classmethod from_file(path: Union[str, PathLike])#

Returns a desktop entry from the given file

classmethod from_id(desktop_id: str)#

Returns a desktop entry from the given id

class desktop_entry_lib.__init__.DesktopEntryCollection#
desktop_entries: dict[str, desktop_entry_lib.__init__.DesktopEntry]#

The desktop entries

load_file(path: Union[str, PathLike])#

Loads the given file

load_directory(path: Union[str, PathLike]) None#

Loads all desktop entries from the given directory

load_menu() None#

Loads all desktop entries from the menu

load_desktop() None#

Loads all desktop entries files from the Desktop

get_entries_by_category(category: str) list[desktop_entry_lib.__init__.DesktopEntry]#

Returns a list of all desktop entries that have the given category

get_entries_by_mime_type(mime_type: str) list[desktop_entry_lib.__init__.DesktopEntry]#

Returns a list of all desktop entries that can open the given MimeType

get_visible_entries() list[desktop_entry_lib.__init__.DesktopEntry]#

Get a list of all desktop enties that should be shown