~ci-train-bot/miral/miral-ubuntu-zesty-2641

330.160.4 by Alan Griffiths
Another pass
1
Getting and Using MirAL  {#getting_and_using_miral}
2
=======================
110 by Alan Griffiths
A bit of documentation
3
330.160.1 by Alan Griffiths
Refresh the "Building and Using MirAL" doc
4
Getting MirAL
5
-------------
6
330.160.4 by Alan Griffiths
Another pass
7
Depending upon your needs you can:
8
 
9
1. Install and use the MirAL examples [Using MirAL examples];
10
2. Use MirAL to develop your own Mir server [Using MirAL for development]; or,
11
3. Build MirAL yourself [Building MirAL]. 
12
 
330.160.1 by Alan Griffiths
Refresh the "Building and Using MirAL" doc
13
Using MirAL examples
14
--------------------
15
16
You can install the MirAL examples as follows:
17
330.160.3 by Alan Griffiths
Fix typo
18
    $ sudo apt install libmiral-examples
330.160.4 by Alan Griffiths
Another pass
19
    $ sudo apt install mir-graphics-drivers-desktop qtubuntu-desktop
330.160.1 by Alan Griffiths
Refresh the "Building and Using MirAL" doc
20
21
For convenient testing there's a "miral-app" script that wraps the commands used
22
in the last section to start the server and then launches the gnome-terminal (as
23
the current user):
24
25
    $ miral-app
26
219.2.1 by Alan Griffiths
Update and document scripts/testrun
27
To run independently of X11 you need to grant access to the graphics hardware
330.160.1 by Alan Griffiths
Refresh the "Building and Using MirAL" doc
28
(by running as root) and specify a VT to run in. There's a "miral-desktop"
29
script that wraps to start the server (as root) and then launch gnome-terminal
330.160.7 by Alan Griffiths
Fix three little errors
30
(as the current user):
330.160.1 by Alan Griffiths
Refresh the "Building and Using MirAL" doc
31
32
    $ miral-desktop
33
    
330.160.4 by Alan Griffiths
Another pass
34
For more options see [Options when running the MirAL example shell] below.
35
    
36
### Running applications on MirAL
330.160.1 by Alan Griffiths
Refresh the "Building and Using MirAL" doc
37
38
If you use the command-line launched by miral-app or miral-desktop native Mir
39
applications (which include native Mir clients and those that use SDL or the 
40
GTK+, Qt toolkits) can be started as usual:
41
42
    $ sudo apt install mir-demos kate neverball 
43
    $ mir_demo_client_egltriangle
44
    $ gedit
45
    $ kate
46
    $ neverball
47
48
From outside the MirAL session GTK+, Qt and SDL applications can still be run
49
using the miral-run script:
50
51
    $ miral-run gedit
52
    $ miral-run 7kaa
53
54
### Running for X11 applications
237.1.3 by Alan Griffiths
A bit of documentation about running Xmir
55
56
If you want to run X11 applications that do not have native Mir support in the
57
toolkit they use then the answer is Xmir: an X11 server that runs on Mir. First
58
you need Xmir installed:
330.121.1 by Daniel d'Andrada
Clear trailing whitespace
59
237.1.3 by Alan Griffiths
A bit of documentation about running Xmir
60
    $ sudo apt install xmir
61
330.160.1 by Alan Griffiths
Refresh the "Building and Using MirAL" doc
62
Then once you have started a miral shell (as above) you can use miral-xrun to
63
run applications under Xmir:
330.65.2 by Alan Griffiths
Rework the "using" instructions
64
330.160.1 by Alan Griffiths
Refresh the "Building and Using MirAL" doc
65
    $ miral-xrun firefox
330.65.2 by Alan Griffiths
Rework the "using" instructions
66
330.121.1 by Daniel d'Andrada
Clear trailing whitespace
67
This automatically starts a Xmir X11 server on a new $DISPLAY for the
330.65.2 by Alan Griffiths
Rework the "using" instructions
68
application to use. You can use miral-xrun both from a command-line outside the
330.160.1 by Alan Griffiths
Refresh the "Building and Using MirAL" doc
69
miral-shell or, for example, from the terminal running in the shell.
330.160.4 by Alan Griffiths
Another pass
70
71
### Options when running the MirAL example shell
72
73
#### Script Options
74
75
Both the "miral-app" and "miral-desktop" scripts provide options for using an
76
alternative example shell (miral-kiosk) and an alternative to gnome-terminal.
77
78
    -kiosk               use miral-kiosk instead of miral-shell
79
    -launcher <launcher> use <launcher> instead of 
80
                         'gnome-terminal --app-id com.canonical.miral.Terminal'
81
82
In addition miral-desktop has the option to set the VT that is used:
83
84
    -vt       <termid>   set the virtual terminal [4]
85
86
There are some additional options (listed with "-h") but those are the important
87
ones.
88
89
#### MirAL Options
90
91
The scripts can also be used to pass options to MirAL: they pass everything on
92
the command-line following the first thing they don't understand. These can be
93
listed by `miral-shell --help`. Most of these options are inherited from Mir,
94
but the following MirAL specific are likely to be of interest:
95
96
    --window-management-trace           log trace message
97
98
Probably the main use for MirAL is to test window-management (either of a
99
toolkit or of a server) and this logs all calls to and from the window 
100
management policy. This option is supported directly in the MirAL library and
101
works for any MirAL based shell - even one you write yourself.
102
103
    --keymap arg (=us)                  keymap <layout>[+<variant>[+<options>]]
104
                                        , e,g, "gb" or "cz+qwerty" or 
105
                                        "de++compose:caps"
106
107
For those of us not in the USA this is very useful. Both the -shell and -kiosk
108
examples support this option.
109
110
    --window-manager arg (=titlebar)   window management strategy 
111
                                       [{titlebar|tiling|system-compositor}]
112
330.160.7 by Alan Griffiths
Fix three little errors
113
Is only supported by miral-shell and its main use is to allow an alternative
330.160.4 by Alan Griffiths
Another pass
114
"tiling" window manager to be selected.
115
116
Using MirAL for development
117
---------------------------
118
330.160.7 by Alan Griffiths
Fix three little errors
119
Install the headers and libraries for using libmiral in development:
330.160.4 by Alan Griffiths
Another pass
120
121
    $ sudo apt install libmiral-dev
122
123
A `miral.pc` file is provided for use with `pkg-config` or other tools. For
124
example: `pkg-config --cflags miral`
125
126
The MirAL documentation can be installed and read like this:
127
128
    $ sudo apt install miral-doc
129
    $ xdg-open /usr/share/doc/miral-doc/html/index.html
130
131
Building MirAL
132
--------------
133
134
These instructions assume that you’re using Ubuntu 16.04LTS or later, I’ve not
135
earlier Ubuntu versions or other distributions.
136
137
You’ll need a few development and utility packages installed, along with the
138
Mir graphics drivers:
139
140
    $ sudo apt install devscripts equivs bzr
141
    $ sudo apt install mir-graphics-drivers-desktop
142
143
(If you’re working on a phone or tablet use mir-graphics-drivers-android in
144
place of mir-graphics-drivers-desktop.)
145
146
With these installed you can checkout and build miral:
147
148
    $ bzr branch lp:miral
149
    $ sudo mk-build-deps -i
150
    $ mkdir miral/build
151
    $ cd  miral/build
152
    $ cmake ..
153
    $ make
154
155
This creates libmiral.so in the lib directory and an example shell
156
(miral-shell) in the bin directory. This can be run directly:
157
158
    $ bin/miral-shell
159
160
With the default options this runs in a window on X (which is convenient for
161
development).
162
163
The miral-shell example is simple, don’t expect to see a sophisticated launcher
164
by default. You can start mir apps from the command-line. For example:
165
166
    $ bin/miral-run gnome-terminal
167
168
That’s right, a lot of standard GTK+ applications will “just work” (the GDK
169
toolkit has a Mir backend). Any that assume the existence of an X11 and bypass
170
the toolkit my making X11 protocol calls will have problems though.
171
172
To exit from miral-shell press Ctrl-Alt-BkSp.
173
174
You can install the MirAL examples, headers and libraries you've built with:
175
  
176
    $ sudo make install
177
    
178
Otherwise, you just need to add "bin/" to the beginning of the commands shown
179
in the previous section.