1GAPPLICATION(1) User Commands GAPPLICATION(1)
2
3
4
6 gapplication - D-Bus application launcher
7
9 gapplication help [COMMAND]
10
11 gapplication version
12
13 gapplication list-apps
14
15 gapplication launch APPID
16
17 gapplication launch APPID [FILE...]
18
19 gapplication list-actions APPID
20
21 gapplication action APPID ACTION [PARAMETER]
22
24 gapplication is a commandline implementation of the client-side of the
25 org.freedesktop.Application interface as specified by the
26 freedesktop.org Desktop Entry Specification.
27
28 gapplication can be used to start applications that have
29 DBusActivatable set to true in their .desktop files and can be used to
30 send messages to already-running instances of other applications.
31
32 It is possible for applications to refer to gapplication in the Exec
33 line of their .desktop file to maintain backwards compatibility with
34 implementations that do not directly support DBusActivatable.
35
36 gapplication ships as part of GLib.
37
39 Global commands
40 help [COMMAND]
41 Displays a short synopsis of the available commands or provides
42 detailed help on a specific command.
43
44 version
45 Prints the GLib version whence gapplication came.
46
47 list-apps
48 Prints a list of all application IDs that are known to support
49 D-Bus activation. This list is generated by scanning .desktop files
50 as per the current XDG_DATA_DIRS.
51
52 launch APPID [FILE...]
53 Launches an application.
54
55 The first parameter is the application ID in the familiar "reverse
56 DNS" style (eg: 'org.gnome.app') without the .desktop suffix.
57
58 Optionally, if additional parameters are given, they are treated as
59 the names of files to open and may be filenames or URIs. If no
60 files are given then the application is simply activated.
61
62 list-actions APPID
63 List the actions declared in the application's .desktop file. The
64 parameter is the application ID, as above.
65
66 action APPID ACTION [PARAMETER]
67 Invokes the named action (in the same way as would occur when
68 activating an action specified in the .desktop file).
69
70 The application ID (as above) is the first parameter. The action
71 name follows.
72
73 Optionally, following the action name can be one parameter, in
74 GVariant format, given as a single argument. Make sure to use
75 sufficient quoting.
76
78 From the commandline
79 Launching an application:
80
81 gapplication launch org.example.fooview
82
83
84 Opening a file with an application:
85
86 gapplication launch org.example.fooview ~/file.foo
87
88
89 Opening many files with an application:
90
91 gapplication launch org.example.fooview ~/foos/*.foo
92
93
94 Invoking an action on an application:
95
96 gapplication action org.example.fooview create
97
98
99 Invoking an action on an application, with an action:
100
101 gapplication action org.example.fooview show-item '"item_id_828739"'
102
103
104 From the Exec lines of a .desktop file
105 The commandline interface of gapplication was designed so that it could
106 be used directly from the Exec line of a .desktop file.
107
108 You might want to do this to allow for backwards compatibility with
109 implementations of the specification that do not understand how to do
110 D-Bus activation, without having to install a separate utility program.
111
112 Consider the following example:
113
114 [Desktop Entry]
115 Version=1.1
116 Type=Application
117 Name=Foo Viewer
118 DBusActivatable=true
119 MimeType=image/x-foo;
120 Exec=gapplication launch org.example.fooview %F
121 Actions=gallery;create;
122
123 [Desktop Action gallery]
124 Name=Browse Gallery
125 Exec=gapplication action org.example.fooview gallery
126
127 [Desktop Action create]
128 Name=Create a new Foo!
129 Exec=gapplication action org.example.fooview create
130
131
132 From a script
133 If installing an application that supports D-Bus activation you may
134 still want to put a file in /usr/bin so that your program can be
135 started from a terminal.
136
137 It is possible for this file to be a shell script. The script can
138 handle arguments such as --help and --version directly. It can also
139 parse other command line arguments and convert them to uses of
140 gapplication to activate the application, open files, or invoke
141 actions.
142
143 Here is a simplified example, as may be installed in /usr/bin/fooview:
144
145 #!/bin/sh
146
147 case "$1" in
148 --help)
149 echo "see 'man fooview' for more information"
150 ;;
151
152 --version)
153 echo "fooview 1.2"
154 ;;
155
156 --gallery)
157 gapplication action org.example.fooview gallery
158 ;;
159
160 --create)
161 gapplication action org.example.fooview create
162 ;;
163
164 -*)
165 echo "unrecognised commandline argument"
166 exit 1
167 ;;
168
169 *)
170 gapplication launch org.example.fooview "$@"
171 ;;
172 esac
173
174
176 Desktop Entry Specification[1], gdbus(1), xdg-open(1), desktop-file-
177 validate(1)
178
180 1. Desktop Entry Specification
181 http://standards.freedesktop.org/desktop-entry-spec/latest/
182
183
184
185GIO GAPPLICATION(1)