Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
DesktopAppInfo
is an implementation of AppInfo
based 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.pc
pkg-config
file when using it.
Synopsis
- newtype DesktopAppInfo = DesktopAppInfo (ManagedPtr DesktopAppInfo)
- class (GObject o, IsDescendantOf DesktopAppInfo o) => IsDesktopAppInfo o
- toDesktopAppInfo :: (MonadIO m, IsDesktopAppInfo o) => o -> m DesktopAppInfo
- desktopAppInfoGetActionName :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> Text -> m Text
- desktopAppInfoGetBoolean :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> Text -> m Bool
- desktopAppInfoGetCategories :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> m Text
- desktopAppInfoGetFilename :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> m [Char]
- desktopAppInfoGetGenericName :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> m Text
- desktopAppInfoGetImplementations :: (HasCallStack, MonadIO m) => Text -> m [DesktopAppInfo]
- desktopAppInfoGetIsHidden :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> m Bool
- desktopAppInfoGetKeywords :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> m [Text]
- desktopAppInfoGetLocaleString :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> Text -> m (Maybe Text)
- desktopAppInfoGetNodisplay :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> m Bool
- desktopAppInfoGetShowIn :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> Maybe Text -> m Bool
- desktopAppInfoGetStartupWmClass :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> m Text
- desktopAppInfoGetString :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> Text -> m Text
- desktopAppInfoGetStringList :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> Text -> m ([Text], Word64)
- desktopAppInfoHasKey :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> Text -> m Bool
- desktopAppInfoLaunchAction :: (HasCallStack, MonadIO m, IsDesktopAppInfo a, IsAppLaunchContext b) => a -> Text -> Maybe b -> m ()
- desktopAppInfoListActions :: (HasCallStack, MonadIO m, IsDesktopAppInfo a) => a -> m [Text]
- desktopAppInfoNew :: (HasCallStack, MonadIO m) => Text -> m (Maybe DesktopAppInfo)
- desktopAppInfoNewFromFilename :: (HasCallStack, MonadIO m) => [Char] -> m (Maybe DesktopAppInfo)
- desktopAppInfoNewFromKeyfile :: (HasCallStack, MonadIO m) => KeyFile -> m (Maybe DesktopAppInfo)
- desktopAppInfoSearch :: (HasCallStack, MonadIO m) => Text -> m [[Text]]
- desktopAppInfoSetDesktopEnv :: (HasCallStack, MonadIO m) => Text -> m ()
- constructDesktopAppInfoFilename :: (IsDesktopAppInfo o, MonadIO m) => Text -> m (GValueConstruct o)
- getDesktopAppInfoFilename :: (MonadIO m, IsDesktopAppInfo o) => o -> m (Maybe Text)
Exported types
newtype DesktopAppInfo Source #
Memory-managed wrapper type.
Instances
Eq DesktopAppInfo Source # | |
Defined in GI.Gio.Objects.DesktopAppInfo (==) :: DesktopAppInfo -> DesktopAppInfo -> Bool # (/=) :: DesktopAppInfo -> DesktopAppInfo -> Bool # | |
IsGValue DesktopAppInfo Source # | Convert |
Defined in GI.Gio.Objects.DesktopAppInfo toGValue :: DesktopAppInfo -> IO GValue # fromGValue :: GValue -> IO DesktopAppInfo # | |
ManagedPtrNewtype DesktopAppInfo Source # | |
Defined in GI.Gio.Objects.DesktopAppInfo | |
TypedObject DesktopAppInfo Source # | |
Defined in GI.Gio.Objects.DesktopAppInfo | |
GObject DesktopAppInfo Source # | |
Defined in GI.Gio.Objects.DesktopAppInfo | |
HasParentTypes DesktopAppInfo Source # | |
Defined in GI.Gio.Objects.DesktopAppInfo | |
type ParentTypes DesktopAppInfo Source # | |
Defined in GI.Gio.Objects.DesktopAppInfo |
class (GObject o, IsDescendantOf DesktopAppInfo o) => IsDesktopAppInfo o Source #
Type class for types which can be safely cast to DesktopAppInfo
, for instance with toDesktopAppInfo
.
Instances
(GObject o, IsDescendantOf DesktopAppInfo o) => IsDesktopAppInfo o Source # | |
Defined in GI.Gio.Objects.DesktopAppInfo |
toDesktopAppInfo :: (MonadIO m, IsDesktopAppInfo o) => o -> m DesktopAppInfo Source #
Cast to DesktopAppInfo
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Overloaded methods
getActionName
desktopAppInfoGetActionName Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> Text |
|
-> m Text | Returns: the locale-specific action name |
Gets the user-visible display name of the "additional application
action" specified by actionName
.
This corresponds to the "Name" key within the keyfile group for the action.
Since: 2.38
getBoolean
desktopAppInfoGetBoolean Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> Text |
|
-> m Bool | Returns: the boolean value, or |
Looks up a boolean value in the keyfile backing info
.
The key
is looked up in the "Desktop Entry" group.
Since: 2.36
getCategories
desktopAppInfoGetCategories Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> m Text | Returns: The unparsed Categories key from the desktop file; i.e. no attempt is made to split it by ';' or validate it. |
Gets the categories from the desktop file.
getFilename
desktopAppInfoGetFilename Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> m [Char] | Returns: The full path to the file for |
When info
was created from a known filename, return it. In some
situations such as the DesktopAppInfo
returned from
desktopAppInfoNewFromKeyfile
, this function will return Nothing
.
Since: 2.24
getGenericName
desktopAppInfoGetGenericName Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> m Text | Returns: The value of the GenericName key |
Gets the generic name from the destkop file.
getImplementations
desktopAppInfoGetImplementations Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m [DesktopAppInfo] | Returns: a list of |
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.
Since: 2.42
getIsHidden
desktopAppInfoGetIsHidden Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> m Bool | Returns: |
A desktop file is hidden if the Hidden key in it is set to True.
getKeywords
desktopAppInfoGetKeywords Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> m [Text] | Returns: The value of the Keywords key |
Gets the keywords from the desktop file.
Since: 2.32
getLocaleString
desktopAppInfoGetLocaleString Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> Text |
|
-> m (Maybe Text) | Returns: a newly allocated string, or |
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.
Since: 2.56
getNodisplay
desktopAppInfoGetNodisplay Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> m Bool | Returns: The value of the NoDisplay key |
Gets the value of the NoDisplay key, which helps determine if the
application info should be shown in menus. See
KEY_FILE_DESKTOP_KEY_NO_DISPLAY
and appInfoShouldShow
.
Since: 2.30
getShowIn
desktopAppInfoGetShowIn Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> Maybe Text |
|
-> m Bool | Returns: |
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.
desktopEnv
should typically be given as Nothing
, in which case the
XDG_CURRENT_DESKTOP
environment variable is consulted. If you want
to override the default mechanism then you may specify desktopEnv
,
but this is not recommended.
Note that appInfoShouldShow
for info
will include this check (with
Nothing
for desktopEnv
) as well as additional checks.
Since: 2.30
getStartupWmClass
desktopAppInfoGetStartupWmClass Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> m Text | Returns: the startup WM class, or |
Retrieves the StartupWMClass field from info
. This represents the
WM_CLASS property of the main window of the application, if launched
through info
.
Since: 2.34
getString
desktopAppInfoGetString Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> Text |
|
-> m Text | Returns: a newly allocated string, or |
Looks up a string value in the keyfile backing info
.
The key
is looked up in the "Desktop Entry" group.
Since: 2.36
getStringList
desktopAppInfoGetStringList Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> Text |
|
-> m ([Text], Word64) | Returns:
a |
Looks up a string list value in the keyfile backing info
.
The key
is looked up in the "Desktop Entry" group.
Since: 2.60
hasKey
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> Text |
|
-> m Bool | Returns: |
Returns whether key
exists in the "Desktop Entry" group
of the keyfile backing info
.
Since: 2.36
launchAction
desktopAppInfoLaunchAction Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a, IsAppLaunchContext b) | |
=> a |
|
-> Text |
|
-> Maybe b |
|
-> m () |
Activates the named application action.
You may only call this function on action names that were
returned from desktopAppInfoListActions
.
Note that if the main entry of the desktop file indicates that the
application supports startup notification, and launchContext
is
non-Nothing
, 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 appInfoLaunch
there is no way to detect failures that
occur while using this function.
Since: 2.38
listActions
desktopAppInfoListActions Source #
:: (HasCallStack, MonadIO m, IsDesktopAppInfo a) | |
=> a |
|
-> m [Text] | Returns: a list of strings, always non- |
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.
Since: 2.38
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Maybe DesktopAppInfo) | Returns: a new |
Creates a new 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 the XDG_DATA_HOME
and XDG_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
).
newFromFilename
desktopAppInfoNewFromFilename Source #
:: (HasCallStack, MonadIO m) | |
=> [Char] |
|
-> m (Maybe DesktopAppInfo) | Returns: a new |
Creates a new DesktopAppInfo
.
newFromKeyfile
desktopAppInfoNewFromKeyfile Source #
:: (HasCallStack, MonadIO m) | |
=> KeyFile |
|
-> m (Maybe DesktopAppInfo) | Returns: a new |
Creates a new DesktopAppInfo
.
Since: 2.18
search
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m [[Text]] | Returns: a
list of strvs. Free each item with |
Searches desktop files for ones that match searchString
.
The return value is an array of strvs. Each strv contains a list of
applications that matched searchString
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.
setDesktopEnv
desktopAppInfoSetDesktopEnv Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m () |
Deprecated: (Since version 2.42)do not use this API. Since 2.42 the value of theXDG_CURRENT_DESKTOP
environment variable will be used.
Sets the name of the desktop that the application is running in.
This is used by appInfoShouldShow
and
desktopAppInfoGetShowIn
to evaluate the
OnlyShowIn
and NotShowIn
desktop entry fields.
Should be called only once; subsequent calls are ignored.
Properties
filename
The origin filename of this DesktopAppInfo
constructDesktopAppInfoFilename :: (IsDesktopAppInfo o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “filename
” property. This is rarely needed directly, but it is used by new
.
getDesktopAppInfoFilename :: (MonadIO m, IsDesktopAppInfo o) => o -> m (Maybe Text) Source #
Get the value of the “filename
” property.
When overloading is enabled, this is equivalent to
get
desktopAppInfo #filename