Gio.DesktopAppInfo¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gio.DesktopAppInfo(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GDesktopAppInfo
is an implementation of [iface`Gio`.AppInfo] based on desktop files.Note that
<gio/gdesktopappinfo.h>
belongs to the UNIX-specific GIO interfaces, thus you have to use thegio-unix-2.0.pc
pkg-config file or theGioUnix-2.0
GIR namespace when using it.- classmethod get_implementations(interface)[source]¶
- Parameters:
interface (
str
) – the name of the interface- Returns:
a list of
Gio.DesktopAppInfo
objects.- Return type:
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
, orNone
if no desktop file with that id exists.- Return type:
Creates a new
Gio.DesktopAppInfo
based 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
applications
subdirectories of the XDG data directories (i.e. the directories specified in theXDG_DATA_HOME
andXDG_DATA_DIRS
environment 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.DesktopAppInfo
orNone
on error.- Return type:
Creates a new
Gio.DesktopAppInfo
.
- classmethod new_from_keyfile(key_file)[source]¶
- Parameters:
key_file (
GLib.KeyFile
) – an openedGLib.KeyFile
- Returns:
a new
Gio.DesktopAppInfo
orNone
on error.- Return type:
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 withGLib.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 forGio.DesktopAppInfo.new
() to returnNone
when passed an app ID returned by this function. It is expected that calling code will do this when subsequently creating aGio.DesktopAppInfo
for 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
() andGio.DesktopAppInfo.get_show_in
() to evaluate theOnlyShowIn
andNotShowIn
desktop 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_DESKTOP
environment variable will be used.
- get_action_name(action_name)[source]¶
- Parameters:
action_name (
str
) – the name of the action as fromGio.DesktopAppInfo.list_actions
()- Returns:
the locale-specific action name
- Return type:
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
False
if the key is not found- Return type:
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:
Gets the categories from the desktop file.
- get_filename()[source]¶
-
When self was created from a known filename, return it. In some situations such as the
Gio.DesktopAppInfo
returned fromGio.DesktopAppInfo.new_from_keyfile
(), this function will returnNone
.New in version 2.24.
-
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
None
if the key is not found- Return type:
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:
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_DISPLAY
andGio.AppInfo.should_show
().New in version 2.30.
- get_show_in(desktop_env)[source]¶
- Parameters:
desktop_env (
str
orNone
) – a string specifying a desktop name- Returns:
True
if the self should be shown in desktop_env according to theOnlyShowIn
andNotShowIn
keys,False
otherwise.- Return type:
Checks if the application info should be shown in menus that list available applications for a specific name of the desktop, based on the
OnlyShowIn
andNotShowIn
keys.desktop_env should typically be given as
None
, in which case theXDG_CURRENT_DESKTOP
environment 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 (withNone
for desktop_env) as well as additional checks.New in version 2.30.
- get_startup_wm_class()[source]¶
-
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
None
if the key is not found- Return type:
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 orNone
if the specified key cannot be found. The array should be freed withGLib.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]¶
-
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.AppLaunchContext
orNone
) – 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.
- 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 URIslaunch_context (
Gio.AppLaunchContext
orNone
) – aGio.AppLaunchContext
spawn_flags (
GLib.SpawnFlags
) –GLib.SpawnFlags
, used for each processuser_setup (
GLib.SpawnChildSetupFunc
orNone
) – aGLib.SpawnChildSetupFunc
, used once for each process.pid_callback (
Gio.DesktopAppLaunchCallback
orNone
) – Callback for child processes
- 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 useGio.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. SeeGLib.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.
- 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 URIslaunch_context (
Gio.AppLaunchContext
orNone
) – aGio.AppLaunchContext
spawn_flags (
GLib.SpawnFlags
) –GLib.SpawnFlags
, used for each processuser_setup (
GLib.SpawnChildSetupFunc
orNone
) – aGLib.SpawnChildSetupFunc
, used once for each process.pid_callback (
Gio.DesktopAppLaunchCallback
orNone
) – Callback for child processesstdin_fd (
int
) – file descriptor to use for child’s stdin, or -1stdout_fd (
int
) – file descriptor to use for child’s stdout, or -1stderr_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.
Property Details¶
- Gio.DesktopAppInfo.props.filename¶
- Name:
filename
- Type:
- Default Value:
- Flags:
The origin filename of this
Gio.DesktopAppInfo