CMenu.DesktopAppInfo¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class CMenu.DesktopAppInfo(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new(desktop_id)¶
- Parameters:
desktop_id (
str
) – the desktop file id- Returns:
- Return type:
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
orNone
on error.- Return type:
Creates a new
CMenu.DesktopAppInfo
.
- classmethod new_from_keyfile(key_file)¶
- Parameters:
key_file (
GLib.KeyFile
) – an openedGLib.KeyFile
- Returns:
a new
CMenu.DesktopAppInfo
orNone
on error.- Return type:
Creates a new
CMenu.DesktopAppInfo
.
- get_action_name(action_name)¶
- Parameters:
action_name (
str
) – the name of the action as fromCMenu.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)¶
- 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 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:
Gets the categories from the desktop file.
- get_filename()¶
-
When info was created from a known filename, return it. In some situations such as the
CMenu.DesktopAppInfo
returned fromCMenu.DesktopAppInfo.new_from_keyfile
(), this function will returnNone
.New in version 2.24.
- get_flatpak_app_id()¶
-
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:
Gets the generic name from the destkop file.
- get_is_hidden()¶
-
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:
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:
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
().
- get_show_in(desktop_env)¶
- Parameters:
desktop_env (
str
orNone
) – a string specifying a desktop name- Returns:
True
if the info 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 info will include this check (withNone
for desktop_env) as well as additional checks.
- get_startup_wm_class()¶
-
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:
Looks up a string value in the keyfile backing info.
The key is looked up in the “Desktop Entry” group.
- has_key(key)¶
-
Returns whether key exists in the “Desktop Entry” group of the keyfile backing info.
- launch_action(action_name, launch_context)¶
- 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.
- launch_uris_as_manager(uris, launch_context, spawn_flags, user_setup, user_setup_data, pid_callback, *pid_callback_data)¶
- 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.
- list_actions()¶
-
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.