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]#
Get the path of a Icon
- class desktop_entry_lib.__init__.ValidationMessageDict#
- Error: list[str]#
- FutureError: list[str]#
- Warning: list[str]#
- Hint: list[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__.DesktopAction#
- Name: TranslatableKey#
The Name Key
- Icon: Optional[str]#
The Icon Key
- Exec: Optional[str]#
The Exec Key
- classmethod from_dict(action_section: dict[str, str])#
Load the Action from a Dict. Onyl used internaly.
- get_text() str#
Converts the Action into a String
- get_icon_path() Optional[str]#
Returns the full path to the Icon
- 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
- DBusActivatable: Optional[bool]#
The DBusActivatable Key
- TryExec: Optional[str]#
The TryExec Key
- Exec: Optional[str]#
The Exec Key
- Path: Optional[str]#
The Path 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
- StartupWMClass: Optional[str]#
The StartupWMClass Key
- URL: Optional[str]#
The URL Key
- PrefersNonDefaultGPU: Optional[bool]#
The PrefersNonDefaultGPU Key
- SingleMainWindow: Optional[bool]#
The SingleMainWindow Key
- Actions: dict[str, desktop_entry_lib.__init__.DesktopAction]#
The Actions
- CustomKeys: dict[str, str]#
The Keys starting with X-
- file_path: Optional[str]#
The path to the .desktop file
- desktop_id: Optional[str]#
The ID of the .desktop file
- is_valid() bool#
Returns, if the desktop entry is valid. desktop-file-validate needs to be installed.
- get_validation_messages() ValidationMessageDict#
Returns all messages from desktop-file-validate
- should_show() bool#
Returns if desktop entry should be showed
Returns if a dektop entry should be displayed in the menu
- get_icon_path() Optional[str]#
Returns the full path to the Icon
- 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) DesktopEntry#
Loads the content of a .desktop file from a string
- classmethod from_file(path: Union[str, PathLike]) DesktopEntry#
Returns a desktop entry from the given file
- classmethod from_id(desktop_id: str) Optional[DesktopEntry]#
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
Loads all desktop entries from the menu
- load_desktop() None#
Loads all desktop entries files from the Desktop
- load_autostart() None#
Loads all autostart entries
- 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 to the User
Get a list of all desktop enties that should be shown in the Menu