CMenu.DesktopAppInfo

g CMenu.DesktopAppInfo CMenu.DesktopAppInfo GObject.GInterface GObject.GInterface Gio.AppInfo Gio.AppInfo GObject.GInterface->Gio.AppInfo GObject.Object GObject.Object GObject.Object->CMenu.DesktopAppInfo Gio.AppInfo->CMenu.DesktopAppInfo

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.AppInfo (40)

Structs:

GObject.ObjectClass (5)

class

new (desktop_id)

class

new_from_filename (filename)

class

new_from_keyfile (key_file)

get_action_name (action_name)

get_boolean (key)

get_categories ()

get_filename ()

get_flatpak_app_id ()

get_generic_name ()

get_is_flatpak ()

get_is_hidden ()

get_keywords ()

get_locale_string (key)

get_nodisplay ()

get_show_in (desktop_env)

get_startup_wm_class ()

get_string (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)

list_actions ()

Virtual Methods

Inherited:

GObject.Object (7), Gio.AppInfo (25)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class CMenu.DesktopAppInfo(**kwargs)
Bases:

GObject.Object, Gio.AppInfo

Abstract:

No

Structure:

CMenu.DesktopAppInfoClass

classmethod new(desktop_id)
Parameters:

desktop_id (str) – the desktop file id

Returns:

None

Return type:

CMenu.DesktopAppInfo or None

This is currently unused in Cinnamon and does not make sense here because the desktop id as used here is not necessarily unique

classmethod new_from_filename(filename)
Parameters:

filename (str) – the path of a desktop file, in the GLib filename encoding

Returns:

a new CMenu.DesktopAppInfo or None on error.

Return type:

CMenu.DesktopAppInfo or None

Creates a new CMenu.DesktopAppInfo.

classmethod new_from_keyfile(key_file)
Parameters:

key_file (GLib.KeyFile) – an opened GLib.KeyFile

Returns:

a new CMenu.DesktopAppInfo or None on error.

Return type:

CMenu.DesktopAppInfo or None

Creates a new CMenu.DesktopAppInfo.

get_action_name(action_name)
Parameters:

action_name (str) – the name of the action as from CMenu.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)
Parameters:

key (str) – the key to look up

Returns:

the boolean value, or False if the key is not found

Return type:

bool

Looks up a boolean value in the keyfile backing info.

The key is looked up in the “Desktop Entry” group.

get_categories()
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()
Returns:

The full path to the file for info, or None if not known.

Return type:

str

When info was created from a known filename, return it. In some situations such as the CMenu.DesktopAppInfo returned from CMenu.DesktopAppInfo.new_from_keyfile(), this function will return None.

New in version 2.24.

get_flatpak_app_id()
Returns:

the flatpak app id or None

Return type:

str or None

This function looks up the “X-Flatpak” key of the [Desktop Entry] group, which contains the Flatpak App ID

get_generic_name()
Returns:

The value of the GenericName key

Return type:

str

Gets the generic name from the destkop file.

get_is_flatpak()
Returns:

True if info specifies a flatpak app, False otherwise

Return type:

bool

get_is_hidden()
Returns:

True if hidden, False otherwise.

Return type:

bool

A desktop file is hidden if the Hidden key in it is set to True.

get_keywords()
Returns:

The value of the Keywords key

Return type:

[str]

Gets the keywords from the desktop file.

get_locale_string(key)
Parameters:

key (str) – the key to look up

Returns:

a newly allocated string, or None if the key is not found

Return type:

str or None

Looks up a localized string value in the keyfile backing info translated to the current locale.

The key is looked up in the “Desktop Entry” group.

get_nodisplay()
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_DISPLAY and Gio.AppInfo.should_show().

get_show_in(desktop_env)
Parameters:

desktop_env (str or None) – a string specifying a desktop name

Returns:

True if the info should be shown in desktop_env according to the OnlyShowIn and NotShowIn keys, False otherwise.

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 OnlyShowIn and NotShowIn keys.

desktop_env should typically be given as None, in which case the XDG_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 info will include this check (with None for desktop_env) as well as additional checks.

get_startup_wm_class()
Returns:

the startup WM class, or None if none is set in the desktop file.

Return type:

str

Retrieves the StartupWMClass field from info. This represents the WM_CLASS property of the main window of the application, if launched through info.

Note: The returned value contain the suffix “:flatpak" if info specifies a flatpak app and if the desktop file has a StartupWMClass

get_string(key)
Parameters:

key (str) – the key to look up

Returns:

a newly allocated string, or None if the key is not found

Return type:

str

Looks up a string value in the keyfile backing info.

The key is looked up in the “Desktop Entry” group.

has_key(key)
Parameters:

key (str) – the key to look up

Returns:

True if the key exists

Return type:

bool

Returns whether key exists in the “Desktop Entry” group of the keyfile backing info.

launch_action(action_name, launch_context)
Parameters:

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.

launch_uris_as_manager(uris, launch_context, spawn_flags, user_setup, user_setup_data, pid_callback, *pid_callback_data)
Parameters:
Raises:

GLib.Error

Returns:

True on successful launch, False otherwise.

Return type:

bool

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.

list_actions()
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.