Gio.DesktopAppInfo¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37), Gio.AppInfo (36) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | get_implementations(interface) | 
| class | new(desktop_id) | 
| class | new_from_filename(filename) | 
| class | new_from_keyfile(key_file) | 
| class | search(search_string) | 
| class | set_desktop_env(desktop_env) | 
| get_action_name(action_name) | |
| get_boolean(key) | |
| get_categories() | |
| get_filename() | |
| get_generic_name() | |
| get_is_hidden() | |
| get_keywords() | |
| get_locale_string(key) | |
| get_nodisplay() | |
| get_show_in(desktop_env) | |
| get_startup_wm_class() | |
| get_string(key) | |
| get_string_list(key) | |
| has_key(key) | |
| launch_action(action_name, launch_context) | |
| launch_uris_as_manager(uris, launch_context, spawn_flags, user_setup, user_setup_data, pid_callback, *pid_callback_data) | |
| launch_uris_as_manager_with_fds(uris, launch_context, spawn_flags, user_setup, user_setup_data, pid_callback, pid_callback_data, stdin_fd, stdout_fd, stderr_fd) | |
| list_actions() | 
Virtual Methods¶
| Inherited: | GObject.Object (7), Gio.AppInfo (25) | 
|---|
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Fields¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class Gio.DesktopAppInfo(**kwargs)¶
- Bases: - GObject.Object,- Gio.AppInfo- Abstract: - No - Structure: - Gio.DesktopAppInfoClass- Gio.DesktopAppInfois an implementation of- Gio.AppInfobased on desktop files.- Note that - <gio/gdesktopappinfo.h>belongs to the UNIX-specific GIO interfaces, thus you have to use the- gio-unix-2.0.pcpkg-config file when using it.- 
classmethod get_implementations(interface)[source]¶
- Parameters: - interface ( - str) – the name of the interface- Returns: - a list of - Gio.DesktopAppInfoobjects.- Return type: - [ - Gio.DesktopAppInfo]- Gets all applications that implement interface. - An application implements an interface if that interface is listed in the Implements= line of the desktop file of the application. - New in version 2.42. 
 - 
classmethod new(desktop_id)[source]¶
- Parameters: - desktop_id ( - str) – the desktop file id- Returns: - a new - Gio.DesktopAppInfo, or- Noneif no desktop file with that id exists.- Return type: - Gio.DesktopAppInfoor- None- Creates a new - Gio.DesktopAppInfobased on a desktop file id.- A desktop file id is the basename of the desktop file, including the .desktop extension. GIO is looking for a desktop file with this name in the - applicationssubdirectories of the XDG data directories (i.e. the directories specified in the- XDG_DATA_HOMEand- XDG_DATA_DIRSenvironment variables). GIO also supports the prefix-to-subdirectory mapping that is described in the Menu Spec (i.e. a desktop id of kde-foo.desktop will match- /usr/share/applications/kde/foo.desktop).
 - 
classmethod new_from_filename(filename)[source]¶
- Parameters: - filename ( - str) – the path of a desktop file, in the GLib filename encoding- Returns: - a new - Gio.DesktopAppInfoor- Noneon error.- Return type: - Gio.DesktopAppInfoor- None- Creates a new - Gio.DesktopAppInfo.
 - 
classmethod new_from_keyfile(key_file)[source]¶
- Parameters: - key_file ( - GLib.KeyFile) – an opened- GLib.KeyFile- Returns: - a new - Gio.DesktopAppInfoor- Noneon error.- Return type: - Gio.DesktopAppInfoor- None- Creates a new - Gio.DesktopAppInfo.- New in version 2.18. 
 - 
classmethod search(search_string)[source]¶
- Parameters: - search_string ( - str) – the search string to use- Returns: - a list of strvs. Free each item with - GLib.strfreev() and free the outer list with- GLib.free().- Return type: - [[ - str]]- Searches desktop files for ones that match search_string. - The return value is an array of strvs. Each strv contains a list of applications that matched search_string with an equal score. The outer list is sorted by score so that the first strv contains the best-matching applications, and so on. The algorithm for determining matches is undefined and may change at any time. - None of the search results are subjected to the normal validation checks performed by - Gio.DesktopAppInfo.new() (for example, checking that the executable referenced by a result exists), and so it is possible for- Gio.DesktopAppInfo.new() to return- Nonewhen passed an app ID returned by this function. It is expected that calling code will do this when subsequently creating a- Gio.DesktopAppInfofor each result.
 - 
classmethod set_desktop_env(desktop_env)[source]¶
- Parameters: - desktop_env ( - str) – a string specifying what desktop this is- Sets the name of the desktop that the application is running in. This is used by - Gio.AppInfo.should_show() and- Gio.DesktopAppInfo.get_show_in() to evaluate the- OnlyShowInand- NotShowIndesktop entry fields.- Should be called only once; subsequent calls are ignored. - Deprecated since version 2.42: do not use this API. Since 2.42 the value of the - XDG_CURRENT_DESKTOPenvironment variable will be used.
 - 
get_action_name(action_name)[source]¶
- Parameters: - action_name ( - str) – the name of the action as from- Gio.DesktopAppInfo.list_actions()- Returns: - the locale-specific action name - Return type: - str- Gets the user-visible display name of the “additional application action” specified by action_name. - This corresponds to the “Name” key within the keyfile group for the action. - New in version 2.38. 
 - 
get_boolean(key)[source]¶
- Parameters: - key ( - str) – the key to look up- Returns: - the boolean value, or - Falseif the key is not found- Return type: - bool- Looks up a boolean value in the keyfile backing self. - The key is looked up in the “Desktop Entry” group. - New in version 2.36. 
 - 
get_categories()[source]¶
- Returns: - The unparsed Categories key from the desktop file; i.e. no attempt is made to split it by ‘;’ or validate it. - Return type: - str- Gets the categories from the desktop file. 
 - 
get_filename()[source]¶
- Returns: - The full path to the file for self, or - Noneif not known.- Return type: - str- When self was created from a known filename, return it. In some situations such as the - Gio.DesktopAppInforeturned from- Gio.DesktopAppInfo.new_from_keyfile(), this function will return- None.- New in version 2.24. 
 - 
get_generic_name()[source]¶
- Returns: - The value of the GenericName key - Return type: - str- Gets the generic name from the destkop file. 
 - Returns: - Trueif hidden,- Falseotherwise.- Return type: - bool- A desktop file is hidden if the Hidden key in it is set to True. 
 - 
get_keywords()[source]¶
- Returns: - The value of the Keywords key - Return type: - [ - str]- Gets the keywords from the desktop file. - New in version 2.32. 
 - 
get_locale_string(key)[source]¶
- Parameters: - key ( - str) – the key to look up- Returns: - a newly allocated string, or - Noneif the key is not found- Return type: - stror- None- Looks up a localized string value in the keyfile backing self translated to the current locale. - The key is looked up in the “Desktop Entry” group. - New in version 2.56. 
 - 
get_nodisplay()[source]¶
- Returns: - The value of the NoDisplay key - Return type: - bool- Gets the value of the NoDisplay key, which helps determine if the application info should be shown in menus. See - GLib.KEY_FILE_DESKTOP_KEY_NO_DISPLAYand- Gio.AppInfo.should_show().- New in version 2.30. 
 - 
get_show_in(desktop_env)[source]¶
- Parameters: - desktop_env ( - stror- None) – a string specifying a desktop name- Returns: - Trueif the self should be shown in desktop_env according to the- OnlyShowInand- NotShowInkeys,- Falseotherwise.- Return type: - bool- Checks if the application info should be shown in menus that list available applications for a specific name of the desktop, based on the - OnlyShowInand- NotShowInkeys.- desktop_env should typically be given as - None, in which case the- XDG_CURRENT_DESKTOPenvironment variable is consulted. If you want to override the default mechanism then you may specify desktop_env, but this is not recommended.- Note that - Gio.AppInfo.should_show() for self will include this check (with- Nonefor desktop_env) as well as additional checks.- New in version 2.30. 
 - 
get_startup_wm_class()[source]¶
- Returns: - the startup WM class, or - Noneif none is set in the desktop file.- Return type: - str- Retrieves the StartupWMClass field from self. This represents the WM_CLASS property of the main window of the application, if launched through self. - New in version 2.34. 
 - 
get_string(key)[source]¶
- Parameters: - key ( - str) – the key to look up- Returns: - a newly allocated string, or - Noneif the key is not found- Return type: - str- Looks up a string value in the keyfile backing self. - The key is looked up in the “Desktop Entry” group. - New in version 2.36. 
 - 
get_string_list(key)[source]¶
- Parameters: - key ( - str) – the key to look up- Returns: - a - None-terminated string array or- Noneif the specified key cannot be found. The array should be freed with- GLib.strfreev().- Return type: - [ - str]- Looks up a string list value in the keyfile backing self. - The key is looked up in the “Desktop Entry” group. - New in version 2.60. 
 - 
has_key(key)[source]¶
- Parameters: - key ( - str) – the key to look up- Returns: - Trueif the key exists- Return type: - bool- Returns whether key exists in the “Desktop Entry” group of the keyfile backing self. - New in version 2.36. 
 - 
launch_action(action_name, launch_context)[source]¶
- Parameters: - action_name (str) – the name of the action as fromGio.DesktopAppInfo.list_actions()
- launch_context (Gio.AppLaunchContextorNone) – aGio.AppLaunchContext
 - Activates the named application action. - You may only call this function on action names that were returned from - Gio.DesktopAppInfo.list_actions().- Note that if the main entry of the desktop file indicates that the application supports startup notification, and launch_context is non- - None, then startup notification will be used when activating the action (and as such, invocation of the action on the receiving side must signal the end of startup notification when it is completed). This is the expected behaviour of applications declaring additional actions, as per the desktop file specification.- As with - Gio.AppInfo.launch() there is no way to detect failures that occur while using this function.- New in version 2.38. 
- action_name (
 - 
launch_uris_as_manager(uris, launch_context, spawn_flags, user_setup, user_setup_data, pid_callback, *pid_callback_data)[source]¶
- Parameters: - uris ([str]) – List of URIs
- launch_context (Gio.AppLaunchContextorNone) – aGio.AppLaunchContext
- spawn_flags (GLib.SpawnFlags) –GLib.SpawnFlags, used for each process
- user_setup (GLib.SpawnChildSetupFuncorNone) – aGLib.SpawnChildSetupFunc, used once for each process.
- user_setup_data (objectorNone) – User data for user_setup
- pid_callback (Gio.DesktopAppLaunchCallbackorNone) – Callback for child processes
- pid_callback_data (objectorNone) – User data for callback
 - Raises: - Returns: - Return type: - This function performs the equivalent of - Gio.AppInfo.launch_uris(), but is intended primarily for operating system components that launch applications. Ordinary applications should use- Gio.AppInfo.launch_uris().- If the application is launched via GSpawn, then spawn_flags, user_setup and user_setup_data are used for the call to - GLib.spawn_async(). Additionally, pid_callback (with pid_callback_data) will be called to inform about the PID of the created process. See- GLib.spawn_async_with_pipes() for information on certain parameter conditions that can enable an optimized posix_spawn() codepath to be used.- If application launching occurs via some other mechanism (eg: D-Bus activation) then spawn_flags, user_setup, user_setup_data, pid_callback and pid_callback_data are ignored. 
- uris ([
 - 
launch_uris_as_manager_with_fds(uris, launch_context, spawn_flags, user_setup, user_setup_data, pid_callback, pid_callback_data, stdin_fd, stdout_fd, stderr_fd)[source]¶
- Parameters: - uris ([str]) – List of URIs
- launch_context (Gio.AppLaunchContextorNone) – aGio.AppLaunchContext
- spawn_flags (GLib.SpawnFlags) –GLib.SpawnFlags, used for each process
- user_setup (GLib.SpawnChildSetupFuncorNone) – aGLib.SpawnChildSetupFunc, used once for each process.
- user_setup_data (objectorNone) – User data for user_setup
- pid_callback (Gio.DesktopAppLaunchCallbackorNone) – Callback for child processes
- pid_callback_data (objectorNone) – User data for callback
- stdin_fd (int) – file descriptor to use for child’s stdin, or -1
- stdout_fd (int) – file descriptor to use for child’s stdout, or -1
- stderr_fd (int) – file descriptor to use for child’s stderr, or -1
 - Raises: - Returns: - Return type: - Equivalent to - Gio.DesktopAppInfo.launch_uris_as_manager() but allows you to pass in file descriptors for the stdin, stdout and stderr streams of the launched process.- If application launching occurs via some non-spawn mechanism (e.g. D-Bus activation) then stdin_fd, stdout_fd and stderr_fd are ignored. - New in version 2.58. 
- uris ([
 - 
list_actions()[source]¶
- Returns: - a list of strings, always non- - None- Return type: - [ - str]- Returns the list of “additional application actions” supported on the desktop file, as per the desktop file specification. - As per the specification, this is the list of actions that are explicitly listed in the “Actions” key of the [Desktop Entry] group. - New in version 2.38. 
 
- 
classmethod 
Property Details¶
- 
Gio.DesktopAppInfo.props.filename¶
- Name: - filename- Type: - str- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The origin filename of this - Gio.DesktopAppInfo