~alan-griffiths/miral/fix-1645284

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
Building and using MirAL  {#building_and_using_miral}
========================

These instructions assume that you’re using Ubuntu 16.04LTS or later, I’ve not
earlier Ubuntu versions or other distributions.

You’ll need a few development and utility packages installed, along with the
Mir development packages:

    $ sudo apt-get install cmake g++ make bzr python-pil
    $ sudo apt-get install libmirserver-dev libmirclient-dev mirtest-dev
    $ sudo apt-get install mir-graphics-drivers-desktop

(If you’re working on a phone or tablet use mir-graphics-drivers-android in
place of mir-graphics-drivers-desktop.)

With these installed you can checkout and build miral:

    $ bzr branch lp:miral
    $ mkdir miral/build
    $ cd  miral/build
    $ cmake ..
    $ make
    
This creates libmiral.so in the lib directory and an example shell 
(miral-shell) in the bin directory. This can be run directly:

    $ bin/miral-shell
    
With the default options this runs in a window on X (which is convenient for
development). 

The miral-shell example is simple, don’t expect to see a sophisticated launcher
by default. You can start mir apps from the command-line. For example:
 
    $ bin/miral-run gnome-terminal
    
That’s right, a lot of standard GTK+ applications will “just work” (the GDK
toolkit has a Mir backend). Any that assume the existence of an X11 and bypass
the toolkit my making X11 protocol calls will have problems though.

To exit from miral-shell press Ctrl-Alt-BkSp.

To run independently of X11 you need to grant access to the graphics hardware
(by running as root) and specify a VT to run in. For example:

    $ sudo bin/miral-shell --vt 4 --arw-file --file $XDG_RUNTIME_DIR/mir_socket
    
For convenient testing there's a "testrun" script that wraps this command to
start the server (as root) and then launches the gnome-terminal (as the current
user):
 
    $ ../scripts/testrun

Support for X11 applications
----------------------------

If you want to run X11 applications that do not have native Mir support in the
toolkit they use then the answer is Xmir: an X11 server that runs on Mir. First
you need Xmir installed:
 
    $ sudo apt install xmir

Then you can use the testrun script to start miral-shell with Xmir:

    $ ../scripts/testrun -Xmir

This starts an X11 server on DISPLAY=:1. This is set in the terminal the script
starts so that applications launched from it will automatically connect to
miral through Xmir.

Running applications on Miral
-----------------------------

Assuming you have a Mir server running, native Mir applications can be started
from the command-line:

    $ sudo apt-get install mir-demos
    $ mir_demo_client_egltriangle

Similarly, GTK+, Qt and SDL applications can be run with the miral-run script:
 
    $ bin/miral-run gedit
    $ bin/miral-run 7kaa


Configuration options
---------------------

You can list the configuration options for miral-shell with "--help":

    $ bin/miral-shell --help
    
Most of these options are inherited from Mir. These can be set on the command
line, by environment variables or in a config file. For example, if you want to
start the gnome-terminal when you run miral-shell you can:

Set supply the option on the command line:

    $ bin/miral-shell --startup-apps gnome-terminal
    
Set the corresponding MIR_SERVER_<option> environment variable:
    
    $ export MIR_SERVER_STARTUP_APPS=gnome-terminal
    ...
    $ bin/miral-shell
    
Create a miral-shell config file:

    $ echo startup-apps=gnome-terminal > ~/.config/miral-shell.config
    ...
    $ bin/miral-shell


Running Qt applications
-----------------------

To run Qt applications under Mir you may need to install qtubuntu-desktop:

    $ sudo apt-get install qtubuntu-desktop